Skip to content

Commit 1186520

Browse files
LaimeJesusnventuro
authored andcommitted
add improvement in simpletoken example OpenZeppelin#1458 (OpenZeppelin#1473)
* add improvement in simpletoken example OpenZeppelin#1458 * fix not calling decimals get function in initial supply
1 parent b5892a2 commit 1186520

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

contracts/examples/SimpleToken.sol

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
pragma solidity ^0.4.24;
22

33
import "../token/ERC20/ERC20.sol";
4+
import "../token/ERC20/ERC20Detailed.sol";
45

56
/**
67
* @title SimpleToken
78
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
89
* Note they can later distribute these tokens as they wish using `transfer` and other
910
* `ERC20` functions.
1011
*/
11-
contract SimpleToken is ERC20 {
12+
contract SimpleToken is ERC20, ERC20Detailed {
1213

13-
string public constant name = "SimpleToken";
14-
string public constant symbol = "SIM";
15-
uint8 public constant decimals = 18;
16-
17-
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
14+
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
1815

1916
/**
2017
* @dev Constructor that gives msg.sender all of existing tokens.
2118
*/
22-
constructor() public {
19+
constructor() public ERC20Detailed("SimpleToken", "SIM", 18) {
2320
_mint(msg.sender, INITIAL_SUPPLY);
2421
}
2522

0 commit comments

Comments
 (0)