Using ERC721::_mint()
can mint ERC721 tokens to addresses which don't support ERC721 tokens.
The ERC721 _mint
function directly assigns tokens without verifying whether the recipient address is a contract or if it supports ERC721 tokens. If tokens are minted to a contract address that does not implement the ERC721Receiver interface, these tokens may be effectively “locked,” as the recipient contract will not be able to interact with them. Using _safeMint
provides an additional check to ensure compatibility with the ERC721 standard, verifying that the recipient is capable of receiving ERC721 tokens.
Minting tokens with _mint
instead of _safeMint
may lead to tokens being permanently locked in addresses that cannot handle ERC721 tokens. This can result in token loss for users, reducing the contract's reliability and the usability of its tokens.
Manual Code Review
Aderyn
Use _safeMint()
instead of _mint()
for ERC721.
Replace _mint
with _safeMint
: Update the minting function to use _safeMint
, which verifies that the recipient can handle ERC721 tokens:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.