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

For-Loops: Increments can be unchecked

Summary

++i/i++ should be unchecked{++i}/unchecked{i++} when it is not possible for them to overflow, as is the case when used in for- and while-loops

Vulnerability Details

In lender.sol,the borrow(), repay() ,giveLoan() functions use for loops which might increase runtime gas costs for the user.

Impact

Increase in gas costs for users.

Tools Used

Manual review

Recommendations

For instance use the following in giveLoan() function

for (uint256 i; i < loanIds.length;) {
// ...
unchecked { ++i; }
}

Support

FAQs

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

Give us feedback!