Increase Gas

On occasion the prepaid gas to the Gas Receiver contract could be insufficient, such as when the destination chain is congested with transfers. When this happens, the application can resubmit a new amount of gas to pay for the transaction through Axelarscan, the AxelarJS SDK, or via a direct invocation of the AxelarGasService contract.

Add gas via the AxelarGasService contract

To add gas to an existing GMP transaction through the AxelarGasService contract:

addNativeGas()

Call addNativeGas() to add additional gas payment using native currency after initiating a cross-chan call. This function can be called on the transaction’s source chain after calling the gateway to execute a remote contract.

In Solidity, addNativeGas() takes the following parameters:

  • txHash — The transaction hash of the cross-chain call
  • logIndex — The log index for the cross-chain call
  • refundAddress — The address where refunds, if any, should be sent
function addNativeGas(
bytes32 txHash,
uint256 logIndex,
address refundAddress
) external payable override;

In JavaScript or TypeScript, the SDK abstracts a method that can be invoked directly in a web application.

addGas()

Call addGas() to add additional gas payment after initiating a cross-chain call. This function can be called on the transaction’s source chain after calling the gateway to execute a remote contract.

In Solidity, addGas() takes the following parameters:

  • txHash — The transaction hash of the cross-chain call
  • logIndex — The log index for the cross-chain call
  • gasToken — The ERC-20 token address used to add gas
  • gasFeeAmount — The amount of tokens to add as gas
  • refundAddress — The address where refunds, if any, should be sent
function addGas(
bytes32 txHash,
uint256 logIndex,
address gasToken,
uint256 gasFeeAmount,
address refundAddress
) external override;

In JavaScript or TypeScript, the SDK abstracts a method that can be invoked directly in a web application. It is similar to a native gas payment, except with Axelar-supported ERC-20 tokens instead of native tokens. Make sure that the ERC-20 tokens you use are supported by Axelar.

Edit on GitHub