Skip to main content

ProtectedPartitions

Asset Tokenization Studio Team

ProtectedPartitions

Abstract base implementing the protected-partitions toggle and partition-role derivation declared in IProtectedPartitions.

Delegates all storage reads and writes to ProtectedPartitionsStorageWrapper. protectPartitions and unprotectPartitions are guarded by onlyOperational, onlyActivated, onlyUnpaused, and ROLE_PROTECTED_PARTITIONS; initialisation is guarded by DEFAULT_ADMIN_ROLE and the one-shot onlyFacetNotRegistered gate.

Methods​

arePartitionsProtected​

function arePartitionsProtected() external view returns (bool)

Returns whether the protected partitions mode is active

If true, transfers are restricted to accounts having the required role for the partition

Returns​

NameTypeDescription
_0boolbool true if the protected partitions mode is active, false otherwise

calculateRoleForPartition​

function calculateRoleForPartition(bytes32 partition) external pure returns (bytes32 role)

Calculates the role required to transfer tokens from a given partition

Parameters​

NameTypeDescription
partitionbytes32undefined

Returns​

NameTypeDescription
rolebytes32The role required to transfer tokens from the given partition

initializeProtectedPartitions​

function initializeProtectedPartitions(bool _protectPartitions) external nonpayable returns (bool success_)

Initialises the protected-partitions capability with the given starting state.

Called once during token deployment; reverts if the facet has already been registered.

Parameters​

NameTypeDescription
_protectPartitionsboolundefined

Returns​

NameTypeDescription
success_boolAlways true when the call does not revert.

protectPartitions​

function protectPartitions() external nonpayable returns (bool success_)

Activates the protected partitions mode.

Disables free token transfers; callers must hold the required role for the partition.

Returns​

NameTypeDescription
success_boolTrue when activation succeeds without reverting.

unprotectPartitions​

function unprotectPartitions() external nonpayable returns (bool success_)

Deactivates the protected partitions mode.

Re-enables free token transfers regardless of partition role.

Returns​

NameTypeDescription
success_boolTrue when deactivation succeeds without reverting.

Events​

PartitionsProtected​

event PartitionsProtected(address indexed operator)

Emitted when the protected-partition mode is activated.

Parameters​

NameTypeDescription
operator indexedaddressThe address that called protectPartitions.

PartitionsUnProtected​

event PartitionsUnProtected(address indexed operator)

Emitted when the protected-partition mode is deactivated.

Parameters​

NameTypeDescription
operator indexedaddressThe address that called unprotectPartitions.

ProtectedPartitionsInitialized​

event ProtectedPartitionsInitialized(bool arePartitionsProtected)

Emitted once when the protected partitions capability is initialised on a token.

Fires exclusively from initializeProtectedPartitions after the storage write succeeds.

Parameters​

NameTypeDescription
arePartitionsProtectedboolInitial protection state set at deployment time.

ProtectedRedeemFrom​

event ProtectedRedeemFrom(bytes32 indexed partition, address indexed operator, address indexed from, uint256 value, uint256 deadline, uint256 nonce, bytes signature)

Emitted when a signature-authorised redemption executes under protected-partition mode.

Parameters​

NameTypeDescription
partition indexedbytes32Partition from which the tokens are redeemed.
operator indexedaddressThe address that submitted the protected redemption.
from indexedaddressThe holder whose tokens are being redeemed; must be the signer.
valueuint256Number of tokens redeemed.
deadlineuint256Signature validity deadline supplied with the operation.
nonceuint256Holder nonce consumed by this operation.
signaturebytesEIP-712 signature provided by the holder.

ProtectedTransferFrom​

event ProtectedTransferFrom(bytes32 indexed partition, address indexed operator, address indexed from, address to, uint256 value, uint256 deadline, uint256 nonce, bytes signature)

Emitted when a signature-authorised transfer executes under protected-partition mode.

Parameters​

NameTypeDescription
partition indexedbytes32Partition from which the tokens are transferred.
operator indexedaddressThe address that submitted the protected transfer.
from indexedaddressThe holder whose tokens are being transferred; must be the signer.
toaddressRecipient of the transferred tokens.
valueuint256Number of tokens transferred.
deadlineuint256Signature validity deadline supplied with the operation.
nonceuint256Holder nonce consumed by this operation.
signaturebytesEIP-712 signature provided by the holder.

Errors​

AccountHasNoRole​

error AccountHasNoRole(address account, bytes32 role)

Thrown when an account does not hold a required role.

Parameters​

NameTypeDescription
accountaddressThe account that lacks the role.
rolebytes32The 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​

NameTypeDescription
configIdbytes32Resolver-proxy configuration whose operational status was checked.
versionIduint256Configuration 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​

NameTypeDescription
facetIdbytes32Identifier of the offending facet.
lastVersionuint256Last 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).

PartitionsAreProtected​

error PartitionsAreProtected()

Reverts when an operation that requires unprotected mode is attempted while partitions are protected.

PartitionsAreProtectedAndNoRole​

error PartitionsAreProtectedAndNoRole(address account, bytes32 role)

Reverts when a transfer is attempted while partitions are protected and the caller does not hold the required partition role.

Parameters​

NameTypeDescription
accountaddressThe caller lacking the required role.
rolebytes32The role that would have been needed to proceed.

PartitionsAreUnProtected​

error PartitionsAreUnProtected()

Reverts when a protected-mode operation is attempted but partitions are not currently protected.

UnrecognizedResolverProxyVersion​

error UnrecognizedResolverProxyVersion(bytes8 _resolverProxyVersion)

Thrown when the provided proxy version does not match any BLR compatible standard.

Parameters​

NameTypeDescription
_resolverProxyVersionbytes8proxy version that is not compatible with the BLR.

WalletRecovered​

error WalletRecovered()

Thrown when attempting to recover a wallet that has already been recovered.