pub trait NonFungibleTokenReceiver {
// Required method
fn nft_on_transfer(
&mut self,
sender_id: AccountId,
previous_owner_id: AccountId,
token_id: TokenId,
msg: String,
) -> PromiseOrValue<bool>;
}
Expand description
Used when an NFT is transferred using nft_transfer_call
. This trait is implemented on the receiving contract, not on the NFT contract.
Required Methods§
Sourcefn nft_on_transfer(
&mut self,
sender_id: AccountId,
previous_owner_id: AccountId,
token_id: TokenId,
msg: String,
) -> PromiseOrValue<bool>
fn nft_on_transfer( &mut self, sender_id: AccountId, previous_owner_id: AccountId, token_id: TokenId, msg: String, ) -> PromiseOrValue<bool>
Take some action after receiving a non-fungible token
Requirements:
- Contract MUST restrict calls to this function to a set of whitelisted NFT contracts
Arguments:
sender_id
: the sender ofnft_transfer_call
previous_owner_id
: the account that owned the NFT prior to it being transferred to this contract, which can differ fromsender_id
if using Approval Management extensiontoken_id
: thetoken_id
argument given tonft_transfer_call
msg
: information necessary for this contract to know how to process the request. This may include method names and/or arguments.
Returns true if token should be returned to sender_id