ERC721 safeTransferFrom doesn't error when transferred to a contract not implementing IERC721Receiver


continuing the above query I only get the issue while testing on testnet why is that ?

1 Like

Hi @viraj124,

I am sorry you had this issue. Unfortunately, I wasn’t able to reproduce using the following simple example.


// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract GameItem is ERC721 {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() public ERC721("GameItem", "ITM") {}

    function awardItem(address player, string memory tokenURI)
        returns (uint256)

        uint256 newItemId = _tokenIds.current();
        _mint(player, newItemId);
        _setTokenURI(newItemId, tokenURI);

        return newItemId;


// contracts/MyContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract MyContract {

Manual Test

I tested manually using truffle develop

truffle(develop)> gameItem = await
truffle(develop)> myContract = await
truffle(develop)> await gameItem.awardItem(accounts[0], "")
{ tx:
truffle(develop)> await gameItem.ownerOf(1)
truffle(develop)> await gameItem.safeTransferFrom(accounts[0], myContract.address, 1)
{ Error: Returned error: VM Exception while processing transaction: revert ERC721: transfer to non ERC721Receiver implementer -- Reason given: ERC721: transfer to non ERC721Receiver implementer.

Hi @viraj124,

Are you still getting this issue?

resolved now, some issue on the contract side

1 Like