Skip to content
Lattice

IAccessControlDiamondCut

Git Source

Title: IAccessControlDiamondCut

Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)

External interface for the admin-gated diamond-cut facet. Exposes the EIP-2535 diamondCut function at the canonical selector 0x1f931c1c so it transparently replaces diamond-lib's owner-gated DiamondCutFacet in an AccessControl deployment — ONE authority model: the module admin (DEFAULT_ADMIN_ROLE) is also the upgrade authority, no parallel Ownable owner.

The single function makes type(IAccessControlDiamondCut).interfaceId == 0x1f931c1c, equal to IDiamondCut. ERC-165 support for 0x1f931c1c is therefore already registered by DiamondLib.registerInterface(); this module does not mint a separate ERC-165 slot.

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;

Parameters

NameTypeDescription
_diamondCutFacetCut[]The facet addresses, cut actions, and function selectors.
_initaddressThe address of the contract or facet to delegatecall after the cut (0 to skip).
_calldatabytesThe calldata passed to _init.

Events

AdminUpgradeExecuted

Emitted after an admin-gated cut is authorized and applied. Mirrors that the guard (emergency-stop, then DEFAULT_ADMIN_ROLE) passed before delegating to DiamondLib.

event AdminUpgradeExecuted(address indexed executor, uint256 facetCutCount, address indexed init);

Parameters

NameTypeDescription
executoraddressThe caller that passed the role gate (a DEFAULT_ADMIN_ROLE holder).
facetCutCountuint256The number of FacetCut entries applied.
initaddressThe init address delegatecalled after the cut (address(0) if none).