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

Loss of wei by division

Summary

There are no decimals in solidity, thus those are truncated when dividing. (Ex 3/2 = 1, instead of 1.5).

Vulnerability Details

Dividing the totalAmountCollected to prizePool and fee in certain cases can lead to loss of 1 wei.

Impact

  • Loss of 1 wei

Tools Used

Manual Review

Recommendations

To use something like:

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

Lead Judging Commences

Hamiltonite Lead Judge almost 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.