Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

`For` voters get less rewards than expected

Summary

For voters will be rewarded less than expected.

Vulnerability Details

Per documentation:

This contract allows the creator to invite a select group of people to vote on something and provides an eth reward to the for voters if the proposal passes, otherwise refunds the reward to the creator. The creator of the contract is considered "Trusted".

The reward should be distributed to all for voters, so that each for voter's share of the reward should be the total reward divided by the number of for voters. But the code shows the total reward divided by the total number of votes cast: uint256 rewardPerVoter = totalRewards / totalVotes;

There's no doubt that totalRewards / totalVotes is going to be less than totalRewards / totalVotesFor.

Impact

For voters will be rewarded less than expected.

Tools Used

Manual Review

Recommendations

- uint256 rewardPerVoter = totalRewards / totalVotes;
+ uint256 rewardPerForVoter = totalRewards / totalVotesFor;
Updates

Lead Judging Commences

0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

VotingBooth._distributeRewards(): Incorrect computation of rewardPerVoter

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.