Trait frame_support::traits::tokens::nonfungibles_v2::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§
sourcefn buy_item(
collection: &Self::CollectionId,
item: &Self::ItemId,
buyer: &AccountId,
bid_price: &ItemPrice,
) -> DispatchResult
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.
sourcefn set_price(
collection: &Self::CollectionId,
item: &Self::ItemId,
sender: &AccountId,
price: Option<ItemPrice>,
whitelisted_buyer: Option<AccountId>,
) -> DispatchResult
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.
sourcefn item_price(
collection: &Self::CollectionId,
item: &Self::ItemId,
) -> Option<ItemPrice>
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.