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

function _distributeRewards() doesn't distribute rewards correctly

Summary

When it comes to distributing rewards to voters the code doesn't work as intended

Vulnerability Details

rewardPerVoter is calculated by uint256 rewardPerVoter = totalRewards / totalVotes; and rewardPerVoter = Math.mulDiv(totalRewards, 1, totalVotes, Math.Rounding.Ceil); where instead of calculating for totalVotes it should be calculating for totalVotesFor

Impact

Leads to funds being stuck in the protocol

Tools Used

manual review

Recommendations

Replace totalVotes with totalVotesFor in the calculations

Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year 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.