TransferAndLockByPartition
Asset Tokenization Studio Team
TransferAndLockByPartition
Abstract implementation of ITransferAndLockByPartition.
Delegates the ERC-1410 transfer to ERC1410StorageWrapper.transferByPartition and the lock recording to LockStorageWrapper.lockByPartition. Access is restricted via onlyUnpaused, onlyRole(ROLE_LOCKER), onlyWithValidExpirationTimestamp, onlyDefaultPartitionWithSinglePartition, and onlyUnProtectedPartitionsOrWildCardRole. Intended to be inherited solely by TransferAndLockByPartitionFacet.
Methods
initializeTransferAndLockByPartition
function initializeTransferAndLockByPartition() external nonpayable
Initialises the transfer-and-lock-by-partition capability on the token.
Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.
transferAndLockByPartition
function transferAndLockByPartition(bytes32 _partition, address _to, uint256 _amount, bytes _data, uint256 _expirationTimestamp) external nonpayable returns (uint256 lockId_)
Transfers _amount tokens from the caller's _partition balance to _to and locks them until _expirationTimestamp.
Callers must hold ROLE_LOCKER. The token must be unpaused and _expirationTimestamp must be in the future. In single-partition mode only the default partition is permitted; protected partitions require the wildcard role. Emits PartitionTransferredAndLocked, TransferByPartition (via ERC1410StorageWrapper), and Transfer (via ERC1410StorageWrapper).
Parameters
| Name | Type | Description |
|---|---|---|
| _partition | bytes32 | The partition from which tokens are transferred and locked. |
| _to | address | The recipient of the transferred and locked tokens. |
| _amount | uint256 | The amount of tokens to transfer and lock. |
| _data | bytes | Additional data forwarded to the recipient. |
| _expirationTimestamp | uint256 | Unix timestamp until which the transferred tokens are locked. |
Returns
| Name | Type | Description |
|---|---|---|
| lockId_ | uint256 | Identifier assigned to the resulting lock for (_partition, _to). |
Events
PartitionTransferredAndLocked
event PartitionTransferredAndLocked(bytes32 indexed partition, address indexed from, address to, uint256 value, bytes data, uint256 expirationTimestamp, uint256 lockId)
Emitted when tokens are transferred to a recipient on a partition and locked until a future timestamp.
Parameters
| Name | Type | Description |
|---|---|---|
partition indexed | bytes32 | The partition on which the transfer and lock occurred. |
from indexed | address | The address from which tokens were transferred. |
| to | address | The address to which tokens were transferred and locked. |
| value | uint256 | The amount of tokens transferred and locked. |
| data | bytes | Additional data provided by the caller. |
| expirationTimestamp | uint256 | Unix timestamp at which the lock expires. |
| lockId | uint256 | Identifier assigned to the resulting lock. |
Transfer
event Transfer(address indexed from, address indexed to, uint256 value)
Emitted whenever tokens move between accounts, are minted, or are burned.
Parameters
| Name | Type | Description |
|---|---|---|
from indexed | address | Source account (zero address on mint). |
to indexed | address | Destination account (zero address on burn). |
| value | uint256 | Amount of tokens transferred. |
TransferAndLockByPartitionInitialized
event TransferAndLockByPartitionInitialized()
Emitted once when the transfer-and-lock-by-partition capability is initialised on a token.
Fires exclusively from initializeTransferAndLockByPartition.
TransferByPartition
event TransferByPartition(bytes32 indexed fromPartition, address operator, address indexed from, address indexed to, uint256 value, bytes data, bytes operatorData)
Emitted when tokens are transferred from one partition to another or within the same partition.
Parameters
| Name | Type | Description |
|---|---|---|
fromPartition indexed | bytes32 | Source partition. |
| operator | address | Address that initiated the transfer. |
from indexed | address | Token holder whose balance decreased. |
to indexed | address | Recipient whose balance increased. |
| value | uint256 | Token quantity transferred. |
| data | bytes | Caller-supplied data. |
| operatorData | bytes | Operator-supplied data. |
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. |
InsufficientBalance
error InsufficientBalance(address account, uint256 balance, uint256 value, bytes32 partition)
Thrown when a transfer or redemption is attempted with insufficient partition balance.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | The account whose balance was checked. |
| balance | uint256 | The actual balance available. |
| value | uint256 | The amount that was requested. |
| partition | bytes32 | The partition that was checked. |
InvalidLockAmount
error InvalidLockAmount()
Reverts when a lock creation is attempted with a zero amount.
Checked at the start of LockStorageWrapper.lockByPartition, which is the single entry point shared by both Lock.lock and LockByPartition.lockByPartition.
InvalidPartition
error InvalidPartition(address account, bytes32 partition)
Thrown when an account does not hold or is not associated with the specified partition.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | Address that was checked. |
| partition | bytes32 | Partition that was not found for the account. |
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).
PartitionNotAllowedInSinglePartitionMode
error PartitionNotAllowedInSinglePartitionMode(bytes32 partition)
Thrown when a multi-partition operation specifies a partition not permitted in single-partition mode.
Parameters
| Name | Type | Description |
|---|---|---|
| partition | bytes32 | The disallowed partition supplied by the caller. |
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
| Name | Type | Description |
|---|---|---|
| account | address | The caller lacking the required role. |
| role | bytes32 | The role that would have been needed to proceed. |
SnapshotIdDoesNotExists
error SnapshotIdDoesNotExists(uint256 snapshotId)
Thrown when the requested snapshot identifier has never been taken on this token.
Parameters
| Name | Type | Description |
|---|---|---|
| snapshotId | uint256 | The unrecognised snapshot identifier that was supplied. |
SnapshotIdNull
error SnapshotIdNull()
Thrown when a snapshot identifier of zero is supplied; zero is reserved and never assigned to a valid snapshot.
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.
WrongExpirationTimestamp
error WrongExpirationTimestamp()
Reverts when an expiration timestamp is invalid.
Used for expired, past, or otherwise unacceptable expiration values.
ZeroValue
error ZeroValue()
Thrown when a zero token amount is supplied to an operation that requires a positive value.