Skip to content
Lattice

ERC20PermitLib

Git Source

Title: ERC20PermitLib

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Permit.sol)

Library implementing ERC-2612 permit-based approvals for ERC-20 tokens.

No own storage — relies on EIP712 and Nonces slots already present.

Functions

__ERC20Permit_init

Registers the IERC20Permit interface for ERC-165 discovery.

No own storage to initialize. EIP712 and Nonces must be initialized separately.

function __ERC20Permit_init() internal;

registerInterface

Registers support for the IERC20Permit interface via ERC-165.

function registerInterface() internal;

permit

Sets approval via a signed permit.

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

Parameters

NameTypeDescription
owneraddressThe token owner granting the approval.
spenderaddressThe address being approved.
valueuint256The allowance amount.
deadlineuint256The block.timestamp after which the signature is invalid.
vuint8Signature component.
rbytes32Signature component.
sbytes32Signature component.