Platform: Code4rena
Start Date: 21/06/2022
Pot Size: $55,000 USDC
Total HM: 29
Participants: 88
Period: 5 days
Judge: gzeon
Total Solo HM: 7
Id: 134
League: ETH
Rank: 78/88
Findings: 1
Award: $63.08
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: BowTiedWardens
Also found by: 0v3rf10w, 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, 0xf15ers, 0xkatana, 0xkowloon, Bnke0x0, ElKu, Fitraldys, Funen, GalloDaSballo, IllIllI, JC, Kaiziron, Lambda, MadWookie, Noah3o6, Nyamcil, RoiEvenHaim, TomJ, Tomio, UnusualTurtle, Waze, _Adam, ajtra, asutorufos, bardamu, c3phas, catchup, datapunk, defsec, delfin454000, fatherOfBlocks, grGred, hake, hansfriese, hyh, ignacio, joestakey, kebabsec, ladboy233, oyc_109, pashov, poirots, rfa, robee, sach1r0, samruna, sashik_eth, simon135, slywaters, z3s, zer0dot
63.0781 USDC - $63.08
Uninitialized variables are assigned with the default value of their type, initializing a variable with its default value costs unnecessary gas.
lender/Lender.sol:265: for (uint256 i = 0; i < o.length; ) {
It is recommended to initialize variables without assigning them the default value, for example :
lender/Lender.sol:265: for (uint256 i; i < o.length; ) {
Caching the array length outside a loop saves reading it on each iteration, as long as the array's length is not changed during the loop.
lender/Lender.sol:265: for (uint256 i = 0; i < o.length; ) {
It is recommended to cache the array length on a variable before running the loop, then it doesn't need to read the length on every iteration, which cost gas, for example :
uint256 len = o.length; lender/Lender.sol:265: for (uint256 i = 0; i < len; ) {
Prefix increment ++i
returns the updated value after it's incremented and postfix increment i++
returns the original value then increments it. Prefix increment costs less gas compared to postfix increment.
lender/Lender.sol:96: i++; lender/Lender.sol:120: i++; lender/Lender.sol:289: i++;
It is recommended to use prefix increment instead of postfix one when the return value is not needed, as both of them will give the same result and prefix increment costs less gas.
For example :
lender/Lender.sol:96: ++i;