TransferAndLockFacetBase
Asset Tokenization Studio Team
TransferAndLockFacetBase
Abstract base that registers the TransferAndLock selectors and interface IDs for Diamond facets that extend this capability.
Concrete subclasses supply the resolver key and initialiser key via overrides.
Methods
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 |
initializeTransferAndLock
function initializeTransferAndLock() external nonpayable
Initialises the transfer-and-lock capability on the token.
Callable once; subsequent calls revert with FacetAlreadyRegistered. Requires DEFAULT_ADMIN_ROLE. Called by the factory during deployment.
transferAndLock
function transferAndLock(address _to, uint256 _amount, bytes _data, uint256 _expirationTimestamp) external nonpayable returns (uint256 lockId_)
Transfers tokens to a specified address and locks them until the expiration timestamp using the default partition.
Parameters
| Name | Type | Description |
|---|---|---|
| _to | address | The address to which tokens will be transferred and locked. |
| _amount | uint256 | The amount of tokens to be transferred and locked. |
| _data | bytes | Additional data with no specified format, sent in the call to _to. |
| _expirationTimestamp | uint256 | The timestamp until which the tokens will be locked. |
Returns
| Name | Type | Description |
|---|---|---|
| lockId_ | uint256 | The identifier assigned to the new hold created for the locked tokens. |
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. |
TransferAndLockInitialized
event TransferAndLockInitialized()
Emitted once when the transfer-and-lock capability is initialised on a token.
Fires exclusively from initializeTransferAndLock.
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).
NotAllowedInMultiPartitionMode
error NotAllowedInMultiPartitionMode()
Thrown when a single-partition operation is attempted on a multi-partition token.
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.