Universal NFT enables non-fungible ERC-721 tokens to minted and transferred between connected chains
The project consists of two ERC-721 contracts:
When transferring tokens between chains, a token is burned on the source chain. The token's metadata and information are sent in a message to the token contract on the destination chain, where a corresponding token is minted.
ZetaChainUniversalNFT.setConnected(zrc20, contractAddress)
, where zrc20
is the ZRC-20 contract of the gas token of a connected EVM chain, this acts as an identifier for a chain, and contractAddress
is the address of a Universal NFT on a connected EVM chain (see step 2).EVMUniversalNFT.setUniversal(contractAddress)
, where contractAddress
is an address of a Universal NFT on ZetaChain (see step 1).You now have two NFT contracts on ZetaChain and on an EVM chain connected. To add deploy an NFT contract on another EVM chain, repeat steps 2 and 3.
To mint an NFT as an owner run safeMint
. You can see the token ID in the Events tab.
To transfer a Universal NFT to another chain, run transferCrossChain
.
tokenId
: ID of a universal NFTreceiver
: address of the receiver on the destination chain.destination
: address of a ZRC-20 gas token of the destination chain. For example, when transferring an NFT from any chain to Base, use ZRC-20 Base ETH address. When transferring from any chain to ZetaChain, the address is 0x0000000000000000000000000000000000000000
.value
: amount of native gas tokens of the source chain (from which the NFT is being transferred) to cover gas costs. When transferring from any chain to ZetaChain the value is 0 (transfers to ZetaChain are free). When transferring from ZetaChain to a connected chain or between connected chains, the value should be sufficient to acquire the required amount of ZRC-20 gas tokens of the destination chain to make a transfer to that chain. For acquisition of gas ZRC-20 tokens, an instance of Uniswap v2 on ZetaChain is used. To know the required amount, run withdrawGasFeeWithGasLimit
on the corresponding ZRC-20 and query Uniswap to get a quote.Source: https://github.com/zeta-chain/standard-contracts/
🚧 This contract has not yet been audited. Please, study the source code and adapt it to your requirements before deploying in production.
⚠️ This contract is required for Universal NFT to work and must be deployed on ZetaChain.
Dec 17, 2024
MIT, , Unlicense