Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: high
Invalid

No Check for Existing Token IDs

Summary

mintEgg in the EggstravaganzaNFT Contract doesn’t verify if tokenId already exists. ERC-721 requires unique token IDs, but if the caller (e.g., EggHuntGame) passes a duplicate tokenId, it will overwrite the existing token’s ownership via _mint.

Vulnerability Details

Impact

Loss of uniqueness

potential overwrite of existing NFTs.

Tools Used

Recommendations

Use _safeMint with an internal counter or check _exists(tokenId) before minting

function mintEgg(address to, uint256 tokenId) external returns (bool) {
require(msg.sender == gameContract, "Unauthorized minter");
require(!_exists(tokenId), "Token already minted");
_safeMint(to, tokenId);
totalSupply += 1;
return true;
}
Updates

Lead Judging Commences

m3dython Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!