Skip to content
Lattice

IERC7786MessageHandler

Git Source

Title: IERC7786MessageHandler

Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)

Handler invoked by the CrosschainLink facet for a validated inbound ERC-7786 message, routed by the leading 4-byte tag of the payload.

A handler is registered per tag via ICrosschainLink.setHandler. The facet authenticates the gateway + source and de-duplicates receiveId BEFORE calling processMessage, so handlers may assume the message is authentic and fresh. Handlers MUST revert on failure — a silent return marks the message processed and non-retryable (ERC-7786 at-most-once delivery). ONE IN-DIAMOND HANDLER PER LINK DIAMOND: every handler facet (BridgeERC20, BridgeERC7802, ERC20Crosschain, CrosschainTimelockHandler) exports this same selector 0x902d5027, so a second one reverts the cut. Register further tags to an external handler contract, or use a second diamond (issue #240).

Functions

processMessage

Process a validated, de-duplicated cross-chain message.

function processMessage(bytes32 receiveId, bytes calldata sender, bytes calldata payload) external;

Parameters

NameTypeDescription
receiveIdbytes32The gateway-assigned unique message id (already checked for replay by the facet).
senderbytesThe ERC-7930 interoperable address of the source (includes the source chain).
payloadbytesThe message payload with the leading 4-byte handler tag stripped.