20,000 USDC
View results
Submission Details
Severity: low
Valid

`_calculateInterest()` precision loss in `Lender.sol`

Summary

_calculateInterest() calculations have precision loss

Vulnerability Details

Notice that interest is set to a value of (l.interestRate * l.debt * timeElapsed) / 10000 / 365 days, and fees is set to a value of (lenderFee * interest) / 10000. Because division occurs before multiplication in the fees calculation, there may be precision loss.

Impact

Small amount of precision loss in interest calculation. User funds are likely not at risk.

Tools Used

Recommendations

Change the fees calculation to (lenderFee * l.interestRate * l.debt * timeElapsed) / 10000 / 10000 / 365 days.

Support

FAQs

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

Give us feedback!