Extension of ERC20 to include permit functionality (EIP-2612). Allows for approval of ERC20 tokens by signature rather than transaction.
error PermitExpired()
error InvalidS()
error InvalidV()
error InvalidSignature()
bytes32 nameHash
Represents hash of the EIP-712 Domain Separator.
mapping(address => uint256) nonces
Mapping of nonces for each address.
function _setNameHash(string name) internal
Internal function to set the token name hash
Name | Type | Description |
---|---|---|
name | string | The token name |
function DOMAIN_SEPARATOR() public view returns (bytes32)
Calculates the domain separator.
This is not cached because chainid can change on chain forks.
function permit(address issuer, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external
Permit the designated spender to spend the holder’s tokens
The permit function is used to allow a holder to designate a spender to spend tokens on their behalf via a signed message.
Name | Type | Description |
---|---|---|
issuer | address | The address of the token holder |
spender | address | The address of the designated spender |
value | uint256 | The number of tokens to be spent |
deadline | uint256 | The time at which the permission to spend expires |
v | uint8 | The recovery id of the signature |
r | bytes32 | Half of the ECDSA signature pair |
s | bytes32 | Half of the ECDSA signature pair |