IERC721.balanceOf execution reverted error

Hey everyone,

since yesterday I learn to made a simple smart contract that can give me the balance of the msg.sender for an IERC721 contract (0x60E4d786628Fea6478F785A6d7e704777c86a7c6) .

But I got an 3200 error with this following message: execution reverted, only on "list()" external function, "setGreeting()" and "greet()" work like a charm.

More detail on the error from rpc answer:

{
  "jsonrpc": "2.0",
  "id": 6,
  "error": {
    "code": -32000,
    "message": "execution reverted"
  }
}

I don't understand why I go this, here is my following contract code:

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

contract Greeter {
    string private greeting;
    IERC721Enumerable[] private NFTContracts;

    struct Test {
        uint balance;
        address contract_address;
    }

    event updatingGreeting(string greeting);

    constructor(string memory _greeting, address[] memory _contracts) {
        console.log("Deploying a Greeter with greeting:", _greeting);
        greeting = _greeting;

        for (uint i = 0; i < _contracts.length; i++) {
            NFTContracts.push(IERC721Enumerable(_contracts[i]));
        }
    }

    function greet() public view returns (string memory) {
        return greeting;
    }

    function setGreeting(string memory _greeting) public {
        console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
        greeting = _greeting;

        emit updatingGreeting(greeting);
    }

    function list() external view returns (uint256) {
        return IERC721Enumerable(0x60E4d786628Fea6478F785A6d7e704777c86a7c6).balanceOf(msg.sender);
    }
}

Here how I call it at my ReactJS app (two ways):

await greeterContract.methods.list().call();
await greeterContract.methods.list().send({
  from: connectedAccount
});

Can you help me? Thank you in advance and happy coding to all :slight_smile:

What network are you testing this with? 0x60E4d786628Fea6478F785A6d7e704777c86a7c6 appears to be an ERC721 on Ethereum mainnet.

I get it ! I need to made a fork of mainnet for testing it, because the contract is on different network that it ?

Yes that should be it!