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
| Name | Type | Description |
|---|---|---|
| owner | address | undefined |
| spender | address | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | Remaining 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
| Name | Type | Description |
|---|---|---|
| spender | address | undefined |
| value | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | Boolean 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
| Name | Type | Description |
|---|---|---|
| spender | address | undefined |
| subtractedValue | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | Boolean 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
| Name | Type | Description |
|---|---|---|
| spender | address | undefined |
| addedValue | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | Boolean 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
| Name | Type | Description |
|---|---|---|
owner indexed | address | Address whose tokens may be spent. |
spender indexed | address | Address authorised to spend on owner's behalf. |
| value | uint256 | Allowance 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
| 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. |
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
| Name | Type | Description |
|---|---|---|
| owner | address | The account that granted the allowance. |
| spender | address | The 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
| Name | Type | Description |
|---|---|---|
| spender | address | Address attempting to spend on behalf of from. |
| from | address | Address 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
| 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.