GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Using `ERC721::_mint` is dangerous

Summary

The contract uses the _mint function to create new ERC721 tokens, which does not check if the recipient is capable of receiving ERC721 tokens.

Line: https://github.com/Cyfrin/2024-11-giving-thanks/blob/main/src/GivingThanks.sol#L26

_mint(msg.sender, tokenCounter);

Impact

  • Potential Token Loss:

    • If tokens are minted to a contract that does not implement the onERC721Received function, they could become permanently locked, leading to loss of tokens.

  • Compliance with ERC721 Standard:

    • The ERC721 standard recommends using _safeMint to ensure safe transfers to contracts.

Recommendations

Use _safeMint

_safeMint(msg.sender, tokenCounter);
Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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