kodadot / stick

GraphQL service for Uniques and Assets on Asset Hubs
MIT License
4 stars 11 forks source link

wrong `supply` on TokenEntity #169

Open roiLeo opened 10 months ago

roiLeo commented 10 months ago

user:

collection:

vikiival commented 10 months ago

@daiagi can you please take a look?

daiagi commented 10 months ago

not really wrong supply, but missing TokenEntity the collection /ahp/collection/u-8 contains 300 nfts

100 that looks like this image

and 200 that look like this image

the tokenEntity of the second group is missing image image image

@roiLeo @vikiival

roiLeo commented 10 months ago

the tokenEntity of the second group is missing

Maybe something wrong with tokenEntities query from resolver

daiagi commented 10 months ago

i think there is some bug where the nfts don't get assigned to their token for some reason

anyhow, checking

daiagi commented 10 months ago

this is most likely the reason:

image

daiagi commented 10 months ago

or here we also have this on u-8-199 2 events, mint and list image

mint is without metadata, but list have metadata (came from where??)

and sure enough, no tokenEntity (because mint was without metadata and setMetadata never called)

but it doesn't make sense to create tokenEntity on LIST events, does it?!

i guess the question is where the metadata came from ?

18:59:48 INFO  squid:log ⏳ [MINT] 4037386
18:59:48 DEBUG squid:log [MINT] {
                           "caller": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "blockNumber": "4037386",
                           "timestamp": "2023-06-28T10:12:42.696Z",
                           "collectionId": "u-8",
                           "owner": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "sn": "199"
                         }
18:59:48 DEBUG squid:log [TokenEntity] {
                           "mintHandler": "Handle mint for NFT u-8-199"
                         }
18:59:48 WARN  squid:log ⚠️ [TokenEntity] MISSING NFT MEDIA u-8-199
18:59:48 DEBUG squid:log [TokenEntity] {
                           "terminateEarly": "nftMedia undefined"
                         }
18:59:48 INFO  squid:log 💚 [MINT] u-8-199
18:59:48 DEBUG sqd:processor:mapping end
                                     blockHeight: 4037386
                                     blockHash: 0x1ca2dbba2777e03933201faec08bf4136147ba42ab04c3b5cdfc4b64f1a28acf
                                     hook: event
                                     eventName: Uniques.Issued
                                     eventId: 0004037386-000999-1ca2d
18:59:48 DEBUG sqd:processor:mapping begin
                                     blockHeight: 4037386
                                     blockHash: 0x1ca2dbba2777e03933201faec08bf4136147ba42ab04c3b5cdfc4b64f1a28acf
                                     hook: event
                                     eventName: Uniques.ItemPriceSet
                                     eventId: 0004037386-001001-1ca2d
18:59:48 INFO  squid:log ⏳ [LIST] 4037386
18:59:48 DEBUG squid:log [LIST] {
                           "caller": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "blockNumber": "4037386",
                           "timestamp": "2023-06-28T10:12:42.696Z",
                           "collectionId": "u-8",
                           "sn": "199",
                           "price": "9000000000"
                         }
18:59:48 INFO  squid:log 💚 [LIST] u-8-199 by 15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW} for 9000000000
18:59:48 DEBUG sqd:processor:mapping end
                                     blockHeight: 4037386
                                     blockHash: 0x1ca2dbba2777e03933201faec08bf4136147ba42ab04c3b5cdfc4b64f1a28acf
                                     hook: event
                                     eventName: Uniques.ItemPriceSet
                                     eventId: 0004037386-001001-1ca2d
18:59:48 DEBUG sqd:processor:mapping begin
                                     blockHeight: 4037829
                                     blockHash: 0x71b493221a8e4b5fb3789f3b7ac080a804501d5e515717941218c3bf206c2880
                                     hook: event
                                     eventName: Uniques.CollectionMetadataSet
                                     eventId: 0004037829-000004-71b49
18:59:48 DEBUG squid:log [METADATA] {
                           "caller": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "blockNumber": "4037829",
                           "timestamp": "2023-06-28T12:22:00.244Z",
                           "collectionId": "u-8",
                           "metadata": "ipfs://ipfs/bafkreiewudhu24qo5oerbizhcybhwe25f5getbu5xydtpjuvumpafhivpm"
                         }
daiagi commented 10 months ago

@roiLeo collectionMetadataSet?

I think that's it, all these nfts show the fallback collection metadata

image

roiLeo commented 10 months ago

I think that's it, all these nfts show the fallback collection metadata

https://github.com/kodadot/stick/blob/6292f4e0ba9bcabbac0fb300cd6ccb02880b0128/src/mappings/uniques/mint.ts#L39?

daiagi commented 10 months ago

I think that's it, all these nfts show the fallback collection metadata

https://github.com/kodadot/stick/blob/6292f4e0ba9bcabbac0fb300cd6ccb02880b0128/src/mappings/uniques/mint.ts#L39 ?

damn. you're right @vikiival to the rescue?

daiagi commented 10 months ago

ok i think i figured it out the metadata on the collection is being set AFTER 200 nfts are minted need to handle this situation in setMetadata mapping

something like

  1. find all the nft's in the collection that don't have token (or no metadata?)
  2. if any exists, create a new token using the collection metadata
  3. assign all of them to that token
 [MINT] 4037386
01:27:20 DEBUG squid:log [MINT] {
                           "caller": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "blockNumber": "4037386",
                           "timestamp": "2023-06-28T10:12:42.696Z",
                           "collectionId": "u-8",
                           "owner": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "sn": "199"
                         }
01:27:20 DEBUG squid:log [MINT] {
                           "collectionId": "u-8",
                           "nftId": "u-8-199",
                           "timestamp": "2023-06-28T10:12:42.696Z"
                         }
01:27:20 DEBUG squid:log [TokenEntity] {
                           "mintHandler": "Handle mint for NFT u-8-199"
                         }
01:27:20 WARN  squid:log ⚠️ [TokenEntity] MISSING NFT MEDIA u-8-199
01:27:20 INFO  squid:log 💚 [MINT] u-8-199
01:27:20 DEBUG sqd:processor:mapping end
                                     blockHeight: 4037386
                                     blockHash: 0x1ca2dbba2777e03933201faec08bf4136147ba42ab04c3b5cdfc4b64f1a28acf
                                     hook: event
                                     eventName: Uniques.Issued
                                     eventId: 0004037386-000999-1ca2d
01:27:20 DEBUG sqd:processor:mapping begin
                                     blockHeight: 4037386
                                     blockHash: 0x1ca2dbba2777e03933201faec08bf4136147ba42ab04c3b5cdfc4b64f1a28acf
                                     hook: event
                                     eventName: Uniques.ItemPriceSet
                                     eventId: 0004037386-001001-1ca2d
01:27:20 INFO  squid:log ⏳ [LIST] 4037386
01:27:20 DEBUG squid:log [LIST] {
                           "caller": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "blockNumber": "4037386",
                           "timestamp": "2023-06-28T10:12:42.696Z",
                           "collectionId": "u-8",
                           "sn": "199",
                           "price": "9000000000"
                         }
01:27:20 INFO  squid:log 💚 [LIST] u-8-199 by 15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW} for 9000000000
01:27:20 DEBUG sqd:processor:mapping end
                                     blockHeight: 4037386
                                     blockHash: 0x1ca2dbba2777e03933201faec08bf4136147ba42ab04c3b5cdfc4b64f1a28acf
                                     hook: event
                                     eventName: Uniques.ItemPriceSet
                                     eventId: 0004037386-001001-1ca2d
01:27:20 DEBUG sqd:processor:mapping begin
                                     blockHeight: 4037829
                                     blockHash: 0x71b493221a8e4b5fb3789f3b7ac080a804501d5e515717941218c3bf206c2880
                                     hook: event
                                     eventName: Uniques.CollectionMetadataSet
                                     eventId: 0004037829-000004-71b49
01:27:20 DEBUG squid:log [METADATA] {
                           "caller": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW",
                           "blockNumber": "4037829",
                           "timestamp": "2023-06-28T12:22:00.244Z",
                           "collectionId": "u-8",
                           "metadata": "ipfs://ipfs/bafkreiewudhu24qo5oerbizhcybhwe25f5getbu5xydtpjuvumpafhivpm"
                         }
01:27:20 DEBUG squid:log [METADATA] {
                           "collectionId": "u-8",
                           "metadata": "ipfs://ipfs/bafkreiewudhu24qo5oerbizhcybhwe25f5getbu5xydtpjuvumpafhivpm",
                           "timestamp": "2023-06-28T12:22:00.244Z"
                         }