Depositing to EOA
✅ Native gas token to TSS with empty input data
To deposit native gas tokens from a connected chain to ZetaChain make a token transfer to the TSS address on the connected chain.
When depositing from an EVM chain you don't have to specify the recipient in the input data. If the input data is empty, the sender address will be used as the recipient address.
When depositing from Bitcoin you must specify the recipient address in the memo.
npx hardhat deposit --amount 0.01 --network sepolia_testnet
✅ Native gas token to TSS with recipient in input data
When depositing from an EVM chain you can optionally specify a recipient address in the input data (first 20 bytes).
npx hardhat deposit --amount 0.01 --network sepolia_testnet --recipient 0x4955a3F38ff86ae92A914445099caa8eA2B9bA32
✅ USDC to ERC-20 custody contract with no input data
Supported ERC-20 can be deposited to ZetaChain by calling the deposit
method
of the ERC-20 custody contract on a connected chain.
npx hardhat deposit --amount 1 --network sepolia_testnet --erc20 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
❌ USDC to ERC-20 custody contract with a message
Depositing ERC-20 to an EOA with a message will result in a transaction revert.
npx hardhat deposit --amount 1 --network sepolia_testnet --erc20 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 --message '[["string"], ["hello"]]' --recipient 0x4955a3F38ff86ae92A914445099caa8eA2B9bA32 --ignore-checks
Depositing to Omnichain Contract
✅ Native gas token to TSS with recipient and valid message
To deposit native gas tokens from a connected chain and call an omnichain contract on ZetaChain make a token transfer to the TSS address on the connected chain and specify omnichain contract address as the first 20 bytes of the input data and provide a valid message.
This is an example deposit and call of the example omnichain swap contract.
npx hardhat deposit --amount 3 --network sepolia_testnet --recipient 0x20C4770A73DF5e2ab4B38c08d1055c2173034257 --message '[["address", "bytes"], ["0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891", "0x4955a3F38ff86ae92A914445099caa8eA2B9bA32"]]'
✅ Native gas token to TSS with multiple outputs
A single deposit and call transaction can result in multiple outbound transactions triggering outputs on multiple connected chains.
This is an example deposit and call of the example omnichain multioutput contract.
npx hardhat deposit --amount 4 --network sepolia_testnet --recipient 0xa573Df1F0729FE6F1BD69b0a5dbFE393e6e09f47 --message '[["address", "bytes", "bytes"], ["0x4955a3F38ff86ae92A914445099caa8eA2B9bA32", "0x746231713873687a663761666333726877386e367736656333327338683665326d727730373764306767", "0x000000000000000000000000d97b1de3619ed2c6beb3860147e30ca8a7dc989100000000000000000000000065a45c57636f9bcced4fe193a602008578bca90b"]]'
❌ USDC with recipient and valid message
npx hardhat deposit --amount 1 --network sepolia_testnet --recipient 0x20C4770A73DF5e2ab4B38c08d1055c2173034257 --message '[["address", "bytes"], ["0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891", "0x4955a3F38ff86ae92A914445099caa8eA2B9bA32"]]' --erc20 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
❌ Native gas token to TSS with recipient and invalid message
If an omnichain contract expects a specific message, an invalid message will trigger a contract revert, resulting in a reverted deposit.
npx hardhat deposit --amount 0.01 --network sepolia_testnet --recipient 0x20C4770A73DF5e2ab4B38c08d1055c2173034257
Withdrawing
✅ Withdrawing native gas token ZRC-20 from ZetaChain
To withdraw native gas tokens ZRC-20 from ZetaChain to a connected chain, call
the withdraw
method of the ZRC-20 token contract on ZetaChain.
The withdraw amount must be higher than the withdraw fee. Each ZRC-20 token has its own withdraw fee.
npx hardhat withdraw --amount 0.1 --zrc20 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 --network zeta_testnet
✅ Withdrawing ERC-20 (USDC) ZRC-20 from ZetaChain
To withdraw ERC-20 ZRC-20 from ZetaChain to a connected chain, call the
withdraw
method of the ZRC-20 token contract on ZetaChain.
Withdraw fee for ERC-20 ZRC-20 is denominated in the connected chain's native gas token. For example, for ZRC-20 USDC from Ethereum the withdraw fee is denominated in ETH. The caller of with withdraw method must have enough native gas ZRC-20 (approved) to pay the withdraw fee.
npx hardhat withdraw --amount 1 --zrc20 0xcC683A782f4B30c138787CB5576a86AF66fdc31d --network zeta_testnet
Sending ZETA
✅ ZETA Between Connected Chains
npx hardhat send-zeta --amount 3 --network mumbai_testnet --destination bsc_testnet
❌ ZETA Between Connected Chains (insufficient amount)
npx hardhat send-zeta --amount 0.1 --network mumbai_testnet --destination bsc_testnet --ignore-checks
✅ ZETA to ZetaChain
npx hardhat send-zeta --amount 3 --network mumbai_testnet --destination zeta_testnet
✅ ZETA from ZetaChain
npx hardhat send-zeta --amount 3 --network zeta_testnet --destination mumbai_testnet