convert AllowanceCrowdsale to initializers
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
|
import "../../Initializable.sol";
|
||||||
import "../Crowdsale.sol";
|
import "../Crowdsale.sol";
|
||||||
import "../../token/ERC20/IERC20.sol";
|
import "../../token/ERC20/IERC20.sol";
|
||||||
import "../../token/ERC20/SafeERC20.sol";
|
import "../../token/ERC20/SafeERC20.sol";
|
||||||
@ -10,17 +11,20 @@ import "../../math/SafeMath.sol";
|
|||||||
* @title AllowanceCrowdsale
|
* @title AllowanceCrowdsale
|
||||||
* @dev Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale.
|
* @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 SafeMath for uint256;
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
address private _tokenWallet;
|
address private _tokenWallet;
|
||||||
|
|
||||||
|
constructor(address tokenWallet) public {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Constructor, takes token wallet address.
|
* @dev Constructor, takes token wallet address.
|
||||||
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
|
* @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));
|
require(tokenWallet != address(0));
|
||||||
_tokenWallet = tokenWallet;
|
_tokenWallet = tokenWallet;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
pragma solidity ^0.4.24;
|
pragma solidity ^0.4.24;
|
||||||
|
|
||||||
|
import "../Initializable.sol";
|
||||||
import "../token/ERC20/IERC20.sol";
|
import "../token/ERC20/IERC20.sol";
|
||||||
import "../crowdsale/emission/AllowanceCrowdsale.sol";
|
import "../crowdsale/emission/AllowanceCrowdsale.sol";
|
||||||
|
|
||||||
|
|
||||||
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
|
contract AllowanceCrowdsaleImpl is Initializable, Crowdsale, AllowanceCrowdsale {
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
uint256 rate,
|
uint256 rate,
|
||||||
@ -16,6 +17,8 @@ contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
|
|||||||
Crowdsale(rate, wallet, token)
|
Crowdsale(rate, wallet, token)
|
||||||
AllowanceCrowdsale(tokenWallet)
|
AllowanceCrowdsale(tokenWallet)
|
||||||
{
|
{
|
||||||
|
Crowdsale.initialize(rate, wallet, token);
|
||||||
|
AllowanceCrowdsale.initialize(tokenWallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ const should = require('chai')
|
|||||||
.should();
|
.should();
|
||||||
|
|
||||||
const AllowanceCrowdsale = artifacts.require('AllowanceCrowdsaleImpl');
|
const AllowanceCrowdsale = artifacts.require('AllowanceCrowdsaleImpl');
|
||||||
const SimpleToken = artifacts.require('SimpleToken');
|
const SimpleToken = artifacts.require('SimpleTokenMock');
|
||||||
|
|
||||||
contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenWallet]) {
|
contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenWallet]) {
|
||||||
const rate = new BigNumber(1);
|
const rate = new BigNumber(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user