IBridgeFungible
Title: IBridgeFungible
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Adapted for EIP-2535 from OpenZeppelin BridgeFungible v5.6.1 (https://github.com/OpenZeppelin/openzeppelin-contracts)
Shared events, errors, and ABI for the fungible cross-chain bridge facets — BridgeERC20
(custody) and BridgeERC7802 (mint/burn). Both register this interface for ERC-165 discovery;
they differ only in their ERC-7201 storage namespace and the lock/unlock token operation, so a
given Diamond mounts at most one of them (they share the crosschainTransfer/handler selectors).
Each bridge is an IERC7786MessageHandler registered under a shared fungible-bridge tag on a
co-mounted CrosschainLink facet; crosschainTransfer sends through that facet's link registry.
Functions
crosschainTransfer
Bridge amount of the configured token to a crosschain recipient.
function crosschainTransfer(bytes calldata to, uint256 amount) external 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. |
Events
CrosschainFungibleTransferSent
Emitted when a crosschain transfer is sent. to is a full ERC-7930 interoperable address.
event CrosschainFungibleTransferSent(bytes32 indexed sendId, address indexed from, bytes to, uint256 amount);Parameters
| Name | Type | Description |
|---|---|---|
| sendId | bytes32 | |
| from | address | |
| to | bytes | |
| amount | uint256 |
CrosschainFungibleTransferReceived
Emitted when an inbound crosschain transfer is credited to to on this chain.
event CrosschainFungibleTransferReceived(bytes32 indexed receiveId, bytes from, address indexed to, uint256 amount);Parameters
| Name | Type | Description |
|---|---|---|
| receiveId | bytes32 | |
| from | bytes | |
| to | address | |
| amount | uint256 |
Errors
BridgeZeroToken
The bridged token configured at init was the zero address.
error BridgeZeroToken();BridgeTransferFailed
An ERC-20 transfer/transferFrom failed: it reverted, returned non-true, or token has no code.
error BridgeTransferFailed(address token);Parameters
| Name | Type | Description |
|---|---|---|
| token | address |
BridgeInvalidRecipient
The inbound destination address was not a 20-byte EVM address.
error BridgeInvalidRecipient();BridgeUnauthorizedCaller
processMessage was called by something other than the Diamond's own authenticated
receiveMessage dispatch (i.e. msg.sender != address(this)).
error BridgeUnauthorizedCaller(address caller);Parameters
| Name | Type | Description |
|---|---|---|
| caller | address |
BridgeAmountMismatch
A locked-custody transferFrom credited an amount other than requested (fee-on-transfer
tokens are unsupported: locking less than is minted on the destination breaks 1:1).
error BridgeAmountMismatch(uint256 requested, uint256 received);Parameters
| Name | Type | Description |
|---|---|---|
| requested | uint256 | |
| received | uint256 |