This is an interface for the AxelarGasService contract which manages gas payments and refunds for cross-chain communication on the Axelar network.
This interface inherits IUpgradable
error InvalidAddress()
error NotCollector()
error InvalidAmounts()
error InvalidGasUpdates()
error InvalidParams()
error InsufficientGasPayment(uint256 required, uint256 provided)
event GasPaidForContractCall(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, address gasToken, uint256 gasFeeAmount, address refundAddress)
event GasPaidForContractCallWithToken(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress)
event NativeGasPaidForContractCall(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, uint256 gasFeeAmount, address refundAddress)
event NativeGasPaidForContractCallWithToken(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress)
event GasPaidForExpressCall(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, address gasToken, uint256 gasFeeAmount, address refundAddress)
event GasPaidForExpressCallWithToken(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress)
event NativeGasPaidForExpressCall(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, uint256 gasFeeAmount, address refundAddress)
event NativeGasPaidForExpressCallWithToken(address sourceAddress, string destinationChain, string destinationAddress, bytes32 payloadHash, string symbol, uint256 amount, uint256 gasFeeAmount, address refundAddress)
event GasAdded(bytes32 txHash, uint256 logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress)
event NativeGasAdded(bytes32 txHash, uint256 logIndex, uint256 gasFeeAmount, address refundAddress)
event ExpressGasAdded(bytes32 txHash, uint256 logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress)
event NativeExpressGasAdded(bytes32 txHash, uint256 logIndex, uint256 gasFeeAmount, address refundAddress)
event Refunded(bytes32 txHash, uint256 logIndex, address payable receiver, address token, uint256 amount)
function payGas(address sender, string destinationChain, string destinationAddress, bytes payload, uint256 executionGasLimit, bool estimateOnChain, address refundAddress, bytes params) external payable
Pay for gas for any type of contract execution on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract. If estimateOnChain is true, the function will estimate the gas cost and revert if the payment is insufficient.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call |
executionGasLimit | uint256 | The gas limit for the contract call |
estimateOnChain | bool | Flag to enable on-chain gas estimation |
refundAddress | address | The address where refunds, if any, should be sent |
params | bytes | Additional parameters for gas payment. This can be left empty for normal contract call payments. |
function payGasForContractCall(address sender, string destinationChain, string destinationAddress, bytes payload, address gasToken, uint256 gasFeeAmount, address refundAddress) external
Pay for gas using ERC20 tokens for a contract call on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call |
gasToken | address | The address of the ERC20 token used to pay for gas |
gasFeeAmount | uint256 | The amount of tokens to pay for gas |
refundAddress | address | The address where refunds, if any, should be sent |
function payGasForContractCallWithToken(address sender, string destinationChain, string destinationAddress, bytes payload, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress) external
Pay for gas using ERC20 tokens for a contract call with tokens on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call with tokens will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call with tokens |
symbol | string | The symbol of the token to be sent with the call |
amount | uint256 | The amount of tokens to be sent with the call |
gasToken | address | The address of the ERC20 token used to pay for gas |
gasFeeAmount | uint256 | The amount of tokens to pay for gas |
refundAddress | address | The address where refunds, if any, should be sent |
function payNativeGasForContractCall(address sender, string destinationChain, string destinationAddress, bytes payload, address refundAddress) external payable
Pay for gas using native currency for a contract call on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call |
refundAddress | address | The address where refunds, if any, should be sent |
function payNativeGasForContractCallWithToken(address sender, string destinationChain, string destinationAddress, bytes payload, string symbol, uint256 amount, address refundAddress) external payable
Pay for gas using native currency for a contract call with tokens on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call with tokens will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call with tokens |
symbol | string | The symbol of the token to be sent with the call |
amount | uint256 | The amount of tokens to be sent with the call |
refundAddress | address | The address where refunds, if any, should be sent |
function payGasForExpressCall(address sender, string destinationChain, string destinationAddress, bytes payload, address gasToken, uint256 gasFeeAmount, address refundAddress) external
Pay for gas using ERC20 tokens for an express contract call on a destination chain.
This function is called on the source chain before calling the gateway to express execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call |
gasToken | address | The address of the ERC20 token used to pay for gas |
gasFeeAmount | uint256 | The amount of tokens to pay for gas |
refundAddress | address | The address where refunds, if any, should be sent |
function payGasForExpressCallWithToken(address sender, string destinationChain, string destinationAddress, bytes payload, string symbol, uint256 amount, address gasToken, uint256 gasFeeAmount, address refundAddress) external
Pay for gas using ERC20 tokens for an express contract call with tokens on a destination chain.
This function is called on the source chain before calling the gateway to express execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call with tokens will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call with tokens |
symbol | string | The symbol of the token to be sent with the call |
amount | uint256 | The amount of tokens to be sent with the call |
gasToken | address | The address of the ERC20 token used to pay for gas |
gasFeeAmount | uint256 | The amount of tokens to pay for gas |
refundAddress | address | The address where refunds, if any, should be sent |
function payNativeGasForExpressCall(address sender, string destinationChain, string destinationAddress, bytes payload, address refundAddress) external payable
Pay for gas using native currency for an express contract call on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call |
refundAddress | address | The address where refunds, if any, should be sent |
function payNativeGasForExpressCallWithToken(address sender, string destinationChain, string destinationAddress, bytes payload, string symbol, uint256 amount, address refundAddress) external payable
Pay for gas using native currency for an express contract call with tokens on a destination chain.
This function is called on the source chain before calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
sender | address | The address making the payment |
destinationChain | string | The target chain where the contract call with tokens will be made |
destinationAddress | string | The target address on the destination chain |
payload | bytes | Data payload for the contract call with tokens |
symbol | string | The symbol of the token to be sent with the call |
amount | uint256 | The amount of tokens to be sent with the call |
refundAddress | address | The address where refunds, if any, should be sent |
function addGas(bytes32 txHash, uint256 logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress) external
Add additional gas payment using ERC20 tokens after initiating a cross-chain call.
This function can be called on the source chain after calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
txHash | bytes32 | The transaction hash of the cross-chain call |
logIndex | uint256 | The log index for the cross-chain call |
gasToken | address | The ERC20 token address used to add gas |
gasFeeAmount | uint256 | The amount of tokens to add as gas |
refundAddress | address | The address where refunds, if any, should be sent |
function addNativeGas(bytes32 txHash, uint256 logIndex, address refundAddress) external payable
Add additional gas payment using native currency after initiating a cross-chain call.
This function can be called on the source chain after calling the gateway to execute a remote contract.
Name | Type | Description |
---|---|---|
txHash | bytes32 | The transaction hash of the cross-chain call |
logIndex | uint256 | The log index for the cross-chain call |
refundAddress | address | The address where refunds, if any, should be sent |
function addExpressGas(bytes32 txHash, uint256 logIndex, address gasToken, uint256 gasFeeAmount, address refundAddress) external
Add additional gas payment using ERC20 tokens after initiating an express cross-chain call.
This function can be called on the source chain after calling the gateway to express execute a remote contract.
Name | Type | Description |
---|---|---|
txHash | bytes32 | The transaction hash of the cross-chain call |
logIndex | uint256 | The log index for the cross-chain call |
gasToken | address | The ERC20 token address used to add gas |
gasFeeAmount | uint256 | The amount of tokens to add as gas |
refundAddress | address | The address where refunds, if any, should be sent |
function addNativeExpressGas(bytes32 txHash, uint256 logIndex, address refundAddress) external payable
Add additional gas payment using native currency after initiating an express cross-chain call.
This function can be called on the source chain after calling the gateway to express execute a remote contract.
Name | Type | Description |
---|---|---|
txHash | bytes32 | The transaction hash of the cross-chain call |
logIndex | uint256 | The log index for the cross-chain call |
refundAddress | address | The address where refunds, if any, should be sent |
function updateGasInfo(string[] chains, struct GasInfo[] gasUpdates) external
Updates the gas price for a specific chain.
This function is called by the gas oracle to update the gas prices for a specific chains.
Name | Type | Description |
---|---|---|
chains | string[] | Array of chain names |
gasUpdates | struct GasInfo[] | Array of gas updates |
function collectFees(address payable receiver, address[] tokens, uint256[] amounts) external
Allows the gasCollector to collect accumulated fees from the contract.
Use address(0) as the token address for native currency.
Name | Type | Description |
---|---|---|
receiver | address payable | The address to receive the collected fees |
tokens | address[] | Array of token addresses to be collected |
amounts | uint256[] | Array of amounts to be collected for each respective token address |
function refund(bytes32 txHash, uint256 logIndex, address payable receiver, address token, uint256 amount) external
Refunds gas payment to the receiver in relation to a specific cross-chain transaction.
Only callable by the gasCollector. Use address(0) as the token address to refund native currency.
Name | Type | Description |
---|---|---|
txHash | bytes32 | The transaction hash of the cross-chain call |
logIndex | uint256 | The log index for the cross-chain call |
receiver | address payable | The address to receive the refund |
token | address | The token address to be refunded |
amount | uint256 | The amount to refund |
function gasCollector() external returns (address)
Returns the address of the designated gas collector.
Name | Type | Description |
---|---|---|
[0] | address | address of the gas collector |