Skip to main content

IERC20Permit

Tokeny Solutions

IERC20Permit

Defines the ERC-2612 permit interface for signature-based ERC20 approvals.

Exposes initialisation and permit operations expected from an ERC20 permit facet. Implementations must enforce replay protection, deadline checks, and signer validity.

Methods​

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
_owneraddressToken holder granting the allowance.
_spenderaddressAddress authorised to spend owner tokens.
_valueuint256Allowance amount approved for spender.
_deadlineuint256Last timestamp at which the signature is valid.
_vuint8Recovery identifier of the ECDSA signature.
_rbytes32First 32-byte word of the ECDSA signature.
_sbytes32Second 32-byte word of the ECDSA signature.

Events​

ERC20PermitInitialized​

event ERC20PermitInitialized()

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

Fires exclusively from initializeERC20Permit after successful facet registration.

Errors​

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.