From 2a64ea8e1e54613ded84b520f29de750f36cf4e2 Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Mon, 16 Mar 2020 11:53:30 +0100 Subject: [PATCH] add IERC20Detailed --- .../contracts/IERC20Detailed.sol | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 network-contracts/contracts/IERC20Detailed.sol diff --git a/network-contracts/contracts/IERC20Detailed.sol b/network-contracts/contracts/IERC20Detailed.sol new file mode 100644 index 0000000..c26c65c --- /dev/null +++ b/network-contracts/contracts/IERC20Detailed.sol @@ -0,0 +1,52 @@ +pragma solidity >=0.5.0 <0.7.0; + +import "./IERC20.sol"; + +contract ERC20Detailed is IERC20 { + string private _name; + string private _symbol; + uint8 private _decimals; + + /** + * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of + * these values are immutable: they can only be set once during + * construction. + */ + constructor (string memory name, string memory symbol, uint8 decimals) public { + _name = name; + _symbol = symbol; + _decimals = decimals; + } + + /** + * @dev Returns the name of the token. + */ + function name() public view returns (string memory) { + return _name; + } + + /** + * @dev Returns the symbol of the token, usually a shorter version of the + * name. + */ + function symbol() public view returns (string memory) { + return _symbol; + } + + /** + * @dev Returns the number of decimals used to get its user representation. + * For example, if `decimals` equals `2`, a balance of `505` tokens should + * be displayed to a user as `5,05` (`505 / 10 ** 2`). + * + * Tokens usually opt for a value of 18, imitating the relationship between + * Ether and Wei. + * + * NOTE: This information is only used for _display_ purposes: it in + * no way affects any of the arithmetic of the contract, including + * {IERC20-balanceOf} and {IERC20-transfer}. + */ + function decimals() public view returns (uint8) { + return _decimals; + } +} +