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: 84/93
Findings: 1
Award: $15.49
🌟 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.491 USDC - $15.49
uint256 public numMinted = 0;
change to
uint256 public numMinted;
https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsGuild.sol#L24
for (uint256 i = 0; i < numWarriors; i++) { _mint(msg.sender); }
change to
for (uint256 i; i < numWarriors; i++) { _mint(msg.sender); }
for (uint256 i = 0; i < numWarriors; i++) { _mint(msg.sender); }
change to
for (uint256 i; i < numWarriors;i++) { _mint(msg.sender); }
for (uint256 i = 0; i < numWarriors; i++) { _mint(msg.sender); }
change to
for (uint256 i = 0; i < numWarriors;) { _mint(msg.sender); unchecked{ ++i; } }
for (uint256 i = 0; i < numWarriors; i++) { _mint(msg.sender); }
change to
for (uint256 i = 0; i < numWarriors;) { _mint(msg.sender); unchecked{ ++i; } }
for (uint256 i = startIdx; i < endIdx + 1; i++) { _refundAddress(daMinters[i]); }
change to
for (uint256 i = startIdx; i < endIdx + 1;) { _refundAddress(daMinters[i]); unchecked{ ++i; } }
function currentDaPrice() public view returns (uint256) { if (!daStarted()) { return startPrice; } if (block.timestamp >= daStartTime + daPriceCurveLength) { // end of the curve return lowestPrice; } uint256 dropPerStep = (startPrice - lowestPrice) / (daPriceCurveLength / daDropInterval); uint256 elapsed = block.timestamp - daStartTime; uint256 steps = elapsed / daDropInterval; uint256 stepDeduction = steps * dropPerStep; // don't go negative in the next step if (stepDeduction > startPrice) { return lowestPrice; } uint256 currentPrice = startPrice - stepDeduction; return currentPrice > lowestPrice ? currentPrice : lowestPrice; }
change to:
function currentDaPrice() public view returns (uint256) { uint256 memory _startPrice = startPrice; uint256 memory _lowestPrice = lowestPrice; uint256 memory _daStartTime = daStartTime; uint256 memory _daPriceCurveLength = daPriceCurveLength; uint256 memory _daDropInterval = daDropInterval; if (!daStarted()) { return _startPrice; } if (block.timestamp >= _daStartTime + _daPriceCurveLength) { // end of the curve return _lowestPrice; } uint256 dropPerStep = (_startPrice - _lowestPrice) / (_daPriceCurveLength / _daDropInterval); uint256 elapsed = block.timestamp - _daStartTime; uint256 steps = elapsed / _daDropInterval; uint256 stepDeduction = steps * dropPerStep; // don't go negative in the next step if (stepDeduction > _startPrice) { return _lowestPrice; } uint256 currentPrice = _startPrice - stepDeduction; return currentPrice > _lowestPrice ? currentPrice : _lowestPrice; }