Skip to content
Lattice

SafeDiamondCutInit

Git Source

Title: SafeDiamondCutInit

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

One-shot initializer for a Safe-gated diamond-cut diamond — seeds AccessControl (so guardian management + emergencyResume are DEFAULT_ADMIN_ROLE-gated), EmergencyStop, registers the IERC165 + IDiamondCut + IDiamondLoupe ERC-165 flags, and pins the Safe authority + minimum threshold. Delegatecalled by Diamond.initialize inside the initializing window (so it must NOT open its own pre/postInitializer; each __*_init guard passes because the window is already open). Mirrors exactly what the old MockSafeDiamond.initialize did, minus the redundant pre/postInitializer. Companion to the ERC2981Init pattern — a first-class production deploy artifact.

Functions

init

Runs the access-control + emergency-stop + Safe-cut module initializers. MUST be invoked via the diamond's initialize _init delegatecall.

function init(address admin, address safe, uint256 minThreshold) external;

Parameters

NameTypeDescription
adminaddressThe address granted DEFAULT_ADMIN_ROLE (manages guardians and resumes operation).
safeaddressThe Gnosis Safe multisig pinned as the sole cut authority.
minThresholduint256The minimum signature threshold the pinned Safe must enforce.