Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update IERC20Permit to inherit from IERC20 #15

Merged
merged 2 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

**DISCLAIMER: This code has NOT been externally audited and is actively being developed. Please do not use in production without taking the appropriate steps to ensure maximum security.**

<!-- TODO: Update this documentation to reflect new ERC20Permit implementation. -->
Basic ERC-20 contract designed to be inherited and extended. Leveraging native overflow checks in solc 0.8 to simplify ERC-20 implementation. It should be noted that this ERC-20 implementation does not include some functionality that is commonly used in other tokens, such as:
- `address(0)` checks on `_transfer`
- `permit()`
Expand Down
82 changes: 3 additions & 79 deletions contracts/interfaces/IERC20Permit.sol
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.7;

/// @title Interface of the ERC20 standard with the addition of permit functionality outlined in EIP 2612
interface IERC20Permit {
import { IERC20 } from "./IERC20.sol";

/**
* @dev Emits an event indicating that tokens have moved from one account to another.
* @param owner_ Account that tokens have moved from.
* @param recipient_ Account that tokens have moved to.
* @param amount_ Amount of tokens that have been transferred.
*/
event Transfer(address indexed owner_, address indexed recipient_, uint256 amount_);

/**
* @dev Emits an event indicating that one account has set the allowance of another account over their tokens.
* @param owner_ Account that tokens are approved from.
* @param spender_ Account that tokens are approved for.
* @param amount_ Amount of tokens that have been approved.
*/
event Approval(address indexed owner_, address indexed spender_, uint256 amount_);
/// @title Interface of the ERC20 standard with the addition of permit functionality outlined in EIP 2612
interface IERC20Permit is IERC20 {

/**
@dev Approve by signature.
Expand Down Expand Up @@ -51,66 +37,4 @@ interface IERC20Permit {
*/
function DOMAIN_SEPARATOR() external view returns (bytes32 domain_);

/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory name_);

/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory symbol_);

/**
* @dev Returns the decimal precision used by the token.
*/
function decimals() external view returns (uint8 decimals_);

/**
* @dev Returns the total amount of tokens in existence.
*/
function totalSupply() external view returns (uint256 totalSupply_);

/**
* @dev Returns the amount of tokens owned by a given account.
* @param account_ Account that owns the tokens.
*/
function balanceOf(address account_) external view returns (uint256 balance_);

/**
* @dev Function that returns the allowance that one account has given another over their tokens.
* @param owner_ Account that tokens are approved from.
* @param spender_ Account that tokens are approved for.
*/
function allowance(address owner_, address spender_) external view returns (uint256 allowance_);

/**
* @dev Function that allows one account to set the allowance of another account over their tokens.
* Emits an {Approval} event.
* @param spender_ Account that tokens are approved for.
* @param amount_ Amount of tokens that have been approved.
* @return success_ Boolean indicating whether the operation succeeded.
*/
function approve(address spender_, uint256 amount_) external returns (bool success_);

/**
* @dev Moves an amount of tokens from `msg.sender` to a specified account.
* Emits a {Transfer} event.
* @param recipient_ Account that receives tokens.
* @param amount_ Amount of tokens that are transferred.
* @return success_ Boolean indicating whether the operation succeeded.
*/
function transfer(address recipient_, uint256 amount_) external returns (bool success_);

/**
* @dev Moves a pre-approved amount of tokens from a sender to a specified account.
* Emits a {Transfer} event.
* Emits an {Approval} event.
* @param owner_ Account that tokens are moving from.
* @param recipient_ Account that receives tokens.
* @param amount_ Amount of tokens that are transferred.
* @return success_ Boolean indicating whether the operation succeeded.
*/
function transferFrom(address owner_, address recipient_, uint256 amount_) external returns (bool success_);

}