Eggstravaganza

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

Missing Approval Check in depositEggToVault (EggHuntGame)

Summary

The depositEggToVault function assumes the player has approved the game contract to transfer their NFT, but doesn’t verify this.

Vulnerability Details

  • If a user calls depositEggToVault without prior approval, the transferFrom call will revert, wasting gas.

  • No explicit error message guides users to approve first.

Impact

  • Poor UX and potential confusion, though no direct financial loss.

Tools Used

Manual review of ERC721 interaction patterns.

Recommendations

  • Add a require(nft.isApprovedForAll(msg.sender, address(this)) || nft.getApproved(tokenId) == address(this)) check.

  • Emit an event to inform users of required approvals.

Updates

Lead Judging Commences

m3dython Lead Judge 9 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!