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

Eliminate redundant calculations

Summary

Emit totalDebt instead of recalculating the value loan.debt + lenderInterest + protocolInterest in giveLoan() and buyLoan() functions

emit Repaid(
loan.borrower,
loan.lender,
loanId,
- loan.debt + lenderInterest + protocolInterest, // redundant operation increases gas
+ totalDebt
loan.collateral,
loan.interestRate,
loan.startTimestamp
);

Tools used

manual code review

Support

FAQs

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