axelar-gmp-sdk-solidity

Solidity API

AxelarAmplifierGateway

AxelarAmplifierGateway is the contract that allows apps on EVM chains to send and receive cross-chain messages via the Axelar Amplifier protocol. It handles cross-chain message passing (implemented by BaseAmplifierGateway), and signer rotation (implemented by BaseWeightedMultisig).

AXELAR_AMPLIFIER_GATEWAY_SLOT

bytes32 AXELAR_AMPLIFIER_GATEWAY_SLOT

This slot contains the storage for this contract in an upgrade-compatible manner keccak256(‘AxelarAmplifierGateway.Slot’) - 1;

AxelarAmplifierGatewayStorage

struct AxelarAmplifierGatewayStorage {
  address operator;
}

constructor

constructor(uint256 previousSignersRetention_, bytes32 domainSeparator_, uint256 minimumRotationDelay_) public

Initializes the contract.

Parameters

Name Type Description
previousSignersRetention_ uint256 The number of previous signers to retain
domainSeparator_ bytes32 The domain separator for the signer proof
minimumRotationDelay_ uint256 The minimum delay required between rotations

onlyOperatorOrOwner

modifier onlyOperatorOrOwner()

_setup

function _setup(bytes data) internal

Internal function to set up the contract with initial data. This function is also called during upgrades.

The setup data consists of an optional new operator, and a list of signers to rotate too. This function should be implemented in derived contracts.

Parameters

Name Type Description
data bytes Initialization data for the contract

contractId

function contractId() external pure returns (bytes32)

Returns the contract ID. It can be used as a check during upgrades.

Meant to be overridden in derived contracts.

Return Values

Name Type Description
[0] bytes32 bytes32 The contract ID

approveMessages

function approveMessages(struct Message[] messages, struct Proof proof) external

Approves an array of messages, signed by the Axelar signers.

Parameters

Name Type Description
messages struct Message[] The array of messages to verify.
proof struct Proof The proof signed by the Axelar signers for this command.

rotateSigners

function rotateSigners(struct WeightedSigners newSigners, struct Proof proof) external

Rotate the weighted signers, signed off by the latest Axelar signers.

The minimum rotation delay is enforced by default, unless the caller is the gateway operator. The gateway operator allows recovery in case of an incorrect/malicious rotation, while still requiring a valid proof from a recent signer set. Rotation to duplicate signers is rejected.

Parameters

Name Type Description
newSigners struct WeightedSigners The data for the new signers.
proof struct Proof The proof signed by the Axelar verifiers for this command.

validateProof

function validateProof(bytes32 dataHash, struct Proof proof) external view returns (bool isLatestSigners)

This function takes dataHash and proof and reverts if proof is invalid

Parameters

Name Type Description
dataHash bytes32 The hash of the data being signed
proof struct Proof The proof from Axelar signers

Return Values

Name Type Description
isLatestSigners bool True if provided signers are the current ones

operator

function operator() external view returns (address)

Returns the address of the gateway operator.

Return Values

Name Type Description
[0] address The address of the operator.

transferOperatorship

function transferOperatorship(address newOperator) external

Transfer the operatorship to a new address.

The owner or current operator can set the operator to address 0.

Parameters

Name Type Description
newOperator address The address of the new operator.

_transferOperatorship

function _transferOperatorship(address newOperator) internal