ERC20Permit
Inherits: IERC20Permit
Title: ERC20Permit
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Permit.sol)
Stateless Diamond facet adding ERC-2612 permit-based approvals to ERC-20.
Owns ONLY the ERC-2612 surface (permit/nonces/DOMAIN_SEPARATOR), implemented over EIP712Lib and
NoncesLib. It does NOT inherit the EIP712 / Nonces facets — doing so would re-export
eip712Domain() / nonces() and collide with those standalone facets (and any other EIP-712 extension)
in a Diamond. A token that also wants ERC-5267 eip712Domain() discovery cuts the standalone EIP712
facet as a COMPONENT via the blueprint (see TokenBlueprintHelper._permitTokenBlueprint); the EIP-712 and
nonce storage are seeded once in the token's initializer (EIP712Lib.__EIP712_init/NoncesLib.__Nonces_init).
Differences from OpenZeppelin:
permitbehaves identically.DOMAIN_SEPARATORstayspublic view virtual. OpenZeppelin v5.5 droppedvirtual(it was alreadyexternal); the ABI is the same.- Registers IERC20Permit for ERC-165 in its init; OpenZeppelin's extension has no ERC-165.
Notes:
- lattice-version: 0.1.0
- lattice-source: OpenZeppelin v5.6.1
Functions
permit
Sets value as the allowance of spender over owner's tokens,
given a signed approval.
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
public
virtual;Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | |
| spender | address | |
| value | uint256 | |
| deadline | uint256 | |
| v | uint8 | |
| r | bytes32 | |
| s | bytes32 |
nonces
Returns the current nonce for owner (for use in permit signatures).
function nonces(address owner) public view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| owner | address |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
DOMAIN_SEPARATOR
Returns the domain separator used in the encoding of permit signatures.
function DOMAIN_SEPARATOR() public view virtual returns (bytes32);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ERC20Permit methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
DOMAIN_SEPARATOR() 0x3644e515
nonces(address) 0x7ecebe00
permit(address,address,uint256,uint256,uint8,bytes32,bytes32) 0xd505accf
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |