From dc4bfa4e448fdf63a79ffb4d5d3d3004b6a00bb1 Mon Sep 17 00:00:00 2001 From: Oren Sokolowsky Date: Sun, 8 Dec 2019 16:37:49 +0200 Subject: [PATCH 1/2] gas optimization --- contracts/schemes/Competition.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/schemes/Competition.sol b/contracts/schemes/Competition.sol index 9d6f1a19..271b2902 100644 --- a/contracts/schemes/Competition.sol +++ b/contracts/schemes/Competition.sol @@ -359,7 +359,7 @@ contract Competition { uint256 numberOfTieSuggestions = proposal.suggestionsPerVote[suggestions[_suggestionId].totalVotes]; uint256 j; //calc the reward percentage for this suggestion - for (j = orderIndex; j < (orderIndex+numberOfTieSuggestions) && j < proposal.rewardSplit.length; j++) { + for (j = orderIndex; j < (orderIndex+numberOfTieSuggestions) && j < proposal.numberOfWinners; j++) { rewardPercentage = rewardPercentage.add(proposal.rewardSplit[j]); } rewardPercentage = rewardPercentage.div(numberOfTieSuggestions); From bb0674479e2a224b870ab82fa3f98df14e1462ba Mon Sep 17 00:00:00 2001 From: Oren Sokolowsky Date: Mon, 9 Dec 2019 12:00:16 +0200 Subject: [PATCH 2/2] fix suggestion event --- contracts/schemes/Competition.sol | 4 ++-- contracts/schemes/ContributionRewardExt.sol | 2 +- package-lock.json | 2 +- package.json | 2 +- test/competition.js | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/contracts/schemes/Competition.sol b/contracts/schemes/Competition.sol index 271b2902..f97ee38e 100644 --- a/contracts/schemes/Competition.sol +++ b/contracts/schemes/Competition.sol @@ -29,8 +29,8 @@ contract Competition { event NewSuggestion( bytes32 indexed _proposalId, uint256 indexed _suggestionId, - string indexed _descriptionHash, - address payable _suggester + string _descriptionHash, + address payable indexed _suggester ); event NewVote( diff --git a/contracts/schemes/ContributionRewardExt.sol b/contracts/schemes/ContributionRewardExt.sol index d921a1b5..6d3b953e 100644 --- a/contracts/schemes/ContributionRewardExt.sol +++ b/contracts/schemes/ContributionRewardExt.sol @@ -313,7 +313,7 @@ contract ContributionRewardExt is VotingMachineCallbacks, ProposalExecuteInterfa * @param _proposalId the ID of the voting in the voting machine * @param _beneficiary the beneficiary to mint reputation to. * @param _reputation the reputation amount to mint - * note: burn reputation is not supported via this function + * note: burn reputation is not supported via this function */ function redeemReputationByRewarder(bytes32 _proposalId, address _beneficiary, uint256 _reputation) public diff --git a/package-lock.json b/package-lock.json index ac351d89..530c8578 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@daostack/arc", - "version": "0.0.1-rc.35", + "version": "0.0.1-rc.36", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index eadf0321..90abcb78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@daostack/arc", - "version": "0.0.1-rc.35", + "version": "0.0.1-rc.36", "description": "A platform for building DAOs", "files": [ "contracts/", diff --git a/test/competition.js b/test/competition.js index c78299b2..fd360272 100644 --- a/test/competition.js +++ b/test/competition.js @@ -211,6 +211,7 @@ contract('Competition', accounts => { assert.equal(tx.logs.length, 1); assert.equal(tx.logs[0].event, "NewSuggestion"); assert.equal(tx.logs[0].args._suggestionId,1); + assert.equal(tx.logs[0].args._descriptionHash,"suggestion"); }); it("cannot suggest after suggestionEndTime", async function() {