Skip to main content

ERC20PermitFacet

Asset Tokenization Studio Team

ERC20PermitFacet

Diamond facet exposing ERC-2612 permit-based gasless approval operations, registered under RESOLVER_KEY_ERC20PERMIT.

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

initializeERC20Permit​

function initializeERC20Permit() external nonpayable

Initialises the ERC20 permit capability on the token.

Restricted to DEFAULT_ADMIN_ROLE by the implementation. Callable once and expected to revert with FacetAlreadyRegistered on subsequent calls. Emits ERC20PermitInitialized on success.

permit​

function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable

Approves a spender using an owner's off-chain ERC-2612 signature.

Validates the deadline, owner nonce, EIP-712 digest, and recovered signer before updating allowance. Reverts with ERC2612ExpiredSignature or ERC2612InvalidSigner when validation fails.

Parameters​

NameTypeDescription
owneraddressundefined
spenderaddressundefined
valueuint256undefined
deadlineuint256undefined
vuint8undefined
rbytes32undefined
sbytes32undefined

Events​

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.

ERC20PermitInitialized​

event ERC20PermitInitialized()

Emitted once when the ERC20 permit capability is initialised on a token.

Fires exclusively from initializeERC20Permit after successful facet registration.

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​

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.

ERC2612ExpiredSignature​

error ERC2612ExpiredSignature(uint256 deadline)

Raised when a permit signature is submitted after its expiry deadline.

The permit must not mutate allowance state when the deadline has passed.

Parameters​

NameTypeDescription
deadlineuint256Timestamp after which the permit is no longer valid.

ERC2612InvalidSigner​

error ERC2612InvalidSigner(address signer, address owner)

Raised when the recovered permit signer does not match the token owner.

Protects approvals from invalid, malformed, or unauthorised signatures.

Parameters​

NameTypeDescription
signeraddressAddress recovered from the submitted permit signature.
owneraddressAddress expected to have authorised the permit.

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.

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.

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.

ZeroAddressNotAllowed​

error ZeroAddressNotAllowed()

Reverts when the zero address is supplied where it is not permitted.

Prevents invalid account, contract, or recipient references.