Skip to content

Solidity API

IDiamondLoupe

This interface is part of the EIP-2535 Diamond Standard.

A loupe is a small magnifying glass used to look at diamonds. These functions look at diamonds and provide introspection capabilities.

Facet

Struct representing a facet of the diamond.

Parameters

NameTypeDescription
solidity
struct Facet {
  address facetAddress;
  bytes4[] functionSelectors;
}

facets

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

Gets all facet addresses and their four byte function selectors.

This function allows for a complete view of the diamond's structure.

Return Values

NameTypeDescription
facets_struct IDiamondLoupe.Facet[]An array of Facet structs containing all facets and their selectors.

facetFunctionSelectors

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

Gets all the function selectors supported by a specific facet.

This function allows for inspecting a single facet's capabilities.

Parameters

NameTypeDescription
_facetaddressThe facet address to query.

Return Values

NameTypeDescription
facetFunctionSelectors_bytes4[]An array of function selectors supported by the given facet.

facetAddresses

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

Get all the facet addresses used by a diamond.

This function returns a list of all active facet addresses.

Return Values

NameTypeDescription
facetAddresses_address[]An array of facet addresses currently used by the diamond.

facetAddress

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

Gets the facet that supports the given selector.

If facet is not found, it returns address(0).

Parameters

NameTypeDescription
_functionSelectorbytes4The function selector to query.

Return Values

NameTypeDescription
facetAddress_addressThe address of the facet that supports the given selector.