thirdweb

Universal NFT on ZetaChain

Universal NFT enables non-fungible ERC-721 tokens to minted and transferred between connected chains

Overview

The project consists of two ERC-721 contracts:

  • Universal NFT on ZetaChain. This contract must be deployed on ZetaChain. It can mint NFTs and transfer them to connected chains, but it also handles NFT transfers between connected chains, so it's a required component.
  • Universal NFT on EVM. This contract can be deployed on one or more connected EVM chains.

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.

Getting Started

  1. Deploy Universal NFT (this contract) on ZetaChain.
  2. Deploy Universal NFT on a connected EVM chain (for example, Ethereum, Base, Polygon or BNB)
  3. Run 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).
  4. Run 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.

Minting an NFT

To mint an NFT as an owner run safeMint. You can see the token ID in the Events tab.

Cross-Chain NFT Transfer

To transfer a Universal NFT to another chain, run transferCrossChain.

  • tokenId: ID of a universal NFT
  • receiver: 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.


UPGRADE_INTERFACE_VERSION

(UPGRADE_INTERFACE_VERSION)

view

Published by

View all contracts

Details

  • Publish Date

    Dec 17, 2024

  • Licenses

    MIT, , Unlicense


  • Learn more about Publish