Developers
/General Message Passing
/Gas services
/Pay Gas
Pay Gas
For both callContract
and callContractWithToken
, the Gas Receiver can be paid in the native token of the source chain or any token supported by Axelar network.
For callContract
payGasForContractcall
:
function payGasForContractCall(
address sender,
string calldata destinationChain,
string calldata destinationAddress,
bytes calldata payload,
address gasToken,
uint256 gasFeeAmount,
address refundAddress
) external;
*** Gas Receiver can only be paid in tokens Axelar supports. See the list of supported assets in Resources [Mainnet | Testnet | Testnet-2].
payGasForContractCallWithToken
// This is called on the source chain before calling the gateway to execute a remote contract.
function payNativeGasForContractCall(
address sender,
string calldata destinationChain,
string calldata destinationAddress,
bytes calldata payload,
address refundAddress
) external payable;
For callContractWithToken
:
payGasForContractCallWithToken
// This is called on the source chain before calling the gateway to execute a remote contract.
function payGasForContractCallWithToken(
address sender,
string calldata destinationChain,
string calldata destinationAddress,
bytes calldata payload,
string calldata symbol,
uint256 amount,
address gasToken,
uint256 gasFeeAmount,
address refundAddress
) external;
*** Gas Receiver can only be paid in tokens Axelar supports. See the list of supported assets in Resources [Mainnet | Testnet | Testnet-2].
payNativeGasForContractCallWithToken
// This is called on the source chain before calling the gateway to execute a remote contract.
function payNativeGasForContractCallWithToken(
address sender,
string calldata destinationChain,
string calldata destinationAddress,
bytes calldata payload,
string calldata symbol,
uint256 amount,
address refundAddress
) external payable;
The function names are prety self-explanatory. The following is true for the arguments:
- For all functions
sender
needs to match the address that callscallContract
orcallContractWithToken
on theAxelarGateway
. If theAxelarGasReceiver
is called by the same contract that will call the Gateway then simply specifyaddress(this)
assender
.
- For
payGasForContractCall
andpayNativeGasForContractCall
:destinationChain
destinationAddress
payload
need to match the arguments of acontractCall
on theAxelarGateway
.
- For
payGasForContractCallWtihToken
andpayNativeGasForContractCallWithToken
:destinationChain
destinationAddress
payload
symbol
amount
need to match the arguments of acontractCallWithToken
on theAxelarGateway
.
- For
payGasForContractCall
andpayGasForContractCallWtihToken
:gasToken
is the address of the token that gas will be paid in. Ensure this token is supported by the network, using the Axelar API.gasFeeAmount
is the amount ofgasToken
to transfer from the sender. The sender needs to have approved theAxelarGasReceiver
with the appropriate amount togasToken
first.
- For
payNativeGasForContractCall
andpayNativeGasForContractCallWithToken
, the amount of funds received is specified bymsg.value
. - For all functions,
refundAddress
is the address that will eventually be able to receive excess amount paid for gas.