Forgotten Runes Warrior Guild contest - 0xc0ffEE's results

16,000 Warrior NFTs sold in a phased Dutch Auction.

General Information

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

Forgotten Runes

Findings Distribution

Researcher Performance

Rank: 85/93

Findings: 1

Award: $15.49

🌟 Selected for report: 0

🚀 Solo Findings: 0

  1. Should implement a function that used for minting an amount of tokens. This could save gas by reducing the times that ForgottenRunesWarriorMinter makes external call to ForgottenRunesWarriorGuild during DA phase and Public phase The function could likely be:
function mint(address recipient,uint256 amount) external nonReentrant { require(numMinted + amount <= MAX_WARRIORS); require(_msgSender() == minter); for(unt256 i = 0; i < amount ; ++i){ _safeMint(recipient, numMinted + i); } numMinted += amount; }

ForgottenRunesWarriorMinter.sol#[L162:L164] and ForgottenRunesWarriorMinter.sol#[L220:L222] could be replaced by warriors.mint(msg.sender, numWarriors)

  1. ForgottenRunesWarriorGuild.sol#L24 No need assignment of numMinted = 0

  2. Recommendation: Manage ForgottenRunesWarriorMinter.sol#L73 as a set data structure to save gas for both bidSummon and issueRefund execution, i.e using EnumerableSet library from OpenZeppelin, such that: using Enumberable.AddressSet daMinters instead of address[] daMinters By using OpenZeppelin EnumerableSet, ForgottenRunesWarriorMinter.sol#L151 could be replaced by daMinters.add(msg.sender). This could costs more gas for the first time that user execute bidSummon(uint256) than using push(msg.sender) but the next times that user executes bidSummon(uin256), the gas cost is lower because the address is already in the set. Similarly, issueRefunds(uint256,uint256) will cost lower by just process an address just once because this decreases the number of operations with storage. Moreover, consider removing the address processed from set to release storage and get negative gas cost if there is no need for retrieving daMinters.

  3. Underflow condition not met at ForgottenRunesWarriorMinter.sol#L288 and ForgottenRunesWarriorMinter.sol#L296, so consider using unchecked for gas saving

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter