sherlock-audit / 2024-08-flayer-judging

2 stars 0 forks source link

Parvez.eth - Incorrect Order of Division and Multiplication #677

Open sherlock-admin2 opened 1 month ago

sherlock-admin2 commented 1 month ago

Parvez.eth

Medium

Incorrect Order of Division and Multiplication

Summary

Precision loss in calculation

Vulnerability Detail

Division operations followed directly by multiplication operations can lead to precision loss due to the way integer arithmetic is handled in Solidity.

Impact

precision loss

Code Snippet

        compoundedFactor_ = _previousCompoundedFactor * (1e18 + (perSecondRate / 1000 * _timePeriod)) / 1e18;

Tool used

Manual Review , VS Code