axelar-gmp-sdk-solidity

Solidity API

IAxelarGatewayWithToken

Interface for the Axelar Gateway that supports cross-chain token transfers coupled with general message passing. It extends IAxelarGateway to include token-related functionality.

TokenSent

event TokenSent(address sender, string destinationChain, string destinationAddress, string symbol, uint256 amount)

Emitted when a token is sent to another chain.

Logs the attempt to send tokens to a recipient on another chain.

Parameters

Name Type Description
sender address The address of the sender who initiated the token transfer.
destinationChain string The name of the destination chain.
destinationAddress string The address of the recipient on the destination chain.
symbol string The symbol of the token being transferred.
amount uint256 The amount of the tokens being transferred.

ContractCallWithToken

event ContractCallWithToken(address sender, string destinationChain, string destinationContractAddress, bytes32 payloadHash, bytes payload, string symbol, uint256 amount)

Emitted when a contract call is made through the gateway along with a token transfer.

Logs the attempt to call a contract on another chain with an associated token transfer.

Parameters

Name Type Description
sender address The address of the sender who initiated the contract call with token.
destinationChain string The name of the destination chain.
destinationContractAddress string The address of the contract on the destination chain.
payloadHash bytes32 The keccak256 hash of the sent payload data.
payload bytes The payload data used for the contract call.
symbol string The symbol of the token being transferred.
amount uint256 The amount of the tokens being transferred.

ContractCallApprovedWithMint

event ContractCallApprovedWithMint(bytes32 commandId, string sourceChain, string sourceAddress, address contractAddress, bytes32 payloadHash, string symbol, uint256 amount, bytes32 sourceTxHash, uint256 sourceEventIndex)

Emitted when a contract call with a token minting is approved.

Logs the approval of a contract call that originated from another chain and involves a token minting process.

Parameters

Name Type Description
commandId bytes32 The identifier of the command to execute.
sourceChain string The name of the source chain from whence the command came.
sourceAddress string The address of the sender on the source chain.
contractAddress address The address of the contract where the call will be executed.
payloadHash bytes32 The keccak256 hash of the approved payload data.
symbol string The symbol of the token being minted.
amount uint256 The amount of the tokens being minted.
sourceTxHash bytes32 The hash of the source transaction on the source chain.
sourceEventIndex uint256 The index of the event in the source transaction logs.

sendToken

function sendToken(string destinationChain, string destinationAddress, string symbol, uint256 amount) external

Sends tokens to another chain.

Initiates a cross-chain token transfer through the gateway to the specified destination chain and recipient.

Parameters

Name Type Description
destinationChain string The name of the destination chain.
destinationAddress string The address of the recipient on the destination chain.
symbol string The symbol of the token being transferred.
amount uint256 The amount of the tokens being transferred.

callContractWithToken

function callContractWithToken(string destinationChain, string contractAddress, bytes payload, string symbol, uint256 amount) external

Makes a contract call on another chain with an associated token transfer.

Initiates a cross-chain contract call through the gateway that includes a token transfer to the specified contract on the destination chain.

Parameters

Name Type Description
destinationChain string The name of the destination chain.
contractAddress string The address of the contract on the destination chain.
payload bytes The payload data to be used in the contract call.
symbol string The symbol of the token being transferred.
amount uint256 The amount of the tokens being transferred.

isContractCallAndMintApproved

function isContractCallAndMintApproved(bytes32 commandId, string sourceChain, string sourceAddress, address contractAddress, bytes32 payloadHash, string symbol, uint256 amount) external view returns (bool)

Checks if a contract call with token minting is approved.

Determines whether a given contract call, identified by the commandId and payloadHash, involving token minting is approved.

Parameters

Name Type Description
commandId bytes32 The identifier of the command to check.
sourceChain string The name of the source chain.
sourceAddress string The address of the sender on the source chain.
contractAddress address The address of the contract where the call will be executed.
payloadHash bytes32 The keccak256 hash of the payload data.
symbol string The symbol of the token associated with the minting.
amount uint256 The amount of the tokens to be minted.

Return Values

Name Type Description
[0] bool True if the contract call with token minting is approved, false otherwise.

validateContractCallAndMint

function validateContractCallAndMint(bytes32 commandId, string sourceChain, string sourceAddress, bytes32 payloadHash, string symbol, uint256 amount) external returns (bool)

Validates and approves a contract call with token minting.

Validates the given contract call information and marks it as approved if valid. It also involves the minting of tokens.

Parameters

Name Type Description
commandId bytes32 The identifier of the command to validate.
sourceChain string The name of the source chain.
sourceAddress string The address of the sender on the source chain.
payloadHash bytes32 The keccak256 hash of the payload data.
symbol string The symbol of the token associated with the minting.
amount uint256 The amount of the tokens to be minted.

Return Values

Name Type Description
[0] bool True if the contract call with token minting is validated and approved, false otherwise.

tokenAddresses

function tokenAddresses(string symbol) external view returns (address)

Retrieves the address of a token given its symbol.

Gets the contract address of the token registered with the given symbol.

Parameters

Name Type Description
symbol string The symbol of the token to retrieve the address for.

Return Values

Name Type Description
[0] address The contract address of the token corresponding to the given symbol.