Forgotten Runes Warrior Guild contest - samruna'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: 67/93

Findings: 2

Award: $45.73

🌟 Selected for report: 0

🚀 Solo Findings: 0

https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsMinter.sol#L287 Below calculation can be done in sinle line. Variables elapsed and steps can be removed.

Replace uint256 elapsed = block.timestamp - daStartTime; uint256 steps = elapsed / daDropInterval; uint256 stepDeduction = steps * dropPerStep;

With uint stepDeduction = ((block.timestamp - daStartTime) / daDropInterval) * dropPerStep

https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsGuild.sol#L99 Add a check if receipient is not same as msg.sender(). Although only owner can call this function, if attacker can get hold of contract, they can mint all token and trasnfer to seld.

https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsGuild.sol#L140 Define a immutable constant MAX_WARRIORS = 20 and use it in below check. Also use revert() function instead of require to save gas fees. require( numWarriors > 0 && numWarriors <= 20, 'You can summon no more than 20 Warriors at a time' );

https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsMinter.sol#L136 https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsMinter.sol#L177 https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsMinter.sol#L207 https://github.com/code-423n4/2022-05-runes/blob/main/contracts/ForgottenRunesWarriorsMinter.sol#L234 Instead of doing require(a>b,"..."), make use of revert with custom error. With Solidity 0.8 the revert() function is better in terms of gas fee usage. It'll revert the transaction and refund any unused gas fees.

Replace require(numSold < maxDaSupply, 'Auction sold out'); with If (numSold < maxDaSupply) error AuctionSoldOut();

Replace this for the entire contract.

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