axelar-gmp-sdk-solidity

Solidity API

IAxelarGateway

Interface for the Axelar Gateway that supports general message passing and contract call execution.

ContractCall

event ContractCall(address sender, string destinationChain, string destinationContractAddress, bytes32 payloadHash, bytes payload)

Emitted when a contract call is made through the gateway.

Logs the attempt to call a contract on another chain.

Parameters

Name Type Description
sender address The address of the sender who initiated the contract call.
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.

callContract

function callContract(string destinationChain, string contractAddress, bytes payload) external

Sends a contract call to another chain.

Initiates a cross-chain contract call through the gateway to the specified destination chain and contract.

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.

isContractCallApproved

function isContractCallApproved(bytes32 commandId, string sourceChain, string sourceAddress, address contractAddress, bytes32 payloadHash) external view returns (bool)

Checks if a contract call is approved.

Determines whether a given contract call, identified by the commandId and payloadHash, 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.

Return Values

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

validateContractCall

function validateContractCall(bytes32 commandId, string sourceChain, string sourceAddress, bytes32 payloadHash) external returns (bool)

Validates and approves a contract call.

Validates the given contract call information and marks it as approved if valid.

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.

Return Values

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

isCommandExecuted

function isCommandExecuted(bytes32 commandId) external view returns (bool)

Checks if a command has been executed.

Determines whether a command, identified by the commandId, has been executed.

Parameters

Name Type Description
commandId bytes32 The identifier of the command to check.

Return Values

Name Type Description
[0] bool True if the command has been executed, false otherwise.