thirdweb

Universal Token on ZetaChain

Universal Token enables ERC-20 tokens to minted and transferred between connected chains

Overview

The project consists of two ERC-20 contracts:

  • Universal Token on ZetaChain. This contract must be deployed on ZetaChain. It can mint ERC-20s and transfer them to connected chains, but it also handles ERC-20s transfers between connected chains, so it's a required component.
  • Universal Token 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 Token (this contract) on ZetaChain.
  2. Deploy Universal Token on a connected EVM chain (for example, Ethereum, Base, Polygon or BNB)
  3. Run ZetaChainUniversalToken.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 Token on a connected EVM chain (see step 2).
  4. Run EVMUniversalToken.setUniversal(contractAddress), where contractAddress is an address of a Universal Token on ZetaChain (see step 1).

You now have two Token contracts on ZetaChain and on an EVM chain connected. To add deploy an Token contract on another EVM chain, repeat steps 2 and 3.

Minting a Token

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

Cross-Chain Token Transfer

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

  • tokenId: ID of a universal Token
  • 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 a Token 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 Token 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 Token to work and must be deployed on ZetaChain.


UPGRADE_INTERFACE_VERSION

(UPGRADE_INTERFACE_VERSION)

view

Published by

View all contracts

Details

  • Publish Date

    Jan 21, 2025

  • Licenses

    MIT, , Unlicense

  • Learn more about Publish