Platform: Code4rena
Start Date: 12/12/2022
Pot Size: $36,500 USDC
Total HM: 8
Participants: 103
Period: 7 days
Judge: berndartmueller
Id: 193
League: ETH
Rank: 88/103
Findings: 1
Award: $14.83
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Rolezn
Also found by: 0x1f8b, 0xAgro, 0xSmartContract, 0xab00, 0xhacksmithh, Aymen0909, Bnke0x0, Breeje, Diana, HardlyCodeMan, IllIllI, JC, JrNet, Madalad, NoamYakov, RaymondFam, ReyAdmirado, SleepingBugs, UdarTeam, c3phas, carlitox477, cryptonue, gz627, lukris02, millersplanet, oyc_109, pavankv, ret2basic, saneryee, tnevler
14.833 USDC - $14.83
Context:
for (uint256 i = 0; i < tokenIds.length; i++) {
L238for (uint256 i = 0; i < tokenIds.length; i++) {
L258for (uint256 i = 0; i < tokenIds.length; i++) {
L468for (uint256 j = 0; j < 32; j++) {
L13for (uint256 j = 0; j < charCount; j++) {
L22for (uint256 i = 32; i < 64; i++) {
L33for (uint256 i = 0; i < charCount; i++) {
L39Description:
This can save 30-40 gas per loop iteration.
Recommendation:
Example how to fix. Change:
for (uint256 i = 0; i < orders.length; ++i) { // Do the thing }
To:
for (uint256 i = 0; i < orders.length;) { // Do the thing unchecked { ++i; } }
Context:
uint256 refundAmount = maxInputAmount - inputAmount;
L168Description:
Some gas can be saved by using an unchecked {} block if an underflow isn't possible because of a previous require() or if-statement.
#0 - c4-judge
2023-01-14T17:15:52Z
berndartmueller marked the issue as grade-b