Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marketplace V2 Expiring Orders #329

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Marketplace V2 Expiring Orders #329

wants to merge 9 commits into from

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.

1 participant