Skip to content
Lattice

AccountDiamond

Git Source

Inherits: Lattice

Title: AccountDiamond

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ERC-7579 reference implementation (https://github.com/erc7579/erc7579-implementation)

An EIP-2535 Diamond whose fallback adds ERC-7579 FALLBACK (type 3) handler dispatch LAYERED UNDER the facet map (#58 follow-on): a selector the diamond owns is dispatched to its facet exactly as before, and only an otherwise-unhandled selector falls through to an installed fallback handler. diamondCut thus remains the sole selector authority; 7579 fallbacks extend the account's reach without shadowing facets (install reverts FallbackShadowsFacet for an owned selector). A selector neither a facet nor a handler claims reverts NoFallbackHandler (vs. the base Diamond's silent empty return).

Forwards to the handler via CALL — with the original caller appended ERC-2771-style — or DELEGATECALL, per the handler's registered call type. This is the proxy the AccountFactory deploys and that Account7702Diamond extends, so factory- and 7702-onboarded accounts both get fallback support.

Functions

fallback

Fallback function that delegates calls to the appropriate facet based on function selector

Reads the facet address from diamond storage and performs a delegatecall; reverts if selector is not found

fallback() external payable virtual override;