Eggstravaganza

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

No Event Emission for Minting

Summary

The mintEgg()in the EggstravaganzaNFT contract successfully mints the token and updated the totalSupply. However, it does not emit a custom event indicating new egg has been minted. While the ERC721 Transfer event is automatically emitted by mint() function, having a dedicated EggMinted event improves a traceability, debugging, and off-chain analytics integration.

Vulnerability Details

Currently contract is solely relies on the ERC721 Transfer event emited during _mint()

_mint(to, tokenId)

This is technically sufficient for token tranfers, but in complex application like games, custom events provide a semantic layer of clarity. For example off-chain game servers or frontend UIs can listen specifically for EggMinted events to trigger animations, updates or user logs.

A suitable custom event would be

event EggMinted(address indexed to, uint256 indexed tokenId);

This should be emitted in the eggMint()

emit EggMinted(to, tokenId);

Impact

  • Medium Developer Experience Impact- Without a custom event, off-chain systems must parse generic Transfer events, which may not distinguish minting from transfers.

  • Reduced Observability

  • Potential Delays in Frontend/Backend Integration

Tools Used

  • Manual code review

  • Solidity recommendation on Events

  • Openzepplin ERC721 documentation

Recommendations

Add a custom Event to the contract

event EggMinted(address indexed to, uint256 indexed tokenId);

This should be emitted in the eggMint()

emit EggMinted(to, tokenId);
Updates

Lead Judging Commences

m3dython Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Event Emission

Standard practice for clarifying important contract behaviors

Support

FAQs

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