From f7a374573200e5b002338036cc17f4fb2ec85d14 Mon Sep 17 00:00:00 2001 From: Max Alekseenko Date: Tue, 18 Jun 2019 15:10:39 +0300 Subject: [PATCH] swap function params --- contracts/VotingToManageEmissionFunds.sol | 5 +++-- migrations/2_deploy_contract.js | 4 ++-- test/voting_to_manage_emission_funds_test.js | 18 +++++++++--------- ...ng_to_manage_emission_funds_upgrade_test.js | 14 +++++++------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/contracts/VotingToManageEmissionFunds.sol b/contracts/VotingToManageEmissionFunds.sol index ad05cc4..88cf94d 100644 --- a/contracts/VotingToManageEmissionFunds.sol +++ b/contracts/VotingToManageEmissionFunds.sol @@ -163,13 +163,14 @@ contract VotingToManageEmissionFunds is VotingTo { uint256 _emissionReleaseTime, // unix timestamp uint256 _emissionReleaseThreshold, // seconds uint256 _distributionThreshold, // seconds - address _emissionFunds, - uint256 _minBallotDuration + uint256 _minBallotDuration, // seconds + address _emissionFunds ) public onlyOwner { require(_emissionReleaseTime > getTime()); require(_emissionReleaseThreshold > 0); require(_distributionThreshold > ballotCancelingThreshold()); require(_emissionReleaseThreshold > _distributionThreshold); + require(_minBallotDuration < _distributionThreshold); require(_emissionFunds != address(0)); _init(_minBallotDuration); _setNoActiveBallotExists(true); diff --git a/migrations/2_deploy_contract.js b/migrations/2_deploy_contract.js index cdef365..79d73e8 100644 --- a/migrations/2_deploy_contract.js +++ b/migrations/2_deploy_contract.js @@ -180,8 +180,8 @@ module.exports = function(deployer, network, accounts) { demoMode ? moment.utc().add(10, 'minutes').unix() : moment.utc().add(3, 'months').unix(), demoMode ? 3600 : 7776000, // emissionReleaseThreshold: 1 hour for demo, 3 months for production demoMode ? 1500 : 604800, // distributionThreshold: 25 minutes for demo, 7 days for production - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ); // Initialize ProxyStorage diff --git a/test/voting_to_manage_emission_funds_test.js b/test/voting_to_manage_emission_funds_test.js index 84cedaf..42bed88 100644 --- a/test/voting_to_manage_emission_funds_test.js +++ b/test/voting_to_manage_emission_funds_test.js @@ -99,23 +99,23 @@ contract('VotingToManageEmissionFunds [all features]', function (accounts) { emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, minBallotDuration, + emissionFunds.address, {from: accounts[8]} ).should.be.rejectedWith(ERROR_MSG); await voting.init( emissionReleaseTime, emissionReleaseThreshold, 300, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.rejectedWith(ERROR_MSG); await voting.init( emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.fulfilled; rewardByBlock = await RewardByBlock.new(); @@ -165,8 +165,8 @@ contract('VotingToManageEmissionFunds [all features]', function (accounts) { emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.rejectedWith(ERROR_MSG); }); }); @@ -1055,8 +1055,8 @@ contract('VotingToManageEmissionFunds [all features]', function (accounts) { emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.fulfilled; }); it('may only be called by ProxyStorage', async () => { diff --git a/test/voting_to_manage_emission_funds_upgrade_test.js b/test/voting_to_manage_emission_funds_upgrade_test.js index 0f2b27e..d89a43b 100644 --- a/test/voting_to_manage_emission_funds_upgrade_test.js +++ b/test/voting_to_manage_emission_funds_upgrade_test.js @@ -99,23 +99,23 @@ contract('VotingToManageEmissionFunds upgraded [all features]', function (accoun emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, minBallotDuration, + emissionFunds.address, {from: accounts[8]} ).should.be.rejectedWith(ERROR_MSG); await voting.init( emissionReleaseTime, emissionReleaseThreshold, 300, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.rejectedWith(ERROR_MSG); await voting.init( emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.fulfilled; rewardByBlock = await RewardByBlock.new(); @@ -172,8 +172,8 @@ contract('VotingToManageEmissionFunds upgraded [all features]', function (accoun emissionReleaseTime, emissionReleaseThreshold, distributionThreshold, - emissionFunds.address, - minBallotDuration + minBallotDuration, + emissionFunds.address ).should.be.rejectedWith(ERROR_MSG); }); });