The _calculateInterest
function in the smart contract is designed to calculate the interest and fees accrued on a loan based on the loan details and the time elapsed since the loan was initiated. However, there is a flaw in the interest calculation that affects the accuracy of the computed interest.
The _calculateInterest
function performs interest calculations incorrectly due to the order of operations in the expression. The relevant code snippet for the function is as follows:
The issue lies in the interest calculation line:
The calculation is divided by 365
days at the end, which results in an incorrect computation of daily interest. This approach treats the interest as a simple daily interest rather than compounding it over time.
The incorrect interest calculation can lead to borrowers being charged inaccurate interest amounts on their loans. This could result in financial losses for both borrowers and lenders, affecting the overall fairness and stability of the lending platform. Additionally, if this incorrect interest calculation propagates to other parts of the contract or is used for further calculations, it may lead to cascading inaccuracies throughout the system.
Manual
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.