Sparkn

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

Rounding Error leading to loss of winner's token

Summary

Rounding Error leading to loss of winner's token

Vulnerability Details

In _distribute() (https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/Distributor.sol#L116) there is chance of rounding error when the BASIS_POINTS is greater than (totalAmount * percentages[i]) (BASIS_POINTS > (totalAmount * percentages[i])) leading to amount variable becoming 0 . (https://github.com/Cyfrin/2023-08-sparkn/blob/main/src/Distributor.sol#L146).
Due to rounding error the amount transferred to winner will be zero rather than being the actual amount causing a loss to user .

Impact

Rounding Error leading to loss of winner's token and the token would be transferred to 'STADIUM_ADDRESS' address causing permanent loss of tokens.

Tools Used

Manual review

Recommendations

Should check the amount variable that it is greater than zero or not before transferring it (amount>0).

Support

FAQs

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