Calling Universal Apps
When interacting with a universal app on ZetaChain from a connected chain through the Gateway, fees are paid in the native gas token of the source chain, just like in standard transactions. There are no additional charges or fees, and execution of universal apps on ZetaChain can be considered gasless when a call is made from a connected chain.
For instance, depositing ETH from Ethereum to ZetaChain incurs a fee in ETH, aligning with Ethereum's usual gas fee structure. For detailed information on Ethereum gas, refer to the official documentation (opens in a new tab).
Direct calls to contracts on ZetaChain's EVM (not cross-chain calls) require users to provide gas fees for each transaction. The ZetaChain EVM employs a gas market mechanism inspired by Ethermint (opens in a new tab) and adheres to Ethereum's EIP 1559 fee model, which helps maintain network security and prevents spam.
Outgoing Calls and Withdrawals
Universal apps on ZetaChain can initiate calls to contracts on connected chains or facilitate withdrawals of ZRC-20 tokens back to a connected chain. These operations require a "withdraw gas fee," which is calculated based on the gas limit of the target chain.
Before making a call from a universal app to a contract on a connected chain, query the withdraw gas fee for the expected gas limit:
(address gasZRC20, uint256 gasFee) = IZRC20(zrc20).withdrawGasFeeWithGasLimit(gasLimit);
gasZRC20
is the address of the gas token for the destination chain of the call or withdrawal. For example, the gas token for both Ethereum USDC and ETH is ZRC-20 ETH.gasFee
is the required amount for the specified gas limit. This ensures you can accurately estimate the necessary fees for successful execution.
Before withdrawing ZRC-20 tokens to a connected chain, query the withdraw gas fee:
(address gasZRC20, uint256 gasFee) = IZRC20(zrc20).withdrawGasFee();
Withdrawals to connected chains result in token transfers and do not require an explicit gas limit.
It’s important to query the current gas fee, approve the Gateway to spend the necessary amount, and ensure the gas ZRC-20 token balance is sufficient. If the Gateway cannot transfer the required fee to itself, the operation will fail.
Current Fees
The table below displays the current withdraw gas fees, calculated using a default gas limit of 500,000. Fees are represented in the native gas token of the destination chain.
Symbol | Chain ID | Total Fee | Gas Fee | Protocol Fee |
---|
To calculate fees for a different gas limit, please, check out the fees
command in the smart-contract
template (opens in a new tab):
npx hardhat fees