unshETH - Dependencies

draft-ERC20Permit.sol

This Solidity file defines a contract, ERC20Permit, which implements the ERC20 Permit extension allowing approvals to be made via signatures as defined in EIP-2612. This extension allows an account's ERC20 allowance to be changed by presenting a signed message. This eliminates the need for the token holder account to send a transaction or hold Ether.

ERC20Permit

A contract implementing the ERC20 Permit extension, allowing approvals to be made via signatures, as defined in EIP-2612.

permit

function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual override

Function to change an account's ERC20 allowance by presenting a message signed by the account.

Parameters

  • owner address: The owner of the tokens.
  • spender address: The account that the owner is approving to withdraw tokens.
  • value uint256: The number of tokens to be withdrawn.
  • deadline uint256: The time until which the permit is valid.
  • v uint8: The recovery byte of the signature.
  • r bytes32: The first half of the ECDSA signature.
  • s bytes32: The second half of the ECDSA signature.

Return Values

  • ******:

Errors

  • ERC20Permit: expired deadline: Error thrown when the deadline for the permit has expired.
  • ERC20Permit: invalid signature: Error thrown when the recovered signer from the ECDSA signature does not match the owner.

nonces

function nonces(address owner) public view virtual override returns (uint256)

Function to get the current nonce for an owner.

Parameters

  • owner address: The owner of the tokens.

Return Values

  • uint256: The current nonce for the owner.

DOMAIN_SEPARATOR

function DOMAIN_SEPARATOR() external view override returns (bytes32)

Function to get the EIP712 domain separator.

Return Values

  • bytes32: The EIP712 domain separator.

_useNonce

function _useNonce(address owner) internal virtual returns (uint256 current)

Internal function to consume a nonce: return the current value and increment.

Parameters

  • owner address: The owner of the tokens.

Return Values

  • uint256: The current nonce for the owner.
Previous
Strings.sol