This report addresses a precision loss vulnerability found in the function _calculateInterest within the smart contract code. The function is responsible for calculating interest and fees for a loan, but the calculations performed within the function can lead to a loss of precision.
When calculating the interest, the result of (l.interestRate * l.debt * timeElapsed) is divided by 10000 and then again by 365 days:
Additionally, there is a division before multiplication. Fees is the result of (lenderFee * interest) divided by 10000. This can cause additional precision loss.
The precision loss vulnerability in the _calculateInterest function can have significant implications for loan interest and fee calculations such as inaccurate interest and fee calculation
Manual review
Consider changing formula in the following way:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.