convert SimpleToken to initializers

This commit is contained in:
Francisco Giordano
2018-09-26 18:08:29 -03:00
parent e2e05294b0
commit e6252d511c
3 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,7 @@
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../token/ERC20/ERC20.sol"; import "../token/ERC20/ERC20.sol";
@ -10,7 +11,7 @@ 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 Initializable, ERC20 {
string public constant name = "SimpleToken"; string public constant name = "SimpleToken";
string public constant symbol = "SIM"; string public constant symbol = "SIM";
@ -21,7 +22,7 @@ contract SimpleToken is ERC20 {
/** /**
* @dev Constructor that gives msg.sender all of existing tokens. * @dev Constructor that gives msg.sender all of existing tokens.
*/ */
constructor() public { function initialize() public initializer {
_mint(msg.sender, INITIAL_SUPPLY); _mint(msg.sender, INITIAL_SUPPLY);
} }

View File

@ -0,0 +1,10 @@
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../examples/SimpleToken.sol";
contract SimpleTokenMock is Initializable, SimpleToken {
constructor() public {
SimpleToken.initialize();
}
}

View File

@ -1,5 +1,5 @@
const { decodeLogs } = require('../helpers/decodeLogs'); const { decodeLogs } = require('../helpers/decodeLogs');
const SimpleToken = artifacts.require('SimpleToken'); const SimpleToken = artifacts.require('SimpleTokenMock');
const BigNumber = web3.BigNumber; const BigNumber = web3.BigNumber;