Reading array length at each iteration of the loop takes 6 gas (three for mload and three to place memory_offset ) in the stack. Caching the array length in the stack saves around 3 gas per iteration. I suggest storing the array’s length in a variable before the for-loop.
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L233
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L293
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L359
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L438
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L549
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L592
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.