Skip to content

Conversation

@tasiov
Copy link
Contributor

@tasiov tasiov commented Nov 26, 2024

Marketplace V2 Expiring Orders

This PR implements Expiring Orders on Stargaze Marketplace V2. The implemented features are outlined below.

Features

  • Each order (Ask, Bid, Collection Bid) now has an optional details.expiry attribute.
pub struct OrderDetails<T: AddressLike> {
    pub price: Coin,
    pub recipient: Option<T>,
    pub finder: Option<T>,
    pub expiry: Option<Expiry>,
}

pub struct Expiry {
    pub timestamp: Timestamp,
    pub reward: Coin,
}
  • When an Order is created or updated, the user may set a timestamp and supply funds that match the expiry.reward. This data signifies that whomever removes the Order after the timestamp has elapsed will be owed the expiry reward.

  • There is an admin managed MIN_EXPIRY_REWARDS map that sets the minimum viable expiry reward for specified denoms.

  • An index has been added on expiry.timestamp that allows traversing all Asks / Bids / Collection Bids by their expiration timestamp.

  • A Sudo::EndBlock message has been added that traverses the Order expiration timestamps, removes some number of expired Orders, and sends the rewards to the fee_manager address. The number of Orders removed each block is capped at the corresponding Config values: max_asks_removed_per_block, max_bids_removed_per_block, max_collection_bids_removed_per_block.

@tasiov tasiov requested a review from jhernandezb November 26, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants