Eggstravaganza

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

approve() doesn't work to approve EggHuntGame to transfer the EggNft to the EggVault for depositing

Summary

Players must approve EggHuntGame contract to perform a transferFrom operation in order to move the EggNFT from the Owner to the EggVault for depositing.
When calling approve(contract, tokenId) externally from its wallet the player gives permission for only that tokenId, but only for the external caller**** (ex. wallet)

Vulnerability Details

Players can not transfer their EggNfts to the EggVault contract for being deposited

Impact

When the EggHuntContract calls transferFrom(), it's trying to act as an EOA/wallet, but the NFT contract doesn't see it as approved for that nft, reverting with ERC721InvalidApprover().

Tools Used

Forge Test, Remix, Manual Review

Recommendations

Use setApprovalForAll() instead of approve()

```setApprovalForAll(contract, true)`

``This makes any call from the EggHuntGame contract to transferFrom() go through, because now the contract is allowed to act in the nft owner's name, for all tokens .

Updates

Lead Judging Commences

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

Support

FAQs

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