Skip to main content

TransferAndLockFacet

Asset Tokenization Studio Team

TransferAndLockFacet

Diamond facet that wires the TransferAndLock capability to its resolver key.

Extends TransferAndLockFacetBase with the concrete resolver key and initialiser key bindings. All selector and interface registration is handled by the base contract.

Methods​

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

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​

NameTypeDescription
_toaddressThe address to which tokens will be transferred and locked.
_amountuint256The amount of tokens to be transferred and locked.
_databytesAdditional data with no specified format, sent in the call to _to.
_expirationTimestampuint256The timestamp until which the tokens will be locked.

Returns​

NameTypeDescription
lockId_uint256The 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​

NameTypeDescription
partition indexedbytes32The partition on which the transfer and lock occurred.
from indexedaddressThe address from which tokens were transferred.
toaddressThe address to which tokens were transferred and locked.
valueuint256The amount of tokens transferred and locked.
databytesAdditional data provided by the caller.
expirationTimestampuint256Unix timestamp at which the lock expires.
lockIduint256Identifier 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​

NameTypeDescription
from indexedaddressSource account (zero address on mint).
to indexedaddressDestination account (zero address on burn).
valueuint256Amount 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​

NameTypeDescription
fromPartition indexedbytes32Source partition.
operatoraddressAddress that initiated the transfer.
from indexedaddressToken holder whose balance decreased.
to indexedaddressRecipient whose balance increased.
valueuint256Token quantity transferred.
databytesCaller-supplied data.
operatorDatabytesOperator-supplied data.

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.

InsufficientBalance​

error InsufficientBalance(address account, uint256 balance, uint256 value, bytes32 partition)

Thrown when a transfer or redemption is attempted with insufficient partition balance.

Parameters​

NameTypeDescription
accountaddressThe account whose balance was checked.
balanceuint256The actual balance available.
valueuint256The amount that was requested.
partitionbytes32The 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​

NameTypeDescription
accountaddressAddress that was checked.
partitionbytes32Partition 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​

NameTypeDescription
accountaddressThe caller lacking the required role.
rolebytes32The 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​

NameTypeDescription
snapshotIduint256The 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​

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.

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.