IDiamond
Asset Tokenization Studio Team
IDiamond
Umbrella interface combining the cut and loupe facets of the Diamond proxy.
Inherits IDiamondCut (facet upgrade operations) and IDiamondLoupe (introspection queries). Consumers that need to address the Diamond as a whole use this interface.
Methods
getConfigInfo
function getConfigInfo() external view returns (address resolver_, bytes8 proxyVersion_, bytes32 configurationId_, uint256 configurationVersion_, bool replacementEnabled_)
Returns the active resolver address, configuration identifier, and version.
Returns
| Name | Type | Description |
|---|---|---|
| resolver_ | address | Address of the current Business Logic Resolver. |
| proxyVersion_ | bytes8 | proxy version. |
| configurationId_ | bytes32 | Identifier of the active configuration. |
| configurationVersion_ | uint256 | Version number of the active configuration. |
| replacementEnabled_ | bool | Whether replacement is enabled. |
getFacet
function getFacet(bytes32 _facetId) external view returns (struct IDiamondLoupe.Facet facet_)
Get the information associated with an specific facet
If facet is not found return empty Facet struct
Parameters
| Name | Type | Description |
|---|---|---|
| _facetId | bytes32 | The facet key for the resolver |
Returns
| Name | Type | Description |
|---|---|---|
| facet_ | IDiamondLoupe.Facet | Facet data |
getFacetAddress
function getFacetAddress(bytes4 _selector) external view returns (address facetAddress_)
Gets the facet that supports the given selector
If facet is not found return address(0)
Parameters
| Name | Type | Description |
|---|---|---|
| _selector | bytes4 | The function selector |
Returns
| Name | Type | Description |
|---|---|---|
| facetAddress_ | address | The facet address |
getFacetAddresses
function getFacetAddresses() external view returns (address[] facetAddresses_)
Get all the facet addresses used by a resolverProxy
Returns
| Name | Type | Description |
|---|---|---|
| facetAddresses_ | address[] | facetAddresses_ |
getFacetAddressesByPage
function getFacetAddressesByPage(uint256 _pageIndex, uint256 _pageLength) external view returns (address[] facetAddresses_)
Get all the facet addresses used by a resolverProxy
Parameters
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | members to skip : _pageIndex * _pageLength |
| _pageLength | uint256 | number of members to return |
Returns
| Name | Type | Description |
|---|---|---|
| facetAddresses_ | address[] | facetAddresses_ |
getFacetIdBySelector
function getFacetIdBySelector(bytes4 _selector) external view returns (bytes32 facetId_)
Gets the facet key that supports the given selector
If facet is not found return address(0)
Parameters
| Name | Type | Description |
|---|---|---|
| _selector | bytes4 | The function selector |
Returns
| Name | Type | Description |
|---|---|---|
| facetId_ | bytes32 | The facet key |
getFacetIds
function getFacetIds() external view returns (bytes32[] facetIds_)
Get all the facet addresses used by a resolverProxy
Returns
| Name | Type | Description |
|---|---|---|
| facetIds_ | bytes32[] | facetIds_ |
getFacetIdsByPage
function getFacetIdsByPage(uint256 _pageIndex, uint256 _pageLength) external view returns (bytes32[] facetIds_)
Get all the facet addresses used by a resolverProxy
Parameters
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | members to skip : _pageIndex * _pageLength |
| _pageLength | uint256 | number of members to return |
Returns
| Name | Type | Description |
|---|---|---|
| facetIds_ | bytes32[] | facetIds_ |
getFacetSelectors
function getFacetSelectors(bytes32 _facetId) external view returns (bytes4[] facetSelectors_)
Gets all the function selectors supported by a specific facet.
Parameters
| Name | Type | Description |
|---|---|---|
| _facetId | bytes32 | The facet key for the resolver. |
Returns
| Name | Type | Description |
|---|---|---|
| facetSelectors_ | bytes4[] | facetSelectors_ |
getFacetSelectorsByPage
function getFacetSelectorsByPage(bytes32 _facetId, uint256 _pageIndex, uint256 _pageLength) external view returns (bytes4[] facetSelectors_)
Gets all the function selectors supported by a specific facet.
Parameters
| Name | Type | Description |
|---|---|---|
| _facetId | bytes32 | The facet key for the resolver. |
| _pageIndex | uint256 | members to skip : _pageIndex * _pageLength |
| _pageLength | uint256 | number of members to return |
Returns
| Name | Type | Description |
|---|---|---|
| facetSelectors_ | bytes4[] | facetSelectors_ |
getFacetSelectorsLength
function getFacetSelectorsLength(bytes32 _facetId) external view returns (uint256 facetSelectorsLength_)
Gets the function selectors length.
Parameters
| Name | Type | Description |
|---|---|---|
| _facetId | bytes32 | The facet key for the resolver. |
Returns
| Name | Type | Description |
|---|---|---|
| facetSelectorsLength_ | uint256 | facetSelectorsLength_ |
getFacets
function getFacets() external view returns (struct IDiamondLoupe.Facet[] facets_)
Gets all facet addresses and their four byte function selectors.
Returns
| Name | Type | Description |
|---|---|---|
| facets_ | IDiamondLoupe.Facet[] | Facet |
getFacetsByPage
function getFacetsByPage(uint256 _pageIndex, uint256 _pageLength) external view returns (struct IDiamondLoupe.Facet[] facets_)
Gets all facet addresses and their four byte function selectors.
Parameters
| Name | Type | Description |
|---|---|---|
| _pageIndex | uint256 | members to skip : _pageIndex * _pageLength |
| _pageLength | uint256 | number of members to return |
Returns
| Name | Type | Description |
|---|---|---|
| facets_ | IDiamondLoupe.Facet[] | Facet |
getFacetsLength
function getFacetsLength() external view returns (uint256 facetsLength_)
Gets facet length.
Returns
| Name | Type | Description |
|---|---|---|
| facetsLength_ | uint256 | Facets length |
getStaticFunctionSelectors
function getStaticFunctionSelectors() external pure returns (bytes4[] staticFunctionSelectors_)
Gets all function selectors of a facet
Returns
| Name | Type | Description |
|---|---|---|
| staticFunctionSelectors_ | bytes4[] | Face functions selectors |
getStaticInterfaceIds
function getStaticInterfaceIds() external pure returns (bytes4[] staticInterfaceIds_)
Gets all interfaces ids of a facet.
Returns
| Name | Type | Description |
|---|---|---|
| staticInterfaceIds_ | bytes4[] | Face interface ids |
getStaticResolverKey
function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)
Gets the static resolver key
Returns
| Name | Type | Description |
|---|---|---|
| staticResolverKey_ | bytes32 | Static resolver key |
updateConfig
function updateConfig(bytes32 _newConfigurationId, uint256 _newVersion) external nonpayable
For the current BLR, update its configuration identifier and version.
Parameters
| Name | Type | Description |
|---|---|---|
| _newConfigurationId | bytes32 | The new configuration identifier to apply. |
| _newVersion | uint256 | The version number associated with the new configuration. |
updateConfigVersion
function updateConfigVersion(uint256 _newVersion) external nonpayable
For the current BLR and configuration, update the used version.
Parameters
| Name | Type | Description |
|---|---|---|
| _newVersion | uint256 | The new version number to set for the current configuration. |
updateReplacementEnabled
function updateReplacementEnabled(bool _newReplacementEnabled) external nonpayable
For the current BLR update its configuration
Parameters
| Name | Type | Description |
|---|---|---|
| _newReplacementEnabled | bool | The replacement enabled flag to set* |
updateResolver
function updateResolver(contract IBusinessLogicResolver _newResolver, bytes32 _newConfigurationId, uint256 _newVersion, bool _newReplacementEnabled) external nonpayable
Replaces the Business Logic Resolver with a new one, setting configuration and version.
Parameters
| Name | Type | Description |
|---|---|---|
| _newResolver | contract IBusinessLogicResolver | The new BLR contract address to wire into the proxy. |
| _newConfigurationId | bytes32 | The configuration identifier to activate on the new resolver. |
| _newVersion | uint256 | The version number associated with the new configuration. |
| _newReplacementEnabled | bool | The replacement enabled flag to set. |
Events
ConfigUpdated
event ConfigUpdated(address indexed caller, bytes32 oldConfigurationId, bytes32 newConfigurationId, uint256 oldConfigurationVersion, uint256 newConfigurationVersion)
Emitted when the active configuration identifier is replaced.
updateConfig() combines an id change and a version change in one call; both get a complete old/new pair here.
Parameters
| Name | Type | Description |
|---|---|---|
caller indexed | address | Account that performed the update. |
| oldConfigurationId | bytes32 | Previous configuration identifier. |
| newConfigurationId | bytes32 | New configuration identifier. |
| oldConfigurationVersion | uint256 | Previous configuration version. |
| newConfigurationVersion | uint256 | Version activated for the new configuration. |
ConfigVersionUpdated
event ConfigVersionUpdated(address indexed caller, uint256 oldConfigurationVersion, uint256 newConfigurationVersion)
Emitted when the pinned version of the active configuration is replaced.
Parameters
| Name | Type | Description |
|---|---|---|
caller indexed | address | Account that performed the update. |
| oldConfigurationVersion | uint256 | Previous configuration version. |
| newConfigurationVersion | uint256 | New configuration version. |
ReplacementEnabledUpdated
event ReplacementEnabledUpdated(address indexed caller, bool oldReplacementEnabled, bool newReplacementEnabled)
Emitted when the replacement-enabled flag is replaced.
Parameters
| Name | Type | Description |
|---|---|---|
caller indexed | address | Account that performed the update. |
| oldReplacementEnabled | bool | Previous replacement-enabled flag. |
| newReplacementEnabled | bool | New replacement-enabled flag. |
ResolverUpdated
event ResolverUpdated(address indexed caller, address oldResolver, address newResolver, bytes32 oldConfigurationId, bytes32 newConfigurationId, uint256 oldConfigurationVersion, uint256 newConfigurationVersion, bool oldReplacementEnabled, bool newReplacementEnabled)
Emitted when the resolver-proxy's Business Logic Resolver is replaced.
updateResolver() combines four changes in one call; every one of them gets a complete old/new pair here rather than only the fields that happen to differ.
Parameters
| Name | Type | Description |
|---|---|---|
caller indexed | address | Account that performed the update. |
| oldResolver | address | Previous Business Logic Resolver address. |
| newResolver | address | New Business Logic Resolver address. |
| oldConfigurationId | bytes32 | Previous configuration identifier. |
| newConfigurationId | bytes32 | Configuration identifier activated on the new resolver. |
| oldConfigurationVersion | uint256 | Previous configuration version. |
| newConfigurationVersion | uint256 | Configuration version activated on the new resolver. |
| oldReplacementEnabled | bool | Previous replacement-enabled flag. |
| newReplacementEnabled | bool | Replacement-enabled flag activated on the new resolver. |
Errors
InvalidBusinessLogicResolver
error InvalidBusinessLogicResolver(address invalidResolver)
Thrown when a candidate resolver is the zero address or fails the isBusinessLogicResolver() identity check.
Parameters
| Name | Type | Description |
|---|---|---|
| invalidResolver | address | The address that failed validation. |