CapByPartitionFacet
Asset Tokenization Studio Team
CapByPartitionFacet
Diamond facet that exposes the per-partition maximum supply cap surface through the ICapByPartition interface, registered under RESOLVER_KEY_CAP_BY_PARTITION.
Inherits behaviour from CapByPartition and satisfies IStaticFunctionSelectors for Diamond proxy selector registration. Exposes three selectors: initializeCapByPartition, setMaxSupplyByPartition, getMaxSupplyByPartition.
Methods
getMaxSupplyByPartition
function getMaxSupplyByPartition(bytes32 _partition) external view returns (uint256 maxSupply_)
Returns the maximum supply cap currently in effect for a partition.
The returned value is adjusted for pending balance adjustments effective at the current block timestamp.
Parameters
| Name | Type | Description |
|---|---|---|
| _partition | bytes32 | The partition identifier to query. |
Returns
| Name | Type | Description |
|---|---|---|
| maxSupply_ | uint256 | The balance-adjusted maximum supply for _partition. |
getStaticFunctionSelectors
function getStaticFunctionSelectors() external pure returns (bytes4[])
Gets all function selectors of a facet
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bytes4[] | Face functions selectors |
getStaticInterfaceIds
function getStaticInterfaceIds() external pure returns (bytes4[])
Gets all interfaces ids of a facet.
Returns
| Name | Type | Description |
|---|---|---|
| _0 | 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 |
initializeCapByPartition
function initializeCapByPartition() external nonpayable
Initialises the CapByPartition capability on the token.
Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.
setMaxSupplyByPartition
function setMaxSupplyByPartition(bytes32 _partition, uint256 _maxSupply) external nonpayable returns (bool success_)
Sets the maximum supply cap for a specific partition of the token.
Emits {ICap.MaxSupplyByPartitionSet}.
Parameters
| Name | Type | Description |
|---|---|---|
| _partition | bytes32 | The partition identifier whose cap is being updated. |
| _maxSupply | uint256 | The new maximum supply value for the partition. |
Returns
| Name | Type | Description |
|---|---|---|
| success_ | bool | True when the cap is updated. |
Events
CapByPartitionInitialized
event CapByPartitionInitialized()
Emitted once when the CapByPartition capability is initialised on a token.
Fires exclusively from initializeCapByPartition after the storage write succeeds.
MaxSupplyByPartitionSet
event MaxSupplyByPartitionSet(address indexed operator, bytes32 indexed partition, uint256 newMaxSupply, uint256 previousMaxSupply)
Emitted when the maximum supply for a specific partition is updated.
Parameters
| Name | Type | Description |
|---|---|---|
operator indexed | address | Address of the caller who performed the update. |
partition indexed | bytes32 | The partition whose cap was changed. |
| newMaxSupply | uint256 | The new maximum supply value for the partition. |
| previousMaxSupply | uint256 | The previous maximum supply value for the partition. |
Errors
AccountHasNoRole
error AccountHasNoRole(address account, bytes32 role)
Thrown when an account does not hold a required role.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | The account that lacks the role. |
| role | bytes32 | The role that is not held. |
AssetNotOperational
error AssetNotOperational(bytes32 configId, uint256 versionId)
Raised by InitializerStorageWrapper.checkOperational (and the related isConfigVersionOperational helper) when an operation is attempted on a configuration version that has not yet been marked operational.
Parameters
| Name | Type | Description |
|---|---|---|
| configId | bytes32 | Resolver-proxy configuration whose operational status was checked. |
| versionId | uint256 | Configuration version whose operational status was checked. |
Deactivated
error Deactivated()
Thrown when an operation guarded by onlyActivated is attempted on a token whose deactivation flag has already been set.
FacetAlreadyRegistered
error FacetAlreadyRegistered(bytes32 facetId, uint256 lastVersion)
Raised when an initialiser tries to register a facet that already has a non-zero last registered version (i.e. the facet is being re-initialised on a fresh install).
Parameters
| Name | Type | Description |
|---|---|---|
| facetId | bytes32 | Identifier of the offending facet. |
| lastVersion | uint256 | Last version recorded for that facet at the time of the check. |
IsPaused
error IsPaused()
Thrown when an operation that requires the token to be unpaused is attempted while the token is paused (own flag or any external pause contract).
NewMaxSupplyCannotBeZero
error NewMaxSupplyCannotBeZero()
Thrown when a proposed new global cap is zero.
NewMaxSupplyForPartitionTooLow
error NewMaxSupplyForPartitionTooLow(bytes32 partition, uint256 maxSupply, uint256 totalSupply)
Thrown when a proposed new partition cap is below the partition's current adjusted total supply.
Parameters
| Name | Type | Description |
|---|---|---|
| partition | bytes32 | The partition whose cap would be set below its current supply. |
| maxSupply | uint256 | The proposed new maximum supply for the partition. |
| totalSupply | uint256 | The current adjusted total supply for the partition. |
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. |
WalletRecovered
error WalletRecovered()
Thrown when attempting to recover a wallet that has already been recovered.