Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low
Valid

Rounding in calculations may lead to the incorrect winning amount calculations

Summary

Rounding errors in Solidity will lead to the precision loss in the winning amounts calculations

Vulnerability Details

The amount of tokens to be transfered to the winners is calculated using the division in the _distribute function. uint256 amount = totalAmount * percentages[i] / BASIS_POINTS. Therefore, part of the tokens will be unwithdrawable.

Impact

If totalAmount * percentages[i] is less than BASIS_POINTS, the entire totalAmount * percentages[i] will be lost for the winner. Additionally, if totalAmount * percentages[i] cannot be divided without a remainder, the remainder will be lost for the winner.

Tools Used

VS Code

Recommendations

Verify in amount is not zero or if the division does not have a reminder to avoid precision loss.

Support

FAQs

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