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

Add IERC20Metadata with name, symbol and decimals #2561

Merged
merged 11 commits into from
Mar 8, 2021
Prev Previous commit
Next Next commit
Revert "rename to IERC20Extended"
This reverts commit 1e7d7a5.
  • Loading branch information
Amxx committed Mar 4, 2021
commit f82136df8ea355d43239a00082e951a02a14ea58
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Rename `UpgradeableProxy` to `ERC1967Proxy`. ([#2547](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2547))
* `ERC777`: Optimize the gas costs of the constructor. ([#2551](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2551))
* `ERC721URIStorage`: Add a new extension that implements the `_setTokenURI` behavior as it was available in 3.4.0. ([#2555](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2555))
* `IERC20Extended`: Interface file for the extended ERC20 standard (that includes the optional `name()`, `symbol()` and `decimals()`). ([#2561](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2561))
* `IERC20Metadata`: Add a new extended interface that includes the optional `name()`, `symbol()` and `decimals()` functions. ([#2561](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2561))

### How to upgrade from 3.x

Expand Down
5 changes: 3 additions & 2 deletions contracts/token/ERC20/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

pragma solidity ^0.8.0;

import "./IERC20Extended.sol";
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
Expand All @@ -29,7 +30,7 @@ import "../../utils/Context.sol";
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20Extended {
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;

mapping (address => mapping (address => uint256)) private _allowances;
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TIP: For an overview of ERC20 tokens and a walk through on how to create a token
There a few core contracts that implement the behavior specified in the EIP:

* {IERC20}: the interface all ERC20 implementations should conform to.
* {IERC20Extended}: the extended ERC20 interface including the <<ERC20-name,`name`>>, <<ERC20-symbol,`symbol`>> and <<ERC20-decimals,`decimals`>> functions.
* {IERC20Metadata}: the extended ERC20 interface including the <<ERC20-name,`name`>>, <<ERC20-symbol,`symbol`>> and <<ERC20-decimals,`decimals`>> functions.
* {ERC20}: the implementation of the ERC20 interface, including the <<ERC20-name,`name`>>, <<ERC20-symbol,`symbol`>> and <<ERC20-decimals,`decimals`>> optional standard extension to the base interface.

Additionally there are multiple custom extensions, including:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "../IERC20.sol";

/**
* @dev Interface of the extended ERC20 standard.
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Extended is IERC20 {
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
Expand Down