Skip to main content

LockByPartitionFacet

Asset Tokenization Studio Team

LockByPartitionFacet

Diamond facet exposing partition-aware lock operations and partition-scoped read queries via ILockByPartition, registered under RESOLVER_KEY_LOCK_BY_PARTITION.

Inherits the implementation from LockByPartition and satisfies the IStaticFunctionSelectors contract required by the Diamond proxy for static selector registration. Exposes 6 selectors: lockByPartition, releaseByPartition, getLockedAmountForByPartition, getLockCountForByPartition, getLocksIdForByPartition, getLockForByPartition.

Methods​

getLockCountForByPartition​

function getLockCountForByPartition(bytes32 _partition, address _tokenHolder) external view returns (uint256 lockCount_)

Returns the number of active locks held by _tokenHolder on _partition.

Parameters​

NameTypeDescription
_partitionbytes32The partition the query is scoped to.
_tokenHolderaddressThe address whose lock count is queried.

Returns​

NameTypeDescription
lockCount_uint256The number of active locks on the given partition.

getLockForByPartition​

function getLockForByPartition(bytes32 _partition, address _tokenHolder, uint256 _lockId) external view returns (uint256 amount_, uint256 expirationTimestamp_)

Returns the amount and expiration of a lock on _partition.

Returns the partition figures adjusted by any pending balance-adjustment factors, evaluated at TimeTravelStorageWrapper.getBlockTimestamp().

Parameters​

NameTypeDescription
_partitionbytes32The partition the lock lives on.
_tokenHolderaddressThe address whose lock is queried.
_lockIduint256Identifier of the lock to read.

Returns​

NameTypeDescription
amount_uint256The locked amount, in token base units.
expirationTimestamp_uint256Unix timestamp at which the lock becomes releasable.

getLockedAmountForByPartition​

function getLockedAmountForByPartition(bytes32 _partition, address _tokenHolder) external view returns (uint256 amount_)

Returns the total locked amount of _tokenHolder on _partition, adjusted by any pending balance-adjustment factors.

Returns the partition figure adjusted by any pending balance-adjustment factors, evaluated at TimeTravelStorageWrapper.getBlockTimestamp().

Parameters​

NameTypeDescription
_partitionbytes32The partition the query is scoped to.
_tokenHolderaddressThe address whose locked amount is queried.

Returns​

NameTypeDescription
amount_uint256The locked amount on the given partition.

getLocksIdForByPartition​

function getLocksIdForByPartition(bytes32 _partition, address _tokenHolder, uint256 _pageIndex, uint256 _pageLength) external view returns (uint256[] locksId_)

Returns a paginated list of lock identifiers for _tokenHolder on _partition.

Pagination is bounded by the caller through _pageLength; the returned array length is at most _pageLength. A query past the available range returns an empty array.

Parameters​

NameTypeDescription
_partitionbytes32The partition the query is scoped to.
_tokenHolderaddressThe address whose locks are listed.
_pageIndexuint256Zero-based index of the page to retrieve.
_pageLengthuint256Maximum number of identifiers to return on the page.

Returns​

NameTypeDescription
locksId_uint256[]Array of lock identifiers for the requested page.

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

initializeLockByPartition​

function initializeLockByPartition() external nonpayable

Initialises the lock-by-partition capability on the token.

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

lockByPartition​

function lockByPartition(bytes32 _partition, uint256 _amount, address _tokenHolder, uint256 _expirationTimestamp) external nonpayable returns (uint256 lockId_)

Locks _amount tokens of _tokenHolder on _partition until _expirationTimestamp.

Pause-gated, restricted to ROLE_LOCKER, validated against the single-partition / default-partition rule and against unrecovered token holders. Delegates to LockStorageWrapper.lockByPartition and emits LockedByPartition.

Parameters​

NameTypeDescription
_partitionbytes32The partition the tokens are locked on.
_amountuint256The amount of tokens to lock.
_tokenHolderaddressThe address whose tokens are locked.
_expirationTimestampuint256Unix timestamp at which the lock becomes releasable.

Returns​

NameTypeDescription
lockId_uint256Identifier assigned to the new lock for (partition, tokenHolder).

releaseByPartition​

function releaseByPartition(bytes32 _partition, uint256 _lockId, address _tokenHolder) external nonpayable returns (bool success_)

Releases a lock on _partition previously created with lockByPartition.

Pause-gated and validated against the single-partition / default-partition rule. Reverts with WrongLockId when _lockId is unknown for (_partition, _tokenHolder) and with LockExpirationNotReached before the lock expires. Emits LockByPartitionReleased.

Parameters​

NameTypeDescription
_partitionbytes32The partition the lock lives on.
_lockIduint256Identifier of the lock to release.
_tokenHolderaddressThe address whose tokens are returned.

Returns​

NameTypeDescription
success_boolTrue when the lock has been removed and the balance returned.

updateLockExpirationByPartition​

function updateLockExpirationByPartition(bytes32 _partition, address _tokenHolder, uint256 _lockId, uint256 _newExpirationTimestamp) external nonpayable returns (bool success_)

Updates the expiration timestamp of an existing lock on _partition.

Pause-gated, restricted to ROLE_LOCKER, validated against the single-partition / default-partition rule and the lock-id existence check. Delegates the storage mutation to LockStorageWrapper.updateLockExpiration and emits LockExpirationUpdated with both the old and new timestamps.

Parameters​

NameTypeDescription
_partitionbytes32The partition the lock lives on.
_tokenHolderaddressThe address whose lock expiration is being updated.
_lockIduint256Identifier of the lock to update.
_newExpirationTimestampuint256New Unix timestamp at which the lock becomes releasable.

Returns​

NameTypeDescription
success_boolTrue when the expiration timestamp has been updated.

Events​

DelegateVotesChanged​

event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance)

Emitted when delegate votes change due to balance changes

Parameters​

NameTypeDescription
delegate indexedaddressThe delegate whose votes changed
previousBalanceuint256The previous vote balance
newBalanceuint256The new vote balance

LockByPartitionInitialized​

event LockByPartitionInitialized()

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

Fires exclusively from initializeLockByPartition.

LockByPartitionReleased​

event LockByPartitionReleased(address indexed operator, address indexed tokenHolder, bytes32 indexed partition, uint256 lockId)

Emitted when a previously created lock is released back to its token holder.

Emitted by release, releaseByPartition and forceReleaseByPartition. The released amount is not part of the event because the underlying lock entry is removed atomically; consumers can correlate with the prior LockedByPartition via (partition, tokenHolder, lockId).

Parameters​

NameTypeDescription
operator indexedaddressThe caller that requested the release.
tokenHolder indexedaddressThe address the tokens are returned to.
partition indexedbytes32The partition the lock was held on.
lockIduint256The identifier of the lock that has been released.

LockExpirationUpdated​

event LockExpirationUpdated(address indexed operator, address indexed tokenHolder, bytes32 indexed partition, uint256 lockId, uint256 oldExpirationTimestamp, uint256 newExpirationTimestamp)

Emitted when a lock's expiration timestamp is updated by a locker.

Emitted by both updateLockExpiration (default partition) and updateLockExpirationByPartition (any partition).

Parameters​

NameTypeDescription
operator indexedaddressThe caller that requested the update (must hold ROLE_LOCKER).
tokenHolder indexedaddressThe address whose lock expiration is being updated.
partition indexedbytes32The partition the lock lives on.
lockIduint256The identifier of the lock being updated.
oldExpirationTimestampuint256The expiration timestamp before the update.
newExpirationTimestampuint256The new expiration timestamp after the update.

LockedByPartition​

event LockedByPartition(address indexed operator, address indexed tokenHolder, bytes32 indexed partition, uint256 lockId, uint256 amount, uint256 expirationTimestamp)

Emitted when an amount of tokens is locked on a specific partition until an expiration timestamp.

Emitted by both lock (default partition) and lockByPartition (any partition) so consumers can monitor every lock creation through a single topic.

Parameters​

NameTypeDescription
operator indexedaddressThe caller that requested the lock (typically holds ROLE_LOCKER).
tokenHolder indexedaddressThe address whose tokens are locked.
partition indexedbytes32The partition the tokens are locked on.
lockIduint256The identifier assigned to the new lock for (partition, tokenHolder).
amountuint256The amount of tokens locked.
expirationTimestampuint256The Unix timestamp at which the lock becomes releasable.

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.

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​

AbafChangeForBlockForbidden​

error AbafChangeForBlockForbidden(uint256 blockNumber)

Raised when attempting to change ABAF for a block that is forbidden

Parameters​

NameTypeDescription
blockNumberuint256The block number that is forbidden

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).

LockExpirationNotReached​

error LockExpirationNotReached()

Reverts when a release is attempted before the lock's expiration timestamp.

Used by the onlyWithLockedExpirationTimestamp modifier and by LockStorageWrapper.checkLockedExpirationTimestamp.

PartitionNotAllowedInSinglePartitionMode​

error PartitionNotAllowedInSinglePartitionMode(bytes32 partition)

Thrown when a multi-partition operation specifies a partition not permitted in single-partition mode.

Parameters​

NameTypeDescription
partitionbytes32The disallowed partition supplied by the caller.

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.

UnexpectedError​

error UnexpectedError(bytes4 _errorId)

Reverts when an unreachable validation state is detected.

Replaces assertions for defensive handling of logically impossible states.

Parameters​

NameTypeDescription
_errorIdbytes4Identifier of the unexpected validation condition.

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.

WrongLockId​

error WrongLockId()

Reverts when a lock identifier does not exist for the given (partition, tokenHolder) pair.

Used by the onlyWithValidLockId modifier and by LockStorageWrapper.checkValidLockId.