iotex-analytics icon indicating copy to clipboard operation
iotex-analytics copied to clipboard

Add NFT Indexing

Open CoderZhi opened this issue 4 years ago • 9 comments

Given NFT contract addresses, indexing the owners of all tokens by tracking event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); If from is 0x0, this is a new mint token. Example contract on testnet: io1kep76e8z6xlcn6hr97wa7ykjnhfvz5uc3nlt5g Example action with new mint token on testnet: https://testnet.iotexscan.io/action/ea0e5018a744aabd7c902500f845ccaef4bf486e2e93884e60143d9420394e20

    "topics": [
      "ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "0000000000000000000000000000000000000000000000000000000000000000",
      "00000000000000000000000091414195231b0df10eb3807a8f2b52d6ddfed0a3",
      "0000000000000000000000000000000000000000000000000000000000000001"
    ],

ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef is the "Transfer" topic, 0000000000000000000000000000000000000000000000000000000000000000 is "from", 00000000000000000000000091414195231b0df10eb3807a8f2b52d6ddfed0a3 is "to", and 0000000000000000000000000000000000000000000000000000000000000001 is token id.

CoderZhi avatar Jun 17 '20 05:06 CoderZhi

@lzxm160 @Madongming Either one of you who have time, please claim this issue and work on it.

CoderZhi avatar Jun 17 '20 05:06 CoderZhi

@lzxm160 @Madongming Either one of you who have time, please claim this issue and work on it.

sure

coderbradlee avatar Jun 17 '20 06:06 coderbradlee

I checked code,I think this NFT is already supported,instead of NFT,we use XRC721,we check four func to make sure if it's XRC721,https://github.com/iotexproject/iotex-analytics/blob/master/indexprotocol/actions/xrc20.go#L321-L339 we record all the holders in the table xrc721_holders,tokenHolderAddresses api could get those holders from frontend

coderbradlee avatar Jun 18 '20 03:06 coderbradlee

It's going to add api to insert contract address that is not xrc721 directly to table xrc721_holders,so that can record other kinds of token holder's info

coderbradlee avatar Jul 02 '20 13:07 coderbradlee

#263 I tested the new XRC721 API, but couldn't get the data.

uu-z avatar Jul 22 '20 04:07 uu-z

#263 I tested the new XRC721 API, but couldn't get the data.

I think there's no XRC721's data in mysql

coderbradlee avatar Jul 27 '20 04:07 coderbradlee

Here's an XRC721 contract with some actions.
https://iotexscan.io/address/io1xpvzahnl4h46f9ea6u03ec2hkusrzu020th8xx

uu-z avatar Jul 27 '20 05:07 uu-z

Here's an XRC721 contract with some actions. https://iotexscan.io/address/io1xpvzahnl4h46f9ea6u03ec2hkusrzu020th8xx

Analytics will check the following func to make sure it's xrc721: totalSupply,balanceOf,approve,ownerOf can you check the contract source code to make sure it's xrc721?

coderbradlee avatar Jul 27 '20 06:07 coderbradlee

Here's an XRC721 contract with some actions. https://iotexscan.io/address/io1xpvzahnl4h46f9ea6u03ec2hkusrzu020th8xx

Analytics will check the following func to make sure it's xrc721: totalSupply,balanceOf,approve,ownerOf can you check the contract source code to make sure it's xrc721?

I checked the ABI for the contract, and all four func above are included.

uu-z avatar Jul 28 '20 07:07 uu-z