Asset Tokenization Studio Team
IDiamondCutManager
Manages versioned diamond configurations consumed by resolver proxies.
Each configuration is keyed by configurationId and groups a set of facets at pinned versions. For every configurationId the manager retains: - latestVersion: monotonically increasing counter of registered versions. - Per version: the facet list, where each entry exposes the facet id, its selectors, and its supported interface ids. Configurations may be registered atomically via {createConfiguration} or incrementally via {createBatchConfiguration}, with {cancelBatchConfiguration} discarding an in-progress batch. Resolution helpers ({resolveResolverProxyCall}, {resolveSupportsInterface}) drive the dispatch logic of resolver proxies and require an explicit non-zero _version; callers that want the most recent version must read it first via {getLatestVersionByConfiguration}. Read helpers expose paginated views over configurations, facets, and selectors to keep gas bounded.
Methods
cancelBatchConfiguration
function cancelBatchConfiguration(bytes32 _configurationId) external nonpayable
Discards an in-progress batch configuration, dropping every facet appended so far for the pending version.
Emits {DiamondBatchConfigurationCancelled}. Has no effect once the version has been finalised via a _isLastBatch = true call.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key whose pending batch should be cancelled. |
checkResolverProxyConfigurationRegistered
function checkResolverProxyConfigurationRegistered(bytes32 _configurationId, uint256 _version) external nonpayable
Reverts if the (configurationId, version) pair is not a registered, finalised configuration.
Intended to gate resolver-proxy operations; reverts with {ResolverProxyConfigurationNoRegistered} when the lookup fails.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to verify. |
| _version | uint256 | Version to verify; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
createBatchConfiguration
function createBatchConfiguration(bytes32 _configurationId, IDiamondCutManager.FacetConfiguration[] _facetConfigurations, bool _isLastBatch, bytes _data) external nonpayable
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | undefined |
| _facetConfigurations | IDiamondCutManager.FacetConfiguration[] | undefined |
| _isLastBatch | bool | undefined |
| _data | bytes | undefined |
createConfiguration
function createConfiguration(bytes32 _configurationId, IDiamondCutManager.FacetConfiguration[] _facetConfigurations, bytes _data) external nonpayable
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | undefined |
| _facetConfigurations | IDiamondCutManager.FacetConfiguration[] | undefined |
| _data | bytes | undefined |
getConfigurations
function getConfigurations(uint256 _pageIndex, uint256 _pageLength) external view returns (bytes32[] configurationIds_)
Returns a paginated slice of registered configuration ids.
Pagination is used to keep gas bounded on large registries; out-of-range pages return an empty array rather than reverting.
Parameters
| Name | Type | Description |
|---|
| _pageIndex | uint256 | Page index; entries skipped equal _pageIndex * _pageLength. |
| _pageLength | uint256 | Maximum number of entries to return. |
Returns
| Name | Type | Description |
|---|
| configurationIds_ | bytes32[] | Slice of configuration ids for the requested page. |
getConfigurationsLength
function getConfigurationsLength() external view returns (uint256 configurationsLength_)
Returns the number of distinct configuration keys registered in the manager.
Returns
| Name | Type | Description |
|---|
| configurationsLength_ | uint256 | Total count of registered configuration ids. |
getFacetAddressByConfigurationIdVersionAndFacetId
function getFacetAddressByConfigurationIdVersionAndFacetId(bytes32 _configurationId, uint256 _version, bytes32 _facetId) external view returns (address facetAddress_)
Returns the address of a facet inside a configuration version.
Returns address(0) when the facet is not part of the configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _facetId | bytes32 | Facet key to look up. |
Returns
| Name | Type | Description |
|---|
| facetAddress_ | address | Address of the facet, or address(0) if unregistered. |
getFacetAddressesByConfigurationIdAndVersion
function getFacetAddressesByConfigurationIdAndVersion(bytes32 _configurationId, uint256 _version, uint256 _pageIndex, uint256 _pageLength) external view returns (address[] facetAddresses_)
Returns a paginated slice of facet addresses registered for a configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _pageIndex | uint256 | Page index; entries skipped equal _pageIndex * _pageLength. |
| _pageLength | uint256 | Maximum number of entries to return. |
Returns
| Name | Type | Description |
|---|
| facetAddresses_ | address[] | Slice of facet addresses for the requested page. |
getFacetByConfigurationIdVersionAndFacetId
function getFacetByConfigurationIdVersionAndFacetId(bytes32 _configurationId, uint256 _version, bytes32 _facetId) external view returns (struct IDiamondLoupe.Facet facet_)
Returns the full facet record (id, address, selectors, interface ids) for a facet inside a configuration version.
Returns a zero-valued {IDiamondLoupe.Facet} when the facet is not part of the configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _facetId | bytes32 | Facet key to look up. |
Returns
| Name | Type | Description |
|---|
| facet_ | IDiamondLoupe.Facet | Facet record for _facetId. |
getFacetConfigurationsByConfigurationIdAndVersion
function getFacetConfigurationsByConfigurationIdAndVersion(bytes32 _configurationId, uint256 _version, uint256 _start, uint256 _end) external view returns (struct IDiamondCutManager.FacetConfiguration[] facetConfigurations_)
Returns the (facet id, facet version) tuples registered for a configuration version over a half-open index range.
Slice semantics differ from the page-based helpers: _start is inclusive and _end is exclusive, allowing callers to express arbitrary windows.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _start | uint256 | Inclusive start index of the slice. |
| _end | uint256 | Exclusive end index of the slice. |
Returns
| Name | Type | Description |
|---|
| facetConfigurations_ | IDiamondCutManager.FacetConfiguration[] | Slice of {FacetConfiguration} entries for the window. |
getFacetIdByConfigurationIdVersionAndSelector
function getFacetIdByConfigurationIdVersionAndSelector(bytes32 _configurationId, uint256 _version, bytes4 _selector) external view returns (bytes32 facetId_)
Returns the facet id that owns a selector inside a configuration version.
Returns bytes32(0) when the selector is not registered.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _selector | bytes4 | Selector to look up. |
Returns
| Name | Type | Description |
|---|
| facetId_ | bytes32 | Facet id owning _selector, or bytes32(0) if none. |
getFacetIdsByConfigurationIdAndVersion
function getFacetIdsByConfigurationIdAndVersion(bytes32 _configurationId, uint256 _version, uint256 _pageIndex, uint256 _pageLength) external view returns (bytes32[] facetIds_)
Returns a paginated slice of facet ids registered for a configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _pageIndex | uint256 | Page index; entries skipped equal _pageIndex * _pageLength. |
| _pageLength | uint256 | Maximum number of entries to return. |
Returns
| Name | Type | Description |
|---|
| facetIds_ | bytes32[] | Slice of facet ids for the requested page. |
getFacetSelectorsByConfigurationIdVersionAndFacetId
function getFacetSelectorsByConfigurationIdVersionAndFacetId(bytes32 _configurationId, uint256 _version, bytes32 _facetId, uint256 _pageIndex, uint256 _pageLength) external view returns (bytes4[] facetSelectors_)
Returns a paginated slice of selectors registered for a facet inside a configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _facetId | bytes32 | Facet key whose selectors are returned. |
| _pageIndex | uint256 | Page index; entries skipped equal _pageIndex * _pageLength. |
| _pageLength | uint256 | Maximum number of entries to return. |
Returns
| Name | Type | Description |
|---|
| facetSelectors_ | bytes4[] | Slice of selectors for the requested page. |
getFacetSelectorsLengthByConfigurationIdVersionAndFacetId
function getFacetSelectorsLengthByConfigurationIdVersionAndFacetId(bytes32 _configurationId, uint256 _version, bytes32 _facetId) external view returns (uint256 facetSelectorsLength_)
Returns the number of selectors registered for a facet inside a configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _facetId | bytes32 | Facet key whose selectors are counted. |
Returns
| Name | Type | Description |
|---|
| facetSelectorsLength_ | uint256 | Count of selectors owned by the facet in the version. |
getFacetVersionByConfigurationIdVersionAndFacetId
function getFacetVersionByConfigurationIdVersionAndFacetId(bytes32 _configurationId, uint256 _version, bytes32 _facetId) external view returns (uint256 facetVersion_)
Returns the pinned facet version stored inside a configuration version.
Reverts with {FacetIdNotRegistered} when the facet is not part of the configuration version, and with {VersionZero} when _version is 0.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _facetId | bytes32 | Facet key to look up. |
Returns
| Name | Type | Description |
|---|
| facetVersion_ | uint256 | Pinned facet version inside the configuration version. |
getFacetsByConfigurationIdAndVersion
function getFacetsByConfigurationIdAndVersion(bytes32 _configurationId, uint256 _version, uint256 _pageIndex, uint256 _pageLength) external view returns (struct IDiamondLoupe.Facet[] facets_)
Returns a paginated slice of facets for a configuration version, including each facet's address, selectors, and advertised interface ids.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _pageIndex | uint256 | Page index; entries skipped equal _pageIndex * _pageLength. |
| _pageLength | uint256 | Maximum number of entries to return. |
Returns
| Name | Type | Description |
|---|
| facets_ | IDiamondLoupe.Facet[] | Slice of {IDiamondLoupe.Facet} entries for the requested page. |
getFacetsLengthByConfigurationIdAndVersion
function getFacetsLengthByConfigurationIdAndVersion(bytes32 _configurationId, uint256 _version) external view returns (uint256 facetsLength_)
Returns the number of facets registered under a configuration version.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
| _version | uint256 | Version to query; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
Returns
| Name | Type | Description |
|---|
| facetsLength_ | uint256 | Count of facets in the configuration version. |
getLatestVersionByConfiguration
function getLatestVersionByConfiguration(bytes32 _configurationId) external view returns (uint256 latestVersion_)
Returns the latest registered version of a configuration.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to query. |
Returns
| Name | Type | Description |
|---|
| latestVersion_ | uint256 | Latest finalised version, or 0 when no version is registered. |
isResolverProxyConfigurationRegistered
function isResolverProxyConfigurationRegistered(bytes32 _configurationId, uint256 _version) external view returns (bool)
Non-reverting variant of {checkResolverProxyConfigurationRegistered}.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key to check. |
| _version | uint256 | Version to check; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
Returns
| Name | Type | Description |
|---|
| _0 | bool | True when the configuration version is registered and finalised. |
resolveResolverProxyCall
function resolveResolverProxyCall(bytes _resolverProxyConfiguration, bytes4 _selector) external view returns (address facetAddress_)
Resolves the facet address that implements a selector for a given configuration and version.
Used by resolver proxies during dispatch. Returns address(0) when no facet claims the selector.
Parameters
| Name | Type | Description |
|---|
| _resolverProxyConfiguration | bytes | Resolver proxy full configuration. |
| _selector | bytes4 | Function selector being dispatched. |
Returns
| Name | Type | Description |
|---|
| facetAddress_ | address | Address of the facet that owns _selector, or address(0) if the selector is not registered for the given configuration/version. |
resolveResolverProxyCall
function resolveResolverProxyCall(bytes32 _configurationId, uint256 _version, bytes4 _selector) external view returns (address facetAddress_)
Resolves the facet address that implements a selector for a given configuration and version.
Used by resolver proxies during dispatch. Returns address(0) when no facet claims the selector.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key bound to the resolver proxy. |
| _version | uint256 | Version bound to the resolver proxy; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _selector | bytes4 | Function selector being dispatched. |
Returns
| Name | Type | Description |
|---|
| facetAddress_ | address | Address of the facet that owns _selector, or address(0) if the selector is not registered for the given configuration/version. |
resolveSupportsInterface
function resolveSupportsInterface(bytes32 _configurationId, uint256 _version, bytes4 _interfaceId) external view returns (bool exists_)
Reports whether an interface id is advertised by any facet inside the given configuration and version.
Powers ERC-165 lookups on resolver proxies.
Parameters
| Name | Type | Description |
|---|
| _configurationId | bytes32 | Configuration key bound to the resolver proxy. |
| _version | uint256 | Version bound to the resolver proxy; must be > 0. Read {getLatestVersionByConfiguration} first when the latest is required. |
| _interfaceId | bytes4 | Interface identifier to test. |
Returns
| Name | Type | Description |
|---|
| exists_ | bool | True if _interfaceId is supported by the configuration version. |
Events
DiamondBatchConfigurationCancelled
event DiamondBatchConfigurationCancelled(bytes32 indexed configurationId, uint256 indexed version)
Emitted when an in-progress batch configuration is discarded.
Parameters
| Name | Type | Description |
|---|
configurationId indexed | bytes32 | Configuration key whose pending batch was cancelled. |
version indexed | uint256 | Version number that was being assembled and is now dropped. |
DiamondBatchConfigurationCreated
event DiamondBatchConfigurationCreated(bytes32 configurationId, IDiamondCutManager.FacetConfiguration[] facetConfigurations, bool isLastBatch, uint256 version, bytes data)
Emitted on every {createBatchConfiguration} call, including the final batch.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration key being assembled. |
| facetConfigurations | IDiamondCutManager.FacetConfiguration[] | Facets appended in this batch. |
| isLastBatch | bool | True when this call finalises the configuration version. |
| version | uint256 | Version number being assembled for this configuration. |
| data | bytes | Additional data passed to the configuration. |
DiamondConfigurationCreated
event DiamondConfigurationCreated(bytes32 configurationId, IDiamondCutManager.FacetConfiguration[] facetConfigurations, uint256 version, bytes data)
Emitted when a configuration is created atomically via {createConfiguration}.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration key that was registered. |
| facetConfigurations | IDiamondCutManager.FacetConfiguration[] | Facets (id, version) that compose the new configuration. |
| version | uint256 | Version number assigned to the newly created configuration. |
| data | bytes | Additional data passed to the configuration. |
Errors
DeactivatedVersionNotAllowed
error DeactivatedVersionNotAllowed(bytes32 facetId, uint256 version)
Thrown when a configuration selects a facet version whose status has been set to DEACTIVATED. Configurations that already reference the version are unaffected; this only blocks the version from being selected into a new configuration.
Parameters
| Name | Type | Description |
|---|
| facetId | bytes32 | Facet id whose selected version is deactivated. |
| version | uint256 | Deactivated version that was selected. |
DefaultValueForConfigurationIdNotPermitted
error DefaultValueForConfigurationIdNotPermitted()
Thrown when bytes32(0) is supplied as a configuration id, which is reserved.
DuplicatedFacetInConfiguration
error DuplicatedFacetInConfiguration(bytes32 facetId)
Thrown when the same facet id appears more than once within a configuration.
Parameters
| Name | Type | Description |
|---|
| facetId | bytes32 | Duplicated facet id. |
EmptyFacetConfigurationNotPermitted
error EmptyFacetConfigurationNotPermitted(bytes32 configurationId)
Thrown when attempting to activate a configuration that contains no facets, which would brick any ResolverProxy following the latest version.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration key that was supplied with an empty facet list. |
FacetIdNotRegistered
error FacetIdNotRegistered(bytes32 configurationId, bytes32 facetId)
Thrown when a configuration references a facet id that is not registered in the business-logic resolver.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration being created or modified. |
| facetId | bytes32 | Unknown facet id that triggered the revert. |
InvalidResolverProxyConfiguration
error InvalidResolverProxyConfiguration(bytes _resolverProxyConfiguration)
Thrown when the provided encoded proxy configuration does not respect the standard.
Parameters
| Name | Type | Description |
|---|
| _resolverProxyConfiguration | bytes | wrong encoded proxy configuration. |
OngoingBatchConfigurationNotPermitted
error OngoingBatchConfigurationNotPermitted(bytes32 configurationId)
Thrown when {createConfiguration} is called for a configuration id that already has an in-progress batch, which would prematurely finalise the incomplete batch and absorb any facets that were intended for subsequent batch additions.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration key whose batch is currently open. |
ResolverProxyConfigurationNoRegistered
error ResolverProxyConfigurationNoRegistered(bytes32 resolverProxyConfigurationId, uint256 version)
Thrown when a (configurationId, version) pair is referenced but has not been registered (or is still mid-batch and therefore not yet finalised).
Parameters
| Name | Type | Description |
|---|
| resolverProxyConfigurationId | bytes32 | Configuration key that was looked up. |
| version | uint256 | Version that was looked up. |
SelectorAlreadyRegistered
error SelectorAlreadyRegistered(bytes32 configurationId, uint256 version, bytes32 facetId, bytes4 selector)
Thrown when a selector is already registered under another facet for the same (configurationId, version), which would create an ambiguous dispatch.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration where the clash was detected. |
| version | uint256 | Version where the clash was detected. |
| facetId | bytes32 | Facet attempting to register the selector. |
| selector | bytes4 | Selector that is already mapped to a different facet. |
SelectorBlacklisted
error SelectorBlacklisted(bytes4 selector)
Thrown when attempting to register a selector that is globally blacklisted.
Parameters
| Name | Type | Description |
|---|
| selector | bytes4 | Function selector that is forbidden. |
UnrecognizedResolverProxyVersion
error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)
Thrown when the provided proxy version does not match any BLR compatible standard.
Parameters
| Name | Type | Description |
|---|
| _resolverProxyVersion | bytes8 | proxy version that is not compatible with the BLR. |
VersionZero
error VersionZero(bytes32 configurationId)
Thrown when a configuration version of 0 is supplied to an entry point that requires an explicit version pin.
Callers that want the most recent registered version must read it first via {getLatestVersionByConfiguration} and pass that value.
Parameters
| Name | Type | Description |
|---|
| configurationId | bytes32 | Configuration key that was looked up. |