add improvement in simpletoken example #1458 (#1473)

* add improvement in simpletoken example #1458

* fix not calling decimals get function in initial supply
pull/1491/head
LaimeJesus 6 years ago committed by Nicolás Venturo
parent b5892a2b5e
commit 1186520617
  1. 11
      contracts/examples/SimpleToken.sol

@ -1,6 +1,7 @@
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../token/ERC20/ERC20.sol"; import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
/** /**
* @title SimpleToken * @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 * Note they can later distribute these tokens as they wish using `transfer` and other
* `ERC20` functions. * `ERC20` functions.
*/ */
contract SimpleToken is ERC20 { contract SimpleToken is ERC20, ERC20Detailed {
string public constant name = "SimpleToken"; uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
string public constant symbol = "SIM";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
/** /**
* @dev Constructor that gives msg.sender all of existing tokens. * @dev Constructor that gives msg.sender all of existing tokens.
*/ */
constructor() public { constructor() public ERC20Detailed("SimpleToken", "SIM", 18) {
_mint(msg.sender, INITIAL_SUPPLY); _mint(msg.sender, INITIAL_SUPPLY);
} }

Loading…
Cancel
Save