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

`Lender.sol::giveLoan` - Updates made to `loans[loanId]` should be first made to a memory variable

Summary

Updates made to pools[poolId] should be made to a memory available and then assigned to storage.

Note that by doing so, all the members of the struct Loan need to be written, but this will be much cheaper because of the cheap MSTORE as compared to the expensive SSTORE

File: src/Lender.sol
416: loans[loanId].lender = pool.lender;
417: loans[loanId].interestRate = pool.interestRate;
418: loans[loanId].startTimestamp = block.timestamp;
419: loans[loanId].auctionStartTimestamp = type(uint256).max;
420: loans[loanId].debt = totalDebt;

Support

FAQs

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