Skip to content
Lattice

Lattice

Git Source

Inherits: Diamond, Initializable

Title: Lattice

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from diamond-lib (https://github.com/dadadave80/diamond-lib)

Lattice's concrete diamond: the initializer-guarded preset over diamond-lib's abstract fallback-only Diamond base (upstream v0.3.0 made the base abstract and dropped initialize/receive; this contract restores the guarded initialize, Lattice-owned). Bare-ETH acceptance is deliberately NOT restored here — cut the Receive facet under the zero selector instead (every Lattice recipe does); a diamond without it rejects plain sends. Must be created and initialized in ONE transaction — LatticeFactory does this, and every script recipe deploys through it. initialize is first-caller-wins, so a proxy initialized in a later transaction can be taken over in between. All later upgrades go through whichever cut facet the initial cut installed.

initialize is guarded by the initializer modifier from the Initializable mixin over the vendored InitializableLib — a nested initializer invoked inside a constructor finalizes exactly once. Kept virtual — account presets override it (e.g. Account7702Diamond disables it in favor of signature-gated onboarding).

Functions

initialize

Apply the initial facet cut and run the init delegatecall — callable ONCE.

function initialize(FacetCut[] calldata _facetCuts, address _init, bytes calldata _calldata)
        public
        payable
        virtual
        initializer;

Parameters

NameTypeDescription
_facetCutsFacetCut[]The initial facet cuts to install.
_initaddressThe initializer contract delegatecalled after the cut (or address(0)).
_calldatabytesThe delegatecall payload for _init.