Skip to content
Lattice

SafeDiamondCutLib Constants

Git Source

SAFE_DIAMOND_CUT_STORAGE_SLOT

keccak256(abi.encode(uint256(keccak256("lattice.storage.SafeDiamondCut")) - 1)) & ~bytes32(uint256(0xff)). Verify with: cast index-erc7201 "lattice.storage.SafeDiamondCut".

bytes32 constant SAFE_DIAMOND_CUT_STORAGE_SLOT = 0xdfdae3ef74d2f2c31fc34cd5e60ae4b170cd90587a13d52debd5569f575e7900;

SAFE_DIAMOND_CUT_ERC165_STORAGE_LOCATION

ERC-165 storage location (same across all Lattice/diamond-lib modules). keccak256(abi.encode(uint256(keccak256("diamond.lib.storage.ERC165")) - 1)) & ~bytes32(uint256(0xff)).

bytes32 constant SAFE_DIAMOND_CUT_ERC165_STORAGE_LOCATION =
    0x9ca7f3e2e2bfb15fdf072b85dde92837cddacee6cf2f6b38cd06c9457c1c4200;

ERC165_MAP_ICUT_SLOT

type(ISafeDiamondCut).interfaceId is NOT the cut selector: ISafeDiamondCut bundles diamondCut + setSafe + safe, so its raw interfaceId differs from 0x1f931c1c. But the ONLY selector this facet must occupy to transparently replace diamond-lib's DiamondCutFacet is the canonical cut selector 0x1f931c1c (== IDiamondCut.diamondCut.selector). Its ERC-165 map slot is therefore keccak256(abi.encode(bytes4(0x1f931c1c), ERC165_STORAGE_LOCATION)) = 0xa0f80413692945aab97c6ef0328381ebb94e4b17a84d11ebf6b61f73435b6d7e, which is exactly DiamondLib's ERC165_MAP_ICUT_SLOT. We do NOT mint a separate constant or register a second time: DiamondLib.registerInterface() already sets this flag in any 2535 deployment. The setSafe/safe plus frozen/registry/emergency surface are plain facet functions, NOT advertised as a distinct ERC-165 interface (matching GovernedDiamondCut).

bytes32 constant ERC165_MAP_ICUT_SLOT = 0xa0f80413692945aab97c6ef0328381ebb94e4b17a84d11ebf6b61f73435b6d7e;