Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Valid

The effect of errors in the calculation of awards and expenses prevents expenses from being drawn out.

Summary

Utilizing division for both awards and expenses, but calculation errors may cause the sum to be incorrect when added together.

Vulnerability Details

The formula is as follows
uint256 prizePool = (totalAmountCollected * 80) / 100;
uint256 fee = (totalAmountCollected * 20) / 100;
These are expected to add up to totalAmountCollected, but may not actually do so due to rounding errors. This may prevent withdrawFees() from passing require(address(this).balance == uint256(totalFees)).

Impact

Failure to extract expenses

Tools Used

Manual

Recommendations

Recommend the following
uint256 prizePool = (totalAmountCollected * 80) / 100;
uint256 fee = totalAmountCollected - prizePool

Updates

Lead Judging Commences

patrickalphac Lead Judge about 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

loss of precision

like 1 wei

Support

FAQs

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

Give us feedback!