OpenRarity / open-rarity

Reference implementation of the OpenRarity protocol with Python.
Apache License 2.0
218 stars 47 forks source link

Support for collections that skip token ids #68

Open clrke opened 1 year ago

clrke commented 1 year ago

Describe the bug Some NFT collections have a gimmick of skipping token ids like https://opensea.io/collection/mutant-ape-yacht-club. As of the time of posting, there are 19,425 Mutant Apes minted, some have token ids upwards of 10k and even 20k because those have been minted and assigned a token id in an unconventional way.

open_rarity.resolver.opensea_api_helpers.open_rarity.resolver.opensea_api_helpers.get_token_ids assumes that the collection's token ids are incremental from 0 to 19,424.

Information

Collection link/name: https://opensea.io/collection/mutant-ape-yacht-club Contract standard: ERC721Enumerable Chain: Ethereum Mainnet

To Reproduce Steps to reproduce the behavior: Run python -m scripts.score_real_collections mutant-ape-yacht-club

Expected behavior It should have all token ids in the generated json file.

Environment

impreso commented 1 year ago

Thanks for the report. One way to deal with this is to setup the collection supply variable explicitly to the desired supply or implement smart logic that skips "empty" result during the asset resolution.

To unblock you , i recommend to change the parameter directly in cod, while we implementing "smart" skip logic for such use-cases. https://github.com/OpenRarity/open-rarity/blob/main/open_rarity/resolver/opensea_api_helpers.py#L310 - the place where you can override total supply to desired quantity while we are working on the fix.