Skip to main content

ComplianceByPartitionFacet

Asset Tokenization Studio Team

ComplianceByPartitionFacet

Diamond facet that exposes partition-aware transfer-eligibility and redemption checks via IComplianceByPartition, registered under RESOLVER_KEY_COMPLIANCE_BY_PARTITION.

Exposes 2 selectors: canTransferByPartition, canRedeemByPartition.

Methods​

canRedeemByPartition​

function canRedeemByPartition(address _from, bytes32 _partition, uint256 _value, bytes _data, bytes _operatorData) external view returns (bool, bytes1, bytes32)

Checks whether a redemption can be executed on a specific partition.

Assumes that if the caller has an admin role the redemption will be performed using the associated method.

Parameters​

NameTypeDescription
_fromaddressThe address whose tokens would be redeemed.
_partitionbytes32The partition the redemption would happen in.
_valueuint256The amount of tokens to redeem.
_databytesAdditional data attached to the redemption check.
_operatorDatabytesAdditional data attached by the operator.

Returns​

NameTypeDescription
_0boolTrue when the redemption is allowed.
_1bytes1EIP-1066 status code describing the result.
_2bytes32Additional reason data tied to the status code.

canTransferByPartition​

function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes _data, bytes _operatorData) external view returns (bool, bytes1, bytes32)

Checks whether a transfer can be executed on a specific partition.

Assumes that if the caller has an admin role the transfer will be performed using the associated method. For example, if msg.sender is an operator of _to, the transfer will be performed using operatorTransferByPartition. Using other methods can lead to inconsistent results.

Parameters​

NameTypeDescription
_fromaddressThe sender address.
_toaddressThe recipient address.
_partitionbytes32The partition the transfer would happen in.
_valueuint256The amount of tokens to transfer.
_databytesAdditional data attached to the transfer check.
_operatorDatabytesAdditional data attached by the operator.

Returns​

NameTypeDescription
_0boolTrue when the transfer is allowed.
_1bytes1EIP-1066 status code describing the result.
_2bytes32Additional reason data tied to the status code.

getStaticFunctionSelectors​

function getStaticFunctionSelectors() external pure returns (bytes4[])

Gets all function selectors of a facet

Returns​

NameTypeDescription
_0bytes4[]Face functions selectors

getStaticInterfaceIds​

function getStaticInterfaceIds() external pure returns (bytes4[])

Gets all interfaces ids of a facet.

Returns​

NameTypeDescription
_0bytes4[]Face interface ids

getStaticResolverKey​

function getStaticResolverKey() external pure returns (bytes32 staticResolverKey_)

Gets the static resolver key

Returns​

NameTypeDescription
staticResolverKey_bytes32Static resolver key

initializeComplianceByPartition​

function initializeComplianceByPartition() external nonpayable

Initialises the compliance by partition capability on the token.

Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.

Events​

ComplianceByPartitionInitialized​

event ComplianceByPartitionInitialized()

Emitted once when the compliance by partition capability is initialised on a token.

Fires exclusively from initializeComplianceByPartition.

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.

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.

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.