referrerpolicy=no-referrer-when-downgrade

Trait Trading

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§