referrerpolicy=no-referrer-when-downgrade
pub trait Trading<AccountId, ItemPrice>: Inspect<AccountId> {
    // Required methods
    fn buy_item(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
        buyer: &AccountId,
        bid_price: &ItemPrice,
    ) -> Result<(), DispatchError>;
    fn set_price(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
        sender: &AccountId,
        price: Option<ItemPrice>,
        whitelisted_buyer: Option<AccountId>,
    ) -> Result<(), DispatchError>;
    fn item_price(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
    ) -> Option<ItemPrice>;
}
Expand description

Trait for trading non-fungible items.

Required Methods§

fn buy_item( collection: &Self::CollectionId, item: &Self::ItemId, buyer: &AccountId, bid_price: &ItemPrice, ) -> Result<(), DispatchError>

Allows buyer to buy an item of collection if it’s up for sale with a bid_price to pay.

fn set_price( collection: &Self::CollectionId, item: &Self::ItemId, sender: &AccountId, price: Option<ItemPrice>, whitelisted_buyer: Option<AccountId>, ) -> Result<(), DispatchError>

Sets the item price for item to make it available for sale.

fn item_price( collection: &Self::CollectionId, item: &Self::ItemId, ) -> Option<ItemPrice>

Returns the item price of item or None if the item is not for sale.

Object Safety§

This trait is not object safe.

Implementors§