You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the converter contract is instantiated by setting an admin and with a code_id of the cw721-metadata-onchain NFT contract, a new NFT contract is also instantiated with this code_id so that the converter contract is the minter of the newly instantiated NFT contract.
Name, Symbol and Minter information are entered in the newly instantiated contract while instantiating the converter contract.
The admin of the converter contract can mint NFTs to recipients since it is the minter, so the converter contract address should be used when calling the mint function. Using the NFT contract’s address results in caller not the owner error.
The user sends the NFT he/she owns from the old contract to the converter contract with send Nft function.
Converter contract receives the NFT and records NFT-related information such as token_id, sender, and the nft contract address and saves them to a state (TOKEN_INFO).
The convert function in the converter contract burns the NFT in the old contract, and within the same function mints a new NFT with the desired metadata to the sender who sent the NFT by the same token_id in the newly instantiated NFT contract.
Notes
Only the admin of the converter contract can mint NFTs to recipients.
The converter contract address should be used when calling the mint function.
When instantiating the converter contract, the cw721_code_id should belong to a cw721-metadata-onchain contract to allow onchain metadata functionality.