Amxx / subgraphs

53 stars 22 forks source link

Subgraph doesn't work for some ERC721 contracts #3

Closed iammxt closed 3 years ago

iammxt commented 3 years ago

I was trying to query the EIP721 subgraph on The Graph playground for all the NFTs managed by a contract, such as 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d. I did some googling and following this comment, I came up with this query:

{
  tokenRegistry(id: "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") {
    tokens {
      identifier
      owner {
        id
      }
    }
  }
}

However I got a null result:

{
  "data": {
    "tokenRegistry": null
  }
}

The same query with some different contract address such as this works. So I was wondering whether there was some contract allowlist somewhere, but the closest I could find in the code base was this https://github.com/Amxx/subgraphs/blob/master/subgraphs/common/config/eip721.json, which doesn't look to me like it's filtering out any contract address.

@Amxx could you please advise if I am missing something from the query? Also, is this subgraph supposed to work for all ERC721 contracts on Ethereum or whether there's an allowlist somewhere? Thank you.

Amxx commented 3 years ago

Hello

This subgraph does index ALL ERC721 that have at least one token. It seems that you are querying a checksummed address. Subgraph IDs are lowercase only hex strings. Try running the same query with a lowercase address.

Amxx commented 3 years ago

I just noted you are looking for CryptoKitties. The crypto kitty registry is NOT an ERC721, and is therefore not indexed by this subgraph.

You'll find it indexed in https://thegraph.com/legacy-explorer/subgraph/amxx/non-standard-nfts, which might me slightly different (I've not updated it in a long time)

iammxt commented 3 years ago

Thanks for the quick answers! So the EIP721 subgraph does indexes all ERC721 tokens. I'd assume the same about the EIP 1155 subgraph. Also, thanks for pointing out the subgraph to use for non-standard NFTs.