-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(PE-6656) - return initiated dutch auctions (#92)
Summary: Introduces and `Auction` object class that is used to store auctions on the `NameRegistry`. We should look towards using more of these classes to leverage some better static analysis and type enforcement on functions. The class is responsible for computing prices based on the initialization details (baseFee, demandFactor, etc.). Auctions are stored as instances of this class, and returned as simple table (excluding function) so clients can compute prices themselves. This initial implementation includes handler support for ANTs returning `permabuy` name registrations. In a separate PR we'll introduce Lease-Expiration-Intiated-Auctions where a name will go in to auction after the grace period has ended. Checklist: - [x] business logic (and docs) to create and store auctions in state with pricing information - [x] handler for `Release-Name` that allows integration with ANTs - [x] handler for `Auction-Info` to get auction information of a given name - [x] handler for `Auction-Bid` to submit bid to acquire name in auction and update arns registry - [x] unit tests with >80% coverage - [x] integration tests for all handlers - [x] update ANT source code to support `Release-Name` handler that forwards to this process - PR: ar-io/ar-io-ant-process#23 - [x] update [ar-io-sdk](https://github.com/ar-io/ar-io-sdk) to include auction types and APIs for auctions - PR: ar-io/ar-io-sdk#235 - [ ] add event data for auction creation and auction bids - WILL DO IN A SEPARATE PR ONCE E2E TESTING IN DEVNET HAS BEEN VALIDATED TODOs: - [x] storing prices in auction state impacts the handler response (`Data` ends up being an empty table - not sure if this is a bug in AO or we are hitting a memory limit). it also costs ~600KiB to store those values in state, which could bloat our memory when several auctions are in process. we could consider just storing the settings of the auction pricing in state, and use that to calculate prices when necessary (still have to create the table, but response doesn't need to contain it). need to think more about this and what is necessary for clients to be able to showing pricing charts. - we've modified to store the auction settings on the auction object, and then clients will compute the price with various parameters Here is the sequence diagram for a permabuy initiated auction <img width="794" alt="image" src="https://github.com/user-attachments/assets/8b1699e2-a764-4a7d-ad65-cafddfe66c19">
- Loading branch information
Showing
14 changed files
with
1,350 additions
and
682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
```mermaid | ||
sequenceDiagram | ||
participant Owner/Initiator | ||
participant Bidder | ||
participant ANTProcess | ||
participant ProtocolBalance | ||
participant ARNSRegistry | ||
Owner/Initiator ->> ANTProcess: Send "Release-Name" message with tags | ||
alt Owner/Initiator is not owner of ANT process | ||
ANTProcess ->> Owner/Initiator: Invalid-Return-Name-Notice | ||
else Owner/Initiator is owner of ANT process | ||
ANTProcess ->> ARNSRegistry: Notify registry with `Release-Name` with [Name, Recipient] | ||
alt Name does not exist or does not map to process id | ||
ARNSRegistry ->> Owner/Initiator: Invalid-Return-Name-Notice (could be ANT) | ||
else Name exists and maps to name | ||
ARNSRegistry ->> ARNSRegistry: Create auction for name | ||
ARNSRegistry ->> ARNSRegistry: Accept bids for auction | ||
alt Valid bid received before expiration | ||
Bidder ->> ARNSRegistry: Send bid message with process-id | ||
ARNSRegistry ->> ARNSRegistry: Validate bid and calculate payouts | ||
ARNSRegistry ->> ARNSRegistry: Name added to registry | ||
ARNSRegistry ->> ProtocolBalance: Transfer 50% of proceeds | ||
ARNSRegistry ->> Owner/Initiator: Transfer 50% of proceeds | ||
ARNSRegistry ->> Bidder: Send Auction-Bid-Success-Notice | ||
else Invalid bid received before expiration (insufficient balance, too low, etc.) | ||
ARNSRegistry ->> Bidder: Auction-Bid-Failure-Notice | ||
else No bid received, auction expires | ||
ARNSRegistry ->> ARNSRegistry: Release name, no payouts | ||
end | ||
end | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.