Skip to content
Lattice

IERC7786GatewaySource

Git Source

Title: IERC7786 — ERC-7786 Cross-Chain Messaging Gateway interfaces

Author: Vendored verbatim from OpenZeppelin Contracts v5.6.1

(https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/interfaces/draft-IERC7786.sol). Upstream license: MIT. Vendored subset — do not add an openzeppelin-contracts dependency.

Source (IERC7786GatewaySource) and recipient (IERC7786Recipient) interfaces for the ERC-7786 cross-chain messaging standard. See ERC-7786 for details.

Pinned to a commit, not a tag: these track the unfinalized ERC-7786 / ERC-7930 drafts and may change between releases. receiveMessage.selector is the 0x2432ef26 magic value a recipient must return.

Interface for ERC-7786 source gateways.

Functions

supportsAttribute

Getter to check whether an attribute is supported or not.

function supportsAttribute(bytes4 selector) external view returns (bool);

Parameters

NameTypeDescription
selectorbytes4

Returns

NameTypeDescription
<none>bool

sendMessage

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.

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.

function sendMessage(
        bytes calldata recipient, // Binary Interoperable Address
        bytes calldata payload,
        bytes[] calldata attributes
    )
        external
        payable
        returns (bytes32 sendId);

Parameters

NameTypeDescription
recipientbytes
payloadbytes
attributesbytes[]

Returns

NameTypeDescription
sendIdbytes32

Events

MessageSent

Event emitted when a message is created. If sendId is zero, no further processing is necessary. If sendId is not zero, then further (gateway specific, and non-standardized) action is required.

event MessageSent(
        bytes32 indexed sendId,
        bytes sender, // Binary Interoperable Address
        bytes recipient, // Binary Interoperable Address
        bytes payload,
        uint256 value,
        bytes[] attributes
    );

Parameters

NameTypeDescription
sendIdbytes32
senderbytes
recipientbytes
payloadbytes
valueuint256
attributesbytes[]

Errors

UnsupportedAttribute

This error is thrown when a message creation fails because of an unsupported attribute being specified.

error UnsupportedAttribute(bytes4 selector);

Parameters

NameTypeDescription
selectorbytes4