BridgeERC7802
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)
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
| Name | Type | Description |
|---|---|---|
| to | bytes | The full ERC-7930 interoperable address of the recipient (chain ref + address). |
| amount | uint256 | The amount to lock/burn here and release/mint on the destination chain. |
Returns
| Name | Type | Description |
|---|---|---|
| sendId | bytes32 | The 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
| Name | Type | Description |
|---|---|---|
| receiveId | bytes32 | The gateway-assigned unique message id (already checked for replay by the facet). |
| _ | bytes | The ERC-7930 interoperable address of the source (includes the source chain). |
| payload | bytes | The message payload with the leading 4-byte handler tag stripped. |
token
The bridged ERC-7802 token.
function token() external view virtual returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| selectors | bytes |