axelar-gmp-sdk-solidity

Solidity API

IBaseAmplifierGateway

Interface for the Base Axelar Amplifier Gateway that supports cross-chain messaging.

InvalidMessages

error InvalidMessages()

MessageApproved

event MessageApproved(bytes32 commandId, string sourceChain, string messageId, string sourceAddress, address contractAddress, bytes32 payloadHash)

Emitted when a cross-chain message is approved.

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.
messageId string The message id for the message.
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.

MessageExecuted

event MessageExecuted(bytes32 commandId)

Emitted when a message has been executed.

Logs the execution of an approved message. sourceChain and messageId aren’t included in the event due to backwards compatibility with validateContractCall.

Parameters

Name Type Description
commandId bytes32 The commandId for the message that was executed.

isMessageApproved

function isMessageApproved(string sourceChain, string messageId, string sourceAddress, address contractAddress, bytes32 payloadHash) external view returns (bool)

Checks if a message is approved.

Determines whether a given message, identified by the sourceChain and messageId, is approved.

Parameters

Name Type Description
sourceChain string The name of the source chain.
messageId string The unique identifier of the message.
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.

isMessageExecuted

function isMessageExecuted(string sourceChain, string messageId) external view returns (bool)

Checks if a message is executed.

Determines whether a given message, identified by the sourceChain and messageId is executed.

Parameters

Name Type Description
sourceChain string The name of the source chain.
messageId string The unique identifier of the message.

Return Values

Name Type Description
[0] bool True if the message is executed, false otherwise.

validateMessage

function validateMessage(string sourceChain, string messageId, string sourceAddress, bytes32 payloadHash) external returns (bool valid)

Validates if a message is approved. If message was in approved status, status is updated to executed to avoid replay.

Parameters

Name Type Description
sourceChain string The name of the source chain.
messageId string The unique identifier of the message.
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
valid bool True if the message is approved, false otherwise.

messageToCommandId

function messageToCommandId(string sourceChain, string messageId) external pure returns (bytes32)

Compute the commandId for a message.

Parameters

Name Type Description
sourceChain string The name of the source chain as registered on Axelar.
messageId string The unique message id for the message.

Return Values

Name Type Description
[0] bytes32 The commandId for the message.