Platform: Code4rena
Start Date: 03/05/2022
Pot Size: $30,000 USDC
Total HM: 6
Participants: 93
Period: 3 days
Judge: gzeon
Id: 118
League: ETH
Rank: 93/93
Findings: 1
Award: $15.45
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: BowTiedWardens
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xProf, 0xc0ffEE, 0xf15ers, 0xkatana, 0xliumin, ACai, AlleyCat, CertoraInc, Cityscape, Cr4ckM3, DavidGialdi, Dinddle, FSchmoede, Funen, GimelSec, Hawkeye, IllIllI, Kulk0, M0ndoHEHE, MaratCerby, MiloTruck, Picodes, RoiEvenHaim, Tadashi, TerrierLover, TrungOre, VAD37, WatchPug, antonttc, catchup, defsec, delfin454000, dirk_y, eccentricexit, ellahi, fatherOfBlocks, gzeon, hake, hansfriese, hickuphh3, horsefacts, ilan, joestakey, kebabsec, kenta, kenzo, marximimus, minhquanym, noobie, oyc_109, p4st13r4, pauliax, rajatbeladiya, reassor, rfa, robee, rotcivegaf, saian, samruna, shenwilly, shung, simon135, slywaters, sorrynotsorry, throttle, unforgiven, z3s
15.4498 USDC - $15.45
Hello, You can save some gas in the code by using unchecked ( because the contract is written in solidity 0.8.0 automatically there is a use in safe math and its cost more gas then using unchecked). You can use my suggestion in lines: 152 - because no one has 2^256 ether to cause an overflow. 153 - the max amount of warriors is much less then 2^256 and there is a require for that in lines 136, 137. 154 - same as 153 there is a limit for the amount of warriors can be sold. 162 - I think its chipper to make an unchecked function for increase by 1 and then call it instead of using ++. 193 - same as 162. 219 - same as 153 there is a limit for the amount of warriors can be sold. 220 - I think its chipper to make an unchecked function for increase by 1 and then call it instead of using ++. 248 - same as 153 there is a limit for the amount of warriors can be claimed. 259 - I think its chipper to make an unchecked function for increase by 1 and then call it instead of using ++. 284 - you can use unchecked because those numbers are numbers you know and they are const so the result will not cause an overflow or underflow. 288 - same as 284. 289 - same as 284. 355 - same as 162 379 - same as 152 because no one can pay 2^256 so no one will be refund by 2^256. 389 - "finalprice" is a const and danuminted has a limit so it will no overflow or underflow. 390 - same as 379. Thanks.