Skip to main content

Allowance

Asset Tokenization Studio Team

Allowance Facet

Implements ERC-20 allowance operations for non-partitioned security tokens.

Delegates allowance mutations to TokenCoreOps and reads allowance snapshots from ERC20StorageWrapper. The facet must be registered once through the initializer flow before the token can become operational.

Methods​

allowance​

function allowance(address owner, address spender) external view returns (uint256)

Returns the remaining amount spender may spend on behalf of owner via a downstream transferFrom-style call.

Reads the allowance at the current time-travel-adjusted block timestamp so snapshot-aware facets observe a consistent storage view.

Parameters​

NameTypeDescription
owneraddressundefined
spenderaddressundefined

Returns​

NameTypeDescription
_0uint256Remaining allowance of spender over owner's tokens.

approve​

function approve(address spender, uint256 value) external nonpayable returns (bool)

Sets value as the allowance of spender over the caller's tokens.

Requires the token to be operational, activated, unpaused, and not configured for multi-partition behaviour. The authenticated sender and spender must satisfy compliance checks before the allowance is updated.

Parameters​

NameTypeDescription
spenderaddressundefined
valueuint256undefined

Returns​

NameTypeDescription
_0boolBoolean flag indicating whether the operation succeeded.

decreaseAllowance​

function decreaseAllowance(address spender, uint256 subtractedValue) external nonpayable returns (bool)

Atomically decreases the allowance granted to spender by the caller.

Requires the token to be operational, activated, unpaused, and not configured for multi-partition behaviour. The authenticated sender and spender must satisfy compliance checks before the allowance is decreased.

Parameters​

NameTypeDescription
spenderaddressundefined
subtractedValueuint256undefined

Returns​

NameTypeDescription
_0boolBoolean flag indicating whether the operation succeeded.

increaseAllowance​

function increaseAllowance(address spender, uint256 addedValue) external nonpayable returns (bool)

Atomically increases the allowance granted to spender by the caller.

Requires the token to be operational, activated, unpaused, and not configured for multi-partition behaviour. The authenticated sender and spender must satisfy compliance checks before the allowance is increased.

Parameters​

NameTypeDescription
spenderaddressundefined
addedValueuint256undefined

Returns​

NameTypeDescription
_0boolBoolean flag indicating whether the operation succeeded.

initializeAllowance​

function initializeAllowance() external nonpayable

Initialises the allowance capability on the token.

Restricted to DEFAULT_ADMIN_ROLE and callable only before this facet is registered.

Events​

AllowanceInitialized​

event AllowanceInitialized()

Emitted once when the allowance capability is initialised on a token.

Fires exclusively from initializeAllowance after the storage write succeeds.

Approval​

event Approval(address indexed owner, address indexed spender, uint256 value)

Emitted when owner authorises spender to spend up to value tokens on their behalf, whether via {IAllowance.approve}, {IAllowance.increaseAllowance} or {IAllowance.decreaseAllowance}.

Mirrors the ERC-20 Approval event. value is the resulting, absolute allowance after the update — not the delta applied.

Parameters​

NameTypeDescription
owner indexedaddressAddress whose tokens may be spent.
spender indexedaddressAddress authorised to spend on owner's behalf.
valueuint256Allowance of spender over owner's tokens after the update.

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.

InfiniteAllowance​

error InfiniteAllowance(address owner, address spender)

Raised when an operation encounters an allowance that is effectively unlimited.

Indicates that the owner has granted the spender an infinite allowance, which may require special handling to avoid unintended accounting or revocation assumptions.

Parameters​

NameTypeDescription
owneraddressThe account that granted the allowance.
spenderaddressThe account authorised to spend on behalf of the owner.

InsufficientAllowance​

error InsufficientAllowance(address spender, address from)

Reverts when spender attempts to consume more allowance than from has granted.

Raised by transferFrom-style flows and by {IAllowance.decreaseAllowance} when the subtracted amount exceeds the current allowance.

Parameters​

NameTypeDescription
spenderaddressAddress attempting to spend on behalf of from.
fromaddressAddress whose allowance is being consumed.

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.

SpenderWithZeroAddress​

error SpenderWithZeroAddress()

Reverts when the zero address is supplied as spender in an allowance update.

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.