NFT
Last updated
Last updated
NFT is not stored in the user's wallet, instead, each NFT exists in the NFT contract and is unique.
The role of the NFT contract is to keep accounts, that is, it is responsible for processing the creation, storage and transfer of . This makes NFTs ideal for representing ownership of an asset, such as a piece of digital content or event tickets.
Transferring an NFT can happen in two scenarios: (1) you ask to transfer an NFT, and (2) an authorized account asks to transfer the NFT.
Track real-time events (such as money transfers) by implementing the NFT event standard. Events are simple to use because they are just login messages formatted in a standardized way. Since these records are on-chain data, this is public information.
Mint NFTs with the matmo
This tutorial covers the simple-nft example.
Clone the -core repository.
You call nft_transfer_call
in the NFT-contract passing: the receiver, a message, and the token-id of .
The NFT contract transfers the NFT to the receiver.
The NFT contract calls receiver.nft_on_transfer(sender, token-owner, token-id, msg)
.
The NFT contract handles errors in the nft_resolve_transfer
callback.
The NFT contract returns true
if it succeeded.
The sender may first ask the receiver to acknowledge pending transfers off-chain.
This comes in the form of a multi-agent transaction request.
A multi-agent transaction contains multiple signatures, and each signature corresponds to an account on the chain.
From the workflow above it follows that the receiver we want to call needs to implement the nft_on_transfer
method. When executed, such method will know:
Who is sending the NFT, since it is a parameter
Who is the current owner, since it is a parameter
Which NFT was transferred, since it is a parameter.
If there are any parameters encoded as a message
Assume you want to attach an to a call on the receiver contract. The workflow is as follows:
The nft_on_transfer method