referrerpolicy=no-referrer-when-downgrade
frame_support::traits::tokens::nonfungibles_v2

Trait Trading

Source
pub trait Trading<AccountId, ItemPrice>: Inspect<AccountId> {
    // Required methods
    fn buy_item(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
        buyer: &AccountId,
        bid_price: &ItemPrice,
    ) -> DispatchResult;
    fn set_price(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
        sender: &AccountId,
        price: Option<ItemPrice>,
        whitelisted_buyer: Option<AccountId>,
    ) -> DispatchResult;
    fn item_price(
        collection: &Self::CollectionId,
        item: &Self::ItemId,
    ) -> Option<ItemPrice>;
}
Expand description

Trait for trading non-fungible items.

Required Methods§

Source

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

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

Source

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

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

Source

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§

impl<T: Config<I>, I: 'static> Trading<<T as Config>::AccountId, <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance> for Pallet<T, I>