Add ERC721 _safeMint and _safeTransferFrom
See original GitHub issueERC721
has safeTransferFrom
that forces a receiver contract to implement the onERC721Received
function. Just like our other ERC implementations, we should have an internal _safeTransferFrom
that does the same thing without requiring anything of msg.sender
. Note that we already have an internal _transferFrom
.
Similarly, we should add _safeMint
as an alternative to _mint
, with the addition that it also call onERC721Received
on a contract receiver.
Original issue:
ERC721
transfers are required to callonERC721Received
if the receiver is a contract. I don’t know if this is specified in the EIP, but we might have to do the same in_mint
. Currently we are not.This needs some discussion because it would be a breaking change. Additionally, it may not be obvious that
_mint
will call an external contract, and as always this opens up the possibility for reentrancy.Thanks @alcuadrado for pointing this out.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Hi guys @nventuro @balajipachai I think I understood what is required to fix this issue. What is the state of things? May I move forward?
Yes thanks for pointing it out!