Skip to content
Lattice

ERC7802Lib

Git Source

Title: ERC7802Lib

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Implements ERC-7802 (https://eips.ethereum.org/EIPS/eip-7802) over ERC20Lib.

ERC-7802 crosschain mint/burn extension for the Lattice ERC-20. Adds no own storage (reuses the ERC20 balances + the shared AccessControl roles); gives a BridgeERC7802 a native token to bridge.

Mints and burns call ERC20Lib directly: an ERC-20 movement-replacing extension (ERC20Pausable, ERC20Votes) does not see them, so the two are mutually exclusive (D25, #234).

Functions

__ERC7802_init

Registers the IERC7802 ERC-165 interface. Must be called inside a pre/postInitializer block.

function __ERC7802_init() internal;

registerInterface

Writes true to the ERC-165 map slot for IERC7802 (canonical id 0x33331994).

function registerInterface() internal;

crosschainMint

Mint amount to to on this (destination) chain. Caller must hold CROSSCHAIN_BRIDGE_ROLE.

function crosschainMint(address to, uint256 amount) internal;

Parameters

NameTypeDescription
toaddress
amountuint256

crosschainBurn

Burn amount from from on this (source) chain. Caller must hold CROSSCHAIN_BRIDGE_ROLE.

Privileged burn — no allowance is consumed (the bridge is trusted, per ERC-7802).

function crosschainBurn(address from, uint256 amount) internal;

Parameters

NameTypeDescription
fromaddress
amountuint256