diff --git a/contracts/crowdsale/emission/AllowanceCrowdsale.sol b/contracts/crowdsale/emission/AllowanceCrowdsale.sol index 2af6752fb..d2caad7ef 100644 --- a/contracts/crowdsale/emission/AllowanceCrowdsale.sol +++ b/contracts/crowdsale/emission/AllowanceCrowdsale.sol @@ -1,5 +1,6 @@ pragma solidity ^0.4.24; +import "../../Initializable.sol"; import "../Crowdsale.sol"; import "../../token/ERC20/IERC20.sol"; import "../../token/ERC20/SafeERC20.sol"; @@ -10,17 +11,20 @@ import "../../math/SafeMath.sol"; * @title AllowanceCrowdsale * @dev Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale. */ -contract AllowanceCrowdsale is Crowdsale { +contract AllowanceCrowdsale is Initializable, Crowdsale { using SafeMath for uint256; using SafeERC20 for IERC20; address private _tokenWallet; + constructor(address tokenWallet) public { + } + /** * @dev Constructor, takes token wallet address. * @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale */ - constructor(address tokenWallet) public { + function initialize(address tokenWallet) public initializer { require(tokenWallet != address(0)); _tokenWallet = tokenWallet; } diff --git a/contracts/mocks/AllowanceCrowdsaleImpl.sol b/contracts/mocks/AllowanceCrowdsaleImpl.sol index be01ccdf9..c354a4e13 100644 --- a/contracts/mocks/AllowanceCrowdsaleImpl.sol +++ b/contracts/mocks/AllowanceCrowdsaleImpl.sol @@ -1,10 +1,11 @@ pragma solidity ^0.4.24; +import "../Initializable.sol"; import "../token/ERC20/IERC20.sol"; import "../crowdsale/emission/AllowanceCrowdsale.sol"; -contract AllowanceCrowdsaleImpl is AllowanceCrowdsale { +contract AllowanceCrowdsaleImpl is Initializable, Crowdsale, AllowanceCrowdsale { constructor ( uint256 rate, @@ -16,6 +17,8 @@ contract AllowanceCrowdsaleImpl is AllowanceCrowdsale { Crowdsale(rate, wallet, token) AllowanceCrowdsale(tokenWallet) { + Crowdsale.initialize(rate, wallet, token); + AllowanceCrowdsale.initialize(tokenWallet); } } diff --git a/test/crowdsale/AllowanceCrowdsale.test.js b/test/crowdsale/AllowanceCrowdsale.test.js index ee6a063f2..b7ea1dea8 100644 --- a/test/crowdsale/AllowanceCrowdsale.test.js +++ b/test/crowdsale/AllowanceCrowdsale.test.js @@ -9,7 +9,7 @@ const should = require('chai') .should(); const AllowanceCrowdsale = artifacts.require('AllowanceCrowdsaleImpl'); -const SimpleToken = artifacts.require('SimpleToken'); +const SimpleToken = artifacts.require('SimpleTokenMock'); contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenWallet]) { const rate = new BigNumber(1);