in the previous implementation
Calculating _getWithdrawablePerShare() with no decimal places (e.g. 1e18).
resulting in a possible 'round down' and loss of precision.
This makes the total amount smaller when _getAvailable(), causing the amount to be locked.
modify _getAvailable(), use the formula: shares * withdrawablePerShare / totalShares - withdrawn.
This formula, multiply first and then divide, no round down problem.
mitigation resolved the original issue.
Lines of code
Vulnerability details
Comments
in the previous implementation Calculating
_getWithdrawablePerShare()
with no decimal places (e.g. 1e18). resulting in a possible 'round down' and loss of precision. This makes the total amount smaller when_getAvailable()
, causing the amount to be locked.Mitigation
https://github.com/pixeldaogg/florida-contracts/pull/362
Modify the following.
_getWithdrawablePerShare()
._getAvailable()
, use the formula:shares * withdrawablePerShare / totalShares - withdrawn
. This formula, multiply first and then divide, noround down
problem. mitigation resolved the original issue.Conclusion
LGTM