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: 58/93
Findings: 2
Award: $45.84
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: defsec
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0x52, 0xDjango, 0xf15ers, 0xkatana, 0xliumin, AuditsAreUS, BowTiedWardens, CertoraInc, Cr4ckM3, Funen, GimelSec, Hawkeye, IllIllI, Kulk0, M0ndoHEHE, MaratCerby, Picodes, Ruhum, TerrierLover, TrungOre, VAD37, WatchPug, berndartmueller, broccolirob, catchup, cccz, cryptphi, csanuragjain, delfin454000, dirk_y, eccentricexit, ellahi, fatherOfBlocks, gzeon, hake, hansfriese, hickuphh3, horsefacts, hubble, hyh, ilan, joestakey, kebabsec, kenta, kenzo, leastwood, m9800, marximimus, minhquanym, oyc_109, p4st13r4, pauliax, pedroais, peritoflores, plotchy, rajatbeladiya, reassor, rfa, robee, rotcivegaf, samruna, shenwilly, shung, simon135, sorrynotsorry, sseefried, teddav, throttle, tintin, unforgiven, z3s
30.3871 USDC - $30.39
Issue: Missing require
message
Explanation: Require
message should be included to enable users to understand reason for failure
Recommended mitigation: Add a brief (<= 32 char) message to explain require
failure in each of the instances below
require(payable(msg.sender).send(address(this).balance));
require(address(msg.sender) != address(0));
require(payable(vault).send(_amount));
require(payable(vault).send(address(this).balance));
🌟 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
Issue: Variables should not be initialized to their default values Explanation: Initializing variables to their default values is unnecessary and costs gas
uint256 public numMinted = 0;
Change 'uint256 public numMinted;' to 'uint256 public numMinted;'
Issue: Require
message too long
Explanation: The require
message below can be shortened to 32 characters or fewer (as shown) to save gas
'Ether value sent is not sufficient'
Change message to Ether value sent is insufficient
Multiple issues
There are three opportunities to save gas in each of the two identical code blocks below:
!= 0
instead of > 0
because > 0
costs more gas and numWarriors
cannot be < zero (since it is a unit
)require
into two separate require
messages instead of using '&&'require
message to 32 characters or fewerrequire( numWarriors > 0 && numWarriors <= 20, 'You can summon no more than 20 Warriors at a time' );
Change to:
require(numWarriors != 0, 'Number of Warriors must exceed 0'); require(numWarriors <= 20, 'Summon <= 20 Warriors at a time');