AccessControlDiamondCut
Inherits: IAccessControlDiamondCut
Title: AccessControlDiamondCut
Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)
Stateless Diamond facet exposing the EIP-2535 diamondCut function at the canonical
selector 0x1f931c1c, gated behind EmergencyStop + DEFAULT_ADMIN_ROLE. Drop-in
replacement for diamond-lib's owner-gated DiamondCutFacet in an ADMIN-OWNED deployment:
the module admin every Lattice recipe already seeds is also the upgrade authority — one
authority model, no parallel Ownable owner to initialize or track.
All logic lives in AccessControlDiamondCutLib. This contract is stateless and forwards its
single call to the library. Never cut this facet AND another diamondCut-carrying facet
(GovernedDiamondCut, SafeDiamondCut, diamond-lib's DiamondCutFacet) into the same
diamond — they all own selector 0x1f931c1c. For governance-held diamonds (upgrade registry,
frozen selectors, guardian escape hatch) cut GovernedDiamondCut instead.
Notes:
- lattice-version: 0.1.0
- lattice-source: Lattice original
Functions
diamondCut
Add/replace/remove any number of functions and optionally execute a function with
delegatecall — but only when not emergency-stopped and the caller holds
DEFAULT_ADMIN_ROLE. The host recipe's init seeds that role (usually to its admin
parameter), so the module admin is the upgrade authority — no separate Ownable owner.
function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata)
external
payable
virtual;Parameters
| Name | Type | Description |
|---|---|---|
| _diamondCut | FacetCut[] | The facet addresses, cut actions, and function selectors. |
| _init | address | The address of the contract or facet to delegatecall after the cut (0 to skip). |
| _calldata | bytes | The calldata passed to _init. |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect AccessControlDiamondCut methodIdentifiers (alphabetical by signature); kept in
exact parity by ExportSelectorsParityTest. Chunks:
diamondCut((address,uint8,bytes4[])[],address,bytes) 0x1f931c1c
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |