Despite the solidity version having safe-math in-built it is still a good practice to divide before you multiply in your business logic to avoid potential integer overflow/underflow bugs in the interest rate calculations.
This funtion has potential overflow/underflow vulnerabilities
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;
}
Loss of funds and unexpected behavior
Manual review
Always divide before you multiply in your business logic.
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.