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

Fee should be 'totalAmountCollected-prizePool' to prevent decimal loss

Summary

fee should be 'totalAmountCollected-prizePool' to prevent decimal loss

Vulnerability Details

uint256 totalAmountCollected = players.length * entranceFee;
uint256 prizePool = (totalAmountCollected * 80) / 100;
uint256 fee = (totalAmountCollected * 20) / 100;

This formula calculates fee should be 'totalAmountCollected-prizePool'

Impact

By calculates fee like the formula above can cause a loss in totalAmountCollected' if the prizePool` is rounded.

Tools Used

Manual
Foundry

Recommendations

- uint256 fee = (totalAmountCollected * 20) / 100;
+ uint256 fee = totalAmountCollected-prizePool;
Updates

Lead Judging Commences

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