Skip to content

Commit cf1ce51

Browse files
authored
Improve comp (#698)
* gas optimization * fix suggestion event
1 parent bf0ecdb commit cf1ce51

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

contracts/schemes/Competition.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ contract Competition {
2929
event NewSuggestion(
3030
bytes32 indexed _proposalId,
3131
uint256 indexed _suggestionId,
32-
string indexed _descriptionHash,
33-
address payable _suggester
32+
string _descriptionHash,
33+
address payable indexed _suggester
3434
);
3535

3636
event NewVote(
@@ -359,7 +359,7 @@ contract Competition {
359359
uint256 numberOfTieSuggestions = proposal.suggestionsPerVote[suggestions[_suggestionId].totalVotes];
360360
uint256 j;
361361
//calc the reward percentage for this suggestion
362-
for (j = orderIndex; j < (orderIndex+numberOfTieSuggestions) && j < proposal.rewardSplit.length; j++) {
362+
for (j = orderIndex; j < (orderIndex+numberOfTieSuggestions) && j < proposal.numberOfWinners; j++) {
363363
rewardPercentage = rewardPercentage.add(proposal.rewardSplit[j]);
364364
}
365365
rewardPercentage = rewardPercentage.div(numberOfTieSuggestions);

contracts/schemes/ContributionRewardExt.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ contract ContributionRewardExt is VotingMachineCallbacks, ProposalExecuteInterfa
313313
* @param _proposalId the ID of the voting in the voting machine
314314
* @param _beneficiary the beneficiary to mint reputation to.
315315
* @param _reputation the reputation amount to mint
316-
* note: burn reputation is not supported via this function
316+
* note: burn reputation is not supported via this function
317317
*/
318318
function redeemReputationByRewarder(bytes32 _proposalId, address _beneficiary, uint256 _reputation)
319319
public

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@daostack/arc",
3-
"version": "0.0.1-rc.35",
3+
"version": "0.0.1-rc.36",
44
"description": "A platform for building DAOs",
55
"files": [
66
"contracts/",

test/competition.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ contract('Competition', accounts => {
211211
assert.equal(tx.logs.length, 1);
212212
assert.equal(tx.logs[0].event, "NewSuggestion");
213213
assert.equal(tx.logs[0].args._suggestionId,1);
214+
assert.equal(tx.logs[0].args._descriptionHash,"suggestion");
214215
});
215216

216217
it("cannot suggest after suggestionEndTime", async function() {

0 commit comments

Comments
 (0)