convert SimpleToken to initializers
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
|
||||
import "../Initializable.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
|
||||
* `ERC20` functions.
|
||||
*/
|
||||
contract SimpleToken is ERC20 {
|
||||
contract SimpleToken is Initializable, ERC20 {
|
||||
|
||||
string public constant name = "SimpleToken";
|
||||
string public constant symbol = "SIM";
|
||||
@ -21,7 +22,7 @@ contract SimpleToken is ERC20 {
|
||||
/**
|
||||
* @dev Constructor that gives msg.sender all of existing tokens.
|
||||
*/
|
||||
constructor() public {
|
||||
function initialize() public initializer {
|
||||
_mint(msg.sender, INITIAL_SUPPLY);
|
||||
}
|
||||
|
||||
|
||||
10
contracts/mocks/SimpleTokenMock.sol
Normal file
10
contracts/mocks/SimpleTokenMock.sol
Normal 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();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
const { decodeLogs } = require('../helpers/decodeLogs');
|
||||
const SimpleToken = artifacts.require('SimpleToken');
|
||||
const SimpleToken = artifacts.require('SimpleTokenMock');
|
||||
|
||||
const BigNumber = web3.BigNumber;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user