Repository navigation
Conversation
- Return AuctionError::BuyNowUnavailable from spend_buy_now_actions instead of a custom driver error - Make the NFT unlock for a same-spend winning bid private - Build the bid and end action curry args in one place each - Cover CAT reserves for refunds in a buy now spend, both bid verifiers, and the minimum bid boundary - Move buy now validation tests to tests/validation.rs and add a parsing case - Share the harness's bid loop
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional buy now price to auctions. A bid at exactly that price wins outright, and the auction can be ended in the same spend instead of waiting for the end time.
Puzzles
No new action.
BUY_NOW_PRICE(0 means there isn't one) is curried into the existing bid and end actions.bid_action.rue(hashd94e4389be5a2d7f9fd692c792a78f184c8e1f70ec633873b22744f2d0233e9c): bids can't exceed the buy now price. A bid at exactly the price skips the bid verifier, so the increment can't make the price unreachable once there's a bid close to it. It must still be strictly higher than the winning bid and placed before the end time (or within the grace period).end_action.rue(hash5d9df3e170a0ee659f54372537dd49fd11973aaca297eb9b855b048e79b7f21b): if the winning bid equals the buy now price (and the price is nonzero), the end time and grace period assertions are skipped, since that bid can never be outbid. Payouts are unchanged.The bid and end puzzle hashes change for every auction, including auctions without a buy now price.
Driver
AuctionSettings::buy_now_price: Option<u64>, appended to the settings, so the launcher memo layout changes (the memo version stays 0).AuctionInfo::available_buy_now_price: the price while the auction can still be bought.AuctionExt::spend_buy_now_actions(ctx, puzzle_hash, grace, nft): returns the bid at the buy now price, the bid and end action spends, and the NFT unlocked to the buyer (to the bid placed in the same spend, not the auction's current winning bid). It returnsAuctionError::BuyNowUnavailableif the auction can't be bought now.ZeroBuyNowPrice) and a price below the minimum bid (BuyNowPriceBelowMinimumBid).The README has a new Buy Now section, and covers it in the life cycle, customization and validation sections.
Tests
tests/buy_now.rs:tests/validation.rsandtests/parsing.rscover the new validation errors at launch and when parsing a memo.Decisions for review
spend_buy_now_actionsreturnsAuctionError(with a typedBuyNowUnavailablevariant), unlike the otherAuctionExtmethods, which returnDriverError. The alternative is aDriverError::Customstring error, which callers can't match on.