Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Only One NFT Can be Minted

Summary

During the code review, it was found that, in the Huff version, it is only possible to mint one NFT. After minting the first NFT, all calls to mintHorse() will revert with the error ALREADY_MINTED.

Vulnerability Details

I didn't have time to properly check the exact reason behind this flaw. However, it looks like there's an error with how TOTAL_SUPPLY.

Impact

The whole logic of the NFT collection is useless if only one horse NFT can be minted.

Tools Used

Foundry.

Proof of Concept

Add the following test function in the Base_Test.t.sol file and run it by executing forge test --mt testMintTwice -vvvv.

// @audit Huff version cannot mint twice!
function testMintTwice() public {
assertEq(horseStore.balanceOf(user), 0);
vm.prank(user);
horseStore.mintHorse();
assertEq(horseStore.balanceOf(user), 1);
vm.prank(user2);
horseStore.mintHorse();
assertEq(horseStore.balanceOf(user2), 1);
}

See that the execution of the Huff test reverts with the error ALREADY_MINTED, while the Solidity version works fine.

Recommendations

It is recommended to review the minting logic of the Huff version and fix the mentioned limitation.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.