Skip to content

Commit

Permalink
Improve comp (#698)
Browse files Browse the repository at this point in the history
* gas optimization

* fix suggestion event
  • Loading branch information
orenyodfat authored Dec 9, 2019
1 parent bf0ecdb commit cf1ce51
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions contracts/schemes/Competition.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/schemes/ContributionRewardExt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
1 change: 1 addition & 0 deletions test/competition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit cf1ce51

Please sign in to comment.