Platform: Code4rena
Start Date: 23/05/2022
Pot Size: $50,000 USDC
Total HM: 44
Participants: 99
Period: 5 days
Judge: hickuphh3
Total Solo HM: 11
Id: 129
League: ETH
Rank: 93/99
Findings: 1
Award: $30.83
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xf15ers, 0xkatana, Chom, DavidGialdi, Dravee, ElKu, FSchmoede, Fitraldys, Funen, GimelSec, JC, Kaiziron, MaratCerby, Metatron, MiloTruck, Picodes, Randyyy, RoiEvenHaim, SmartSek, Tomio, UnusualTurtle, WatchPug, Waze, _Adam, antonttc, asutorufos, berndartmueller, blackscale, blockdev, c3phas, catchup, csanuragjain, defsec, delfin454000, ellahi, fatherOfBlocks, gzeon, hansfriese, ilan, joestakey, minhquanym, oyc_109, pauliax, pedroais, reassor, rfa, rotcivegaf, sach1r0, samruna, sashik_eth, simon135, z3s
30.8307 USDC - $30.83
object
++ cost more then ++object
.
The default value of uint is 0. So there is no need to set false at index
variable.
uint256 index = 0 cost more then uint256 index.
The default value of bool is false. So there is no need to set false at assigned
variable.
bool assigned = false cost more then bool assigned.
line 310 - bool assigned = false;
fix - bool assigned;
line 311- for (uint256 index = 0; index < array.length; index++) { if (uid == array[index]) { _index = index; assigned = true; return _index; } }
fix - for (uint256 index; index < array.length; ++index) { if (uid == array[index]) { _index = index; assigned = true; return _index; } }
line 427- for (uint256 index = 0; index < quantity; index++) { placeMarketMakingTrades( tokenPair, askNumerators[index], askDenominators[index], bidNumerators[index], bidDenominators[index] ); }
fix- for (uint256 index; index < quantity; ++index) { placeMarketMakingTrades( tokenPair, askNumerators[index], askDenominators[index], bidNumerators[index], bidDenominators[index] ); }
line 480- for (uint256 index = 0; index < quantity; index++) { requote( ids[index], tokenPair, askNumerators[index], askDenominators[index], bidNumerators[index], bidDenominators[index] ); }
fix- for (uint256 index; index < quantity; ++index) { requote( ids[index], tokenPair, askNumerators[index], askDenominators[index], bidNumerators[index], bidDenominators[index] ); }
line 582 - for (uint256 index = 0; index < ids.length; index++) { uint256 _id = ids[index]; scrubStrategistTrade(_id); }
fix - for (uint256 index = 0; index < ids.length; index++) { uint256 _id = ids[index]; scrubStrategistTrade(_id); }
line 206 - last_stratTrade_id++;
fix - ++last_stratTrade_id;
line 277- current[target] = current[current.length - 1];
fix- current[target] = current[--current.length];
line 635 - for (uint256 index = 0; index < bonusTokens.length; index++) { IERC20 token = IERC20(bonusTokens[index]); // Note: Shares already burned in Bath Token _withdraw // Pair each bonus token with a lightly adapted OZ Vesting wallet. Each time a user withdraws, they // are released their relative share of this pool, of vested BathBuddy rewards // The BathBuddy pool should accrue ERC-20 rewards just like OZ VestingWallet and simply just release the withdrawer's relative share of releaseable() tokens if (rewardsVestingWallet != IBathBuddy(0)) { rewardsVestingWallet.release( (token), receiver, sharesWithdrawn, initialTotalSupply, feeBPS ); } } }
fix - for (uint256 index; index < bonusTokens.length; ++index) { IERC20 token = IERC20(bonusTokens[index]); // Note: Shares already burned in Bath Token _withdraw // Pair each bonus token with a lightly adapted OZ Vesting wallet. Each time a user withdraws, they // are released their relative share of this pool, of vested BathBuddy rewards // The BathBuddy pool should accrue ERC-20 rewards just like OZ VestingWallet and simply just release the withdrawer's relative share of releaseable() tokens if (rewardsVestingWallet != IBathBuddy(0)) { rewardsVestingWallet.release( (token), receiver, sharesWithdrawn, initialTotalSupply, feeBPS ); } } }
line 733- nonces[owner]++
fix- ++nonces[owner]
line 436 - last_offer_id++;
fix - ++last_offer_id;
line 1165- _span[address(pay_gem)][address(buy_gem)]++;
fix- _span[address(pay_gem)][address(buy_gem)]++;
line 990 - uint256 old_top = 0;
fix - uint256 old_top;
line 85 - for (uint256 index = 0; index < topNOrders; index++) { if (index == 0) { lastAsk = bestAskID; lastBid = bestBidID;
fix - for (uint256 index; index < topNOrders; ++index) { if (index == 0) { lastAsk = bestAskID; lastBid = bestBidID;
line 165 - for (uint256 i = 0; i < route.length - 1; i++) { (address input, address output) = (route[i], route[i + 1]); uint256 _pay = i == 0
fix - for (uint256 i; i < route.length - 1; ++i) { (address input, address output) = (route[i], route[i + 1]); uint256 _pay = i == 0
line 227 - for (uint256 i = 0; i < route.length - 1; i++) { (address input, address output) = (route[i], route[i + 1]); uint256 _pay = i == 0
fix - for (uint256 i; i < route.length - 1; ++i) { (address input, address output) = (route[i], route[i + 1]); uint256 _pay = i == 0
line 82 - uint256 lastBid = 0;
fix - uint256 lastBid;
line 83 - uint256 lastAsk = 0;
fix - uint256 lastAsk;
line 168 - uint256 currentAmount = 0;
fix - uint256 currentAmount;
line 226 - uint256 currentAmount = 0;
fix - uint256 currentAmount;