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()
- facetFunctionSelectors(address _facet)
- facetAddresses()
- facetAddress(bytes4 _functionSelector)
facets
Gets all facets and their selectors.
function facets()
external
view
returns(IDiamondLoupe.Facet[] memory facets_)
Returns
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
_facet | address | the facet address |
Returns
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
_functionSelector | bytes4 | the function selector. |
Returns
Name | Type | Description |
---|---|---|
facetAddress_ | address | the facet address. |