From ae6f0af88fa657cd182638e49f338566c5e52cb3 Mon Sep 17 00:00:00 2001 From: orenyodfat Date: Thu, 16 Aug 2018 01:04:14 +0300 Subject: [PATCH] bug fix : zero beneficiary daobounty only if actual redeeming was done. (#522) * zero daobounty only if actual redeeming was done. * enhanced daobounty test * bump version to 0.0.0-alpah.50 --- contracts/VotingMachines/GenesisProtocol.sol | 2 +- package-lock.json | 2 +- package.json | 2 +- test/genesisprotocol.js | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contracts/VotingMachines/GenesisProtocol.sol b/contracts/VotingMachines/GenesisProtocol.sol index 6b6a4957..c9073eeb 100644 --- a/contracts/VotingMachines/GenesisProtocol.sol +++ b/contracts/VotingMachines/GenesisProtocol.sol @@ -524,11 +524,11 @@ contract GenesisProtocol is IntVoteInterface,UniversalScheme { if (potentialAmount > beneficiaryLimit) { potentialAmount = beneficiaryLimit; } - proposal.stakers[_beneficiary].amountForBounty = 0; } if ((potentialAmount != 0)&&(stakingToken.balanceOf(proposal.avatar) >= potentialAmount)) { proposal.daoBountyRemain = proposal.daoBountyRemain.sub(potentialAmount); require(ControllerInterface(Avatar(proposal.avatar).owner()).externalTokenTransfer(stakingToken,_beneficiary,potentialAmount,proposal.avatar)); + proposal.stakers[_beneficiary].amountForBounty = 0; redeemedAmount = potentialAmount; emit RedeemDaoBounty(_proposalId,proposal.avatar,_beneficiary,redeemedAmount); } diff --git a/package-lock.json b/package-lock.json index 97a587bb..e6bffe2b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@daostack/arc", - "version": "0.0.0-alpha.49", + "version": "0.0.0-alpha.50", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7ba052c8..39679b51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@daostack/arc", - "version": "0.0.0-alpha.49", + "version": "0.0.0-alpha.50", "description": "A platform for building DAOs", "files": [ "contracts/", diff --git a/test/genesisprotocol.js b/test/genesisprotocol.js index 4ea2af3f..f237926f 100644 --- a/test/genesisprotocol.js +++ b/test/genesisprotocol.js @@ -1545,6 +1545,8 @@ contract('GenesisProtocol', function (accounts) { //'there is no tokens on the dao for bounty' assert.equal(stakerRedeemAmountBaunty,0); //send tokens to org avatar + tx = await testSetup.genesisProtocol.redeemDaoBounty(proposalId,accounts[0]); + assert.equal(tx.logs.length,0); //not enough funds await testSetup.stakingToken.transfer(testSetup.org.avatar.address,potentialAmount); tx = await testSetup.genesisProtocol.redeemDaoBounty(proposalId,accounts[0]); assert.equal(tx.logs.length,1); @@ -1554,6 +1556,9 @@ contract('GenesisProtocol', function (accounts) { assert.equal(tx.logs[0].args._amount, potentialAmount.toNumber()); assert.equal(await testSetup.stakingToken.balanceOf(accounts[0]),900); + tx = await testSetup.genesisProtocol.redeemDaoBounty(proposalId,accounts[0]); + assert.equal(tx.logs.length,0); + }); it("redeem dao bounty for unsuccessful proposal", async () => {