Skip to content
Lattice

AxelarGatewayAdapter

Git Source

Inherits: IERC7786GatewaySource, IAxelarGatewayAdapter

Title: AxelarGatewayAdapter

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Adapted for EIP-2535 from OpenZeppelin community-contracts AxelarGatewayAdapter (https://github.com/OpenZeppelin/openzeppelin-community-contracts, commit f7e5f08)

(https://github.com/OpenZeppelin/openzeppelin-community-contracts/blob/f7e5f08e8fd42023084eb41f4a992d7be897b915/contracts/crosschain/axelar/AxelarGatewayAdapter.sol)

Dual-mode ERC-7786 gateway facet over Axelar GMP: sendMessage (source) emits an Axelar callContract; execute (destination, called by the Axelar relayer) validates the approved call + the trusted source gateway, then delivers to the ERC-7786 recipient. EVM chains only.

Stateless delegator — logic/storage live in AxelarGatewayAdapterLib. OZ's immutable Axelar gateway + Ownable are converted to ERC-7201 storage + AccessControl for the Diamond.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin

Functions

sendMessage

If any of the attributes is not supported, this function SHOULD revert with an

UnsupportedAttribute error. Other errors SHOULD revert with errors not specified in ERC-7786.

Endpoint for creating a new message. If the message requires further (gateway specific) processing before it can be sent to the destination chain, then a non-zero sendId must be returned. Otherwise, the message MUST be sent and this function must return 0.

function sendMessage(bytes calldata recipient, bytes calldata payload, bytes[] calldata attributes)
        external
        payable
        virtual
        returns (bytes32);

Parameters

NameTypeDescription
recipientbytes
payloadbytes
attributesbytes[]

Returns

NameTypeDescription
<none>bytes32

supportsAttribute

Getter to check whether an attribute is supported or not.

function supportsAttribute(bytes4 selector) external pure virtual returns (bool);

Parameters

NameTypeDescription
selectorbytes4

Returns

NameTypeDescription
<none>bool

execute

Axelar inbound entrypoint. Validates the approved call + the source gateway, then delivers to the ERC-7786 recipient. Called by the Axelar relayer.

function execute(
        bytes32 commandId,
        string calldata sourceChain,
        string calldata sourceAddress,
        bytes calldata payload
    ) external virtual;

Parameters

NameTypeDescription
commandIdbytes32
sourceChainstring
sourceAddressstring
payloadbytes

gateway

The configured Axelar gateway contract.

function gateway() external view virtual returns (address);

Returns

NameTypeDescription
<none>address

getAxelarChain

Returns the Axelar chain name for a "chain-only" ERC-7930 interoperable address.

function getAxelarChain(bytes calldata chain) external view virtual returns (string memory);

Parameters

NameTypeDescription
chainbytes

Returns

NameTypeDescription
<none>string

getErc7930Chain

Returns the "chain-only" ERC-7930 interoperable address for an Axelar chain name.

function getErc7930Chain(string calldata axelar) external view virtual returns (bytes memory);

Parameters

NameTypeDescription
axelarstring

Returns

NameTypeDescription
<none>bytes

getRemoteGateway

Returns the trusted remote gateway address-bytes registered for a "chain-only" address.

function getRemoteGateway(bytes calldata chain) external view virtual returns (bytes memory);

Parameters

NameTypeDescription
chainbytes

Returns

NameTypeDescription
<none>bytes

registerChainEquivalence

Registers a CAIP-2 ↔ Axelar chain-name equivalence (both directions). Admin only.

function registerChainEquivalence(bytes calldata chain, string calldata axelar) external virtual;

Parameters

NameTypeDescription
chainbytesA "chain-only" ERC-7930 interoperable address (empty address part).
axelarstringThe Axelar chain name (e.g. "ethereum", "optimism").

registerRemoteGateway

Registers a trusted remote gateway adapter. Admin only.

function registerRemoteGateway(bytes calldata remote) external virtual;

Parameters

NameTypeDescription
remotebytesThe full ERC-7930 interoperable address of the remote adapter (chain + address).

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect AxelarGatewayAdapter methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: execute(bytes32,string,string,bytes) 0x49160658 gateway() 0x116191b6 getAxelarChain(bytes) 0x207b5e03 getErc7930Chain(string) 0x5a4cb606 getRemoteGateway(bytes) 0xef382213 registerChainEquivalence(bytes,string) 0xbaf454d2 registerRemoteGateway(bytes) 0xcb6782b2 sendMessage(bytes,bytes,bytes[]) 0xcdfe7f5c supportsAttribute(bytes4) 0xdc680a0f

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes