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

Caching structs and reading array elements only once

Gas - in the provided links there are 3 cases of storing and then reading the same variable instead of directly reading it once, aka Loan memory loan = loans[loanIds[i]]; instead of Loan memory loan = loans[loanId];, and 1 case where the loan is saved to memory a little later than it should, which wastes gas when getting the old pool in the refinance() function. Move the line before the assigning of the oldPool and use the cached variable to generate the id.

Support

FAQs

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

Give us feedback!