In the function _calculateInterest() added the modifer view which means the function can't modify the state of the variable it will be consider as the read-only.But here we modify the state of the interest variable.
function _calculateInterest(
Loan memory l
) internal view returns (uint256 interest, uint256 fees) {
uint256 timeElapsed = block.timestamp - l.startTimestamp;
interest = (l.interestRate * l.debt * timeElapsed) / 10000 / 365 days;
fees = (lenderFee * interest) / 10000;
interest -= fees; //This is wrong to modify the state because the function is view only.
}
It can produce the compilation errors and also can give the incorrect results which can affect the whole functionality.
Manual checking.
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.