From 1186520617e7ad74e20137d47212848a9f9d96fc Mon Sep 17 00:00:00 2001 From: LaimeJesus Date: Thu, 1 Nov 2018 16:16:21 -0300 Subject: [PATCH] add improvement in simpletoken example #1458 (#1473) * add improvement in simpletoken example #1458 * fix not calling decimals get function in initial supply --- contracts/examples/SimpleToken.sol | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/contracts/examples/SimpleToken.sol b/contracts/examples/SimpleToken.sol index 8c63fdd98..04b016a73 100644 --- a/contracts/examples/SimpleToken.sol +++ b/contracts/examples/SimpleToken.sol @@ -1,6 +1,7 @@ pragma solidity ^0.4.24; import "../token/ERC20/ERC20.sol"; +import "../token/ERC20/ERC20Detailed.sol"; /** * @title SimpleToken @@ -8,18 +9,14 @@ import "../token/ERC20/ERC20.sol"; * Note they can later distribute these tokens as they wish using `transfer` and other * `ERC20` functions. */ -contract SimpleToken is ERC20 { +contract SimpleToken is ERC20, ERC20Detailed { - string public constant name = "SimpleToken"; - string public constant symbol = "SIM"; - uint8 public constant decimals = 18; - - uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals)); + uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals())); /** * @dev Constructor that gives msg.sender all of existing tokens. */ - constructor() public { + constructor() public ERC20Detailed("SimpleToken", "SIM", 18) { _mint(msg.sender, INITIAL_SUPPLY); }