Skip to content
Lattice

BridgeERC7802

Git Source

Inherits: IBridgeFungible, IERC7786MessageHandler

Title: BridgeERC7802

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Adapted for EIP-2535 from OpenZeppelin BridgeERC7802 v5.6.1 (https://github.com/OpenZeppelin/openzeppelin-contracts)

(https://github.com/OpenZeppelin/openzeppelin-contracts/blob/5fd1781b1454fd1ef8e722282f86f9293cacf256/contracts/crosschain/bridges/BridgeERC7802.sol)

Mint/burn bridge facet for ERC-7802 tokens: burns on crosschainTransfer, mints on an inbound message. Registered as a handler on a co-mounted CrosschainLink facet.

Stateless delegator — logic/storage live in BridgeERC7802Lib. processMessage is callable only via the Diamond's own authenticated receiveMessage dispatch (msg.sender == address(this)).

Notes:

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

Functions

crosschainTransfer

Bridge amount of the configured token to a crosschain recipient.

function crosschainTransfer(bytes calldata to, uint256 amount) external virtual override returns (bytes32 sendId);

Parameters

NameTypeDescription
tobytesThe full ERC-7930 interoperable address of the recipient (chain ref + address).
amountuint256The amount to lock/burn here and release/mint on the destination chain.

Returns

NameTypeDescription
sendIdbytes32The ERC-7786 gateway-assigned send id.

processMessage

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

function processMessage(
        bytes32 receiveId,
        bytes calldata,
        /*sender*/
        bytes calldata payload
    )
        external
        virtual
        override;

Parameters

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

token

The bridged ERC-7802 token.

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

Returns

NameTypeDescription
<none>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 BridgeERC7802 methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: crosschainTransfer(bytes,uint256) 0x28dcc8d8 processMessage(bytes32,bytes,bytes) 0x902d5027 token() 0xfc0c546a

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

Returns

NameTypeDescription
selectorsbytes