Appearance
Solidity API
DiamondLoupeFacet
This contract provides functions to inspect the facets of a diamond
Implements EIP-2535 Diamond standard's loupe functions
constructor
solidity
constructor() publicSets the trusted forwarder to address(0)
Constructor that initializes the ERC2771Context with a trusted forwarder
facets
solidity
function facets() external view returns (struct IDiamondLoupe.Facet[] facets_)Gets all facets and their selectors
Iterates through all facet addresses and retrieves their function selectors
Return Values
| Name | Type | Description |
|---|---|---|
| facets_ | struct IDiamondLoupe.Facet[] | An array of Facet structs containing facet addresses and their function selectors |
facetFunctionSelectors
solidity
function facetFunctionSelectors(address _facet) external view returns (bytes4[] facetFunctionSelectors_)Gets all the function selectors provided by a facet
Retrieves the function selectors for a given facet address
Parameters
| Name | Type | Description |
|---|---|---|
| _facet | address | The facet address |
Return Values
| Name | Type | Description |
|---|---|---|
| facetFunctionSelectors_ | bytes4[] | An array of function selectors supported by the facet |
facetAddresses
solidity
function facetAddresses() external view returns (address[] facetAddresses_)Get all the facet addresses used by a diamond
Retrieves the list of all facet addresses
Return Values
| Name | Type | Description |
|---|---|---|
| facetAddresses_ | address[] | An array of facet addresses |
facetAddress
solidity
function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_)Gets the facet that supports the given selector
If facet is not found, returns address(0)
Parameters
| Name | Type | Description |
|---|---|---|
| _functionSelector | bytes4 | The function selector |
Return Values
| Name | Type | Description |
|---|---|---|
| facetAddress_ | address | The facet address that supports the given selector |
_msgSender
solidity
function _msgSender() internal view virtual returns (address sender)Internal function to get the sender address
_Overrides ERC2771Context's msgSender() for compatibility
Return Values
| Name | Type | Description |
|---|---|---|
| sender | address | The address of the message sender |
_msgData
solidity
function _msgData() internal view virtual returns (bytes)Internal function to get the message data
_Overrides ERC2771Context's msgData() for compatibility
Return Values
| Name | Type | Description |
|---|---|---|
| [0] | bytes | The calldata of the message |