Skip to main content

DiamondLib

View Source: contracts/diamond/DiamondLib.sol

DiamondLib

Provides Diamond storage slot and supported interface checks.

Structs

DiamondStorage

struct DiamondStorage {
mapping(bytes4 => bytes32) facets,
mapping(uint256 => bytes32) selectorSlots,
uint16 selectorCount,
mapping(bytes4 => bool) supportedInterfaces,
contract IAccessControl accessController
}

Contract Members

Constants & Variables

bytes32 internal constant DIAMOND_STORAGE_POSITION;

Functions

diamondStorage

Gets the Diamond storage slot.

function diamondStorage() 
internal
pure
returns(DiamondStorage storage ds)

Returns

NameTypeDescription
dsDiamondLib.DiamondStorageDiamond storage slot cast to DiamondStorage

addSupportedInterface

Adds a supported interface to the Diamond.

function addSupportedInterface(bytes4 _interfaceId) 
internal

Arguments

NameTypeDescription
_interfaceIdbytes4the interface to add

supportsInterface

Checks if a specific interface is supported.
Implementation of ERC-165 interface detection standard.

function supportsInterface(bytes4 _interfaceId) 
internal
view
returns(bool)

Arguments

NameTypeDescription
_interfaceIdbytes4the sighash of the given interface

Returns

bool