diff --git a/migrations/2_deploy_crowdsale.js b/migrations/2_deploy_crowdsale.js index ee91fb1..253f162 100644 --- a/migrations/2_deploy_crowdsale.js +++ b/migrations/2_deploy_crowdsale.js @@ -12,19 +12,15 @@ const duration = { years: function (val) { return val * this.days(365); }, }; -module.exports = async function(deployer, network, accounts) { +module.exports = function(deployer, network, accounts) { const _name = "Dapp Token"; const _symbol = "DAPP"; const _decimals = 18; - await deployer.deploy(DappToken, _name, _symbol, _decimals); - const deployedToken = await DappToken.deployed(); - const latestTime = (new Date).getTime(); const _rate = 500; const _wallet = accounts[0]; // TODO: Replace me - const _token = deployedToken.address; const _openingTime = latestTime + duration.minutes(1); const _closingTime = _openingTime + duration.weeks(1); const _cap = ether(100); @@ -34,20 +30,26 @@ module.exports = async function(deployer, network, accounts) { const _partnersFund = accounts[0]; // TODO: Replace me const _releaseTime = _closingTime + duration.days(1); - await deployer.deploy( - DappTokenCrowdsale, - _rate, - _wallet, - _token, - _cap, - _openingTime, - _closingTime, - _goal, - _foundersFund, - _foundationFund, - _partnersFund, - _releaseTime - ); + deployer.then(async() => { + await deployer.deploy(DappToken, _name, _symbol, _decimals); + + const _deployedToken = await DappToken.deployed(); + + await deployer.deploy( + DappTokenCrowdsale, + _rate, + _wallet, + _deployedToken.address, + _cap, + _openingTime, + _closingTime, + _goal, + _foundersFund, + _foundationFund, + _partnersFund, + _releaseTime + ); + }); return true; };