Skip to main content

ADiamondStorage

Overview​

License: MIT​

abstract contract ADiamondStorage

The Diamond standard module

This is the storage contract for the diamond proxy

Structs info​

DStorage​

struct DStorage {
mapping(bytes4 => address) selectorToFacet;
mapping(address => EnumerableSet.Bytes32Set) facetToSelectors;
EnumerableSet.AddressSet facets;
}

The storage of the Diamond proxy

FacetInfo​

struct FacetInfo {
address facetAddress;
bytes4[] functionSelectors;
}

Constants info​

DIAMOND_STORAGE_SLOT (0xe828c51f)​

bytes32 constant DIAMOND_STORAGE_SLOT = keccak256("diamond.standard.diamond.storage")

The struct slot where the storage is

Functions info​

facets (0x7a0ed627)​

function facets()
public
view
returns (ADiamondStorage.FacetInfo[] memory facets_)

The function to get all the facets and their selectors

Return values:

NameTypeDescription
facets_struct ADiamondStorage.FacetInfo[]the array of FacetInfo

facetFunctionSelectors (0xadfca15e)​

function facetFunctionSelectors(
address facet_
) public view returns (bytes4[] memory selectors_)

The function to get all the selectors assigned to the facet

Parameters:

NameTypeDescription
facet_addressthe facet to get assigned selectors of

Return values:

NameTypeDescription
selectors_bytes4[]the array of assigned selectors

facetAddresses (0x52ef6b2c)​

function facetAddresses() public view returns (address[] memory facets_)

The function to get all the facets of this diamond

Return values:

NameTypeDescription
facets_address[]the array of facets' addresses

facetAddress (0xcdffacc6)​

function facetAddress(bytes4 selector_) public view returns (address facet_)

The function to get associated facet by the selector

Parameters:

NameTypeDescription
selector_bytes4the selector

Return values:

NameTypeDescription
facet_addressthe associated facet address