BridgeERC7802Lib
Title: BridgeERC7802Lib
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 for ERC-7802 tokens (approval-free): burns on send, mints on receive. Acts as an IERC7786MessageHandler co-mounted with a CrosschainLink facet.
Functions
bridgeERC7802Storage
function bridgeERC7802Storage() internal pure returns (BridgeERC7802Storage storage $);Returns
| Name | Type | Description |
|---|---|---|
| $ | BridgeERC7802Storage |
__BridgeERC7802_init
Configures the bridged token and registers the IBridgeFungible ERC-165 interface.
function __BridgeERC7802_init(address token_) internal;Parameters
| Name | Type | Description |
|---|---|---|
| token_ | address |
token
The bridged ERC-7802 token.
function token() internal view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
crosschainTransfer
Burns amount from the caller (ERC-7802) and sends a bridge message to the destination.
function crosschainTransfer(bytes calldata to, uint256 amount) internal 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 burn here and mint on the destination. |
Returns
| Name | Type | Description |
|---|---|---|
| sendId | bytes32 |
processMessage
Mints tokens to the inbound recipient (ERC-7802). Callable only via the Diamond's own
authenticated receiveMessage dispatch (msg.sender == address(this)).
function processMessage(bytes32 receiveId, bytes calldata payload) internal;Parameters
| Name | Type | Description |
|---|---|---|
| receiveId | bytes32 | The de-duplicated message id (replay already checked by CrosschainLink). |
| payload | bytes | The tag-stripped inbound payload abi.encode(from, toAddrBytes, amount). |