Skip to main content

DiamondLoupeFacet

View Source: contracts/diamond/facets/DiamondLoupeFacet.sol

↗ Extends: IDiamondLoupe

DiamondLoupeFacet

Provides Diamond Facet inspection functionality based on Nick Mudge's gas-optimized diamond-2 reference.
Reference Implementation : https://github.com/mudgen/diamond-2-hardhat EIP-2535 Diamond Standard : https://eips.ethereum.org/EIPS/eip-2535

Contract Members

Constants & Variables

string internal constant TOO_MANY_FUNCTIONS;

Functions

facets

Gets all facets and their selectors.

function facets() 
external
view
returns(IDiamondLoupe.Facet[] memory facets_)

Returns

NameTypeDescription
facets_IDiamondLoupe.Facet[]array of Facets

facetFunctionSelectors

Gets all the function selectors supported by a specific facet.

function facetFunctionSelectors(address _facet) 
external
view
returns(bytes4[] facetFunctionSelectors_)

Arguments

NameTypeDescription
_facetaddressthe facet address

Returns

NameTypeDescription
facetFunctionSelectors_bytes4[]the selectors associated with a facet address

facetAddresses

Gets all the facet addresses used by a diamond.

function facetAddresses() 
external
view
returns(address[] facetAddresses_)

Returns

NameTypeDescription
facetAddresses_address[]array of addresses

facetAddress

Gets the facet that supports the given selector.If facet is not found return address(0).

function facetAddress(bytes4 _functionSelector) 
external
view
returns(address facetAddress_)

Arguments

NameTypeDescription
_functionSelectorbytes4the function selector.

Returns

NameTypeDescription
facetAddress_addressthe facet address.