Understanding Gas Payments
Cross-chain transactions are all about gas.
The lack of atomicity, as well as varying prices of gas on different chains makes reliable execution very difficult to obtain. It's something we pride ourselves on, as for over a year we've been working closely with Axelar's relay team to hone gas payments to get reliable and cheap execution for our users.
Here are the basics:
Squid separates gas fee payments into source chain and cross-chain gas fees.
Source chain gas fees
Source chain gas fees are paid by the user as normal for any crypto transaction.
The Squid API/SDK/Widget recommends the
gasLimit
for the transaction.i.e. the maximum amount of gas that the source transaction will consume.
The user's wallet recommends a good price per unit of
gas
that will get the transaction executed on chain.This amount is variable and so the exact cost of the source chain transaction is unknown until the user completes the tx.
Cross-chain gas fees
Squid bundles all cross-chain gas fees into a single payment, whether the transaction includes multiple hops or just one hop. The complexity is abstracted away from any developer using the Squid API/SDK/Widget.
From EVM
For transactions from EVM chains, Axelar takes a gas payment using
value
in native tokens on the source chain. If we are sending USDC from Arbitrum, we pay native ETH to the Axelar gas service contract as part of source chain transaction. Hence, the user needs enough native gas on the source chain to pay for the entire transaction, and this is independent from the amount the user is swapping/bridging.You can find the
value
amount to be paid in the API or SDK route response atroute.estimate.transactionRequest.value
Axelar's model for cross-chain gas fee payment is currently a pay for what you use model. The user over pays on the source chain, then gets refunded the value that isn't used during the transaction.
From Cosmos via Axelar
Gas fees are paid as part of the token to be bridged. For example if swapping from ATOM to ETH, Squid will swap first to axlUSDC, bridge to Ethereum, then swap for ETH. The bridged token is axlUSDC, so the cross-chain gas payment to Axelar will be paid in axlUSDC.
From Cosmos via IBC
IBC currently is subsidised by relayers and has no implemented fee model, so cross-chain gas payments are free. This will change in the future and Squid's API/SDK will adapt to the new models.
Last updated