Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is_creator_token to nft.trades, nft.mints #5836

Conversation

LB-thomasp
Copy link
Contributor

Create new spell for nft.creator_tokens to inspect contracts and flag if they implement the Creator Token Standards

Use data from nft.creator_tokens to add is_creator_token field to nft.mints and nft.trades for data analysis.

Thank you for contributing to Spellbook!

Thank you for taking the time to submit code in Spellbook. A few things to consider:

  • If you are a first-time contributor, please sign the CLA by copy & pasting exactly what the bot mentions in PR comment
  • Refer to docs section below to answer questions
  • Dune team will review submitted PRs as soon as possible

Best practices

To speed up your development process in PRs, keep these tips in mind:

  • Each commit to your feature branch will rerun CI tests (see example)
    • This includes all modified models on your branch
    • This includes all history of the data
  • Two tips for faster development iteration:
    • Ensure dbt is installed locally (refer to main readme) and run dbt compile
      • This will output raw SQL in target/ directory to copy/paste and run on Dune directly for initial query testing
    • Hardcode a WHERE filter for only ~7 days of history on large source tables, i.e. ethereum.transactions
      • This will speed up the CI tests and output results quicker -- whether that's an error or fully successful run
      • Once comfortable with small timeframe, remove filter and let full history run

Incremental model setup

  • Make sure your unique key columns are exactly the same in the model config block, schema yml file, and seed match columns (where applicable)
  • There cannot be nulls in the unique key columns
    • Be sure to double check key columns are correct or COALESCE() as needed on key column(s), otherwise the tests may fail on duplicates

🪄 Use the built CI tables for testing 🪄

Once CI completes, you can query the CI tables and errors in dune when it finishes running.

  • For example:
    • In the run initial models and test initial models, there will be a schema that looks like this: test_schema.git_dunesql_4da8bae_sudoswap_v2_base_pool_creations
    • This can be temporarily queried in Dune for ~24 hours

Leverage these tables to perform QA testing on Dune query editor -- or even full test dashboards!

Spellbook contribution docs

The docs directory has been implemented to answer as many questions as possible. Please take the time to reference each .md file within this directory to understand how to efficiently contribute & why the repo is designed as it is 🪄

Example questions to be answered:

Please navigate through the docs directory to find as much info as you can.

Note: happy to take PRs to improve the docs, let us know 🤝

Create new spell for nft.creator_tokens to inspect contracts and flag if they implement the Creator Token Standards

Use data from nft.creator_tokens to add is_creator_token field to nft.mints and nft.trades for data analysis.
Copy link

github-actions bot commented Apr 25, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@dune-eng
Copy link

Workflow run id 8840262151 approved.

@dune-eng
Copy link

Workflow run id 8840262329 approved.

@LB-thomasp
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@LB-thomasp
Copy link
Contributor Author

recheck

github-actions bot added a commit that referenced this pull request Apr 25, 2024
@dune-eng
Copy link

Workflow run id 8840390455 approved.

@dune-eng
Copy link

Workflow run id 8840390501 approved.

@dune-eng
Copy link

Workflow run id 8840455703 approved.

@dune-eng
Copy link

Workflow run id 8840455616 approved.

@dune-eng
Copy link

Workflow run id 8840568460 approved.

@dune-eng
Copy link

Workflow run id 8840568575 approved.

@dune-eng
Copy link

Workflow run id 8840664171 approved.

@dune-eng
Copy link

Workflow run id 8840664265 approved.

@dune-eng
Copy link

Workflow run id 8840817049 approved.

@dune-eng
Copy link

Workflow run id 8840817194 approved.

@dune-eng
Copy link

Workflow run id 8841178506 approved.

@dune-eng
Copy link

Workflow run id 8841178591 approved.

@dune-eng
Copy link

Workflow run id 8841280938 approved.

@dune-eng
Copy link

Workflow run id 8841281123 approved.

@dune-eng
Copy link

Workflow run id 8841332006 approved.

@dune-eng
Copy link

Workflow run id 8842781571 approved.

@dune-eng
Copy link

Workflow run id 8842781655 approved.

@0xRobin 0xRobin added WIP work in progress dbt: nft covers the NFT dbt subproject labels Apr 26, 2024
@0xRobin 0xRobin self-assigned this Apr 26, 2024
Copy link
Collaborator

@0xRobin 0xRobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuing from the Telegram conversation:

Rob: This seems to be a rather limitbreak specific extension (tracking usage of your erc721 implementation) and so it should not necessarily live within the nft.trades tables. A separate table with this info that can be joined to nft.trades on the smart contract address is the way to go here. I'll put my comments and guidance on the PR and we can continue there.

I suggest removing the integrations for :

  • macros/models/_sector/nft/enrich_nft_trades.sql
  • macros/models/_sector/nft/port_to_old_schema.sql
  • models/_sector/nft/mints/nft_mints.sql

And moving the creator_tokens models under a models/limitbreak/ directory and a limitbreak schema.
Thus models/_sector_nft/creator_tokens/nft_creator_tokens.sql -> models/limitbreak/limitbreak_creator_tokens.sql

The usage will then be a simple join:

select
  t.*
  l.is_creator_token
from
nft.trades t
left join limitbreak.creator_tokens l
  on t.blockchain = l.blockchain
  and t.nft_contract_address = l.address

which should be performant enough for user queries.

@dune-eng
Copy link

Workflow run id 8849815133 approved.

@dune-eng
Copy link

Workflow run id 8849815252 approved.

@dune-eng
Copy link

Workflow run id 8849831253 approved.

@dune-eng
Copy link

Workflow run id 8849831424 approved.

@LB-thomasp
Copy link
Contributor Author

Changes have been applied for the token_type strings and utilizing min_by instead of any_value.

With respect to where the creator_token data lives - the reasoning for placing it in the nft sector is that Creator Token Standards mark a fundamental shift in NFTs that, while initiated and developed by Limit Break, has gathered wide adoption and is an open standard that anyone can build on. In the past month, the share of new token contracts being creator tokens has risen from 0.1-0.2% to nearly 25% and share of total trading volume increasing to nearly 3%.

Contracts deployed by Creator Token support

image

Trading volume by Creator Token Support

image

Magic Eden and OpenSea have both integrated Creator Token Standards into their launchpad products with customizations allowed by the standard and while developing these data sets we have identified other entities have been building their products on the Creator Token Standards without us even being aware of it. Creator Token Standards are reaching a social consensus among businesses and individual developers as the best choice for launching a new token.

For those reasons we think it would make sense for data consumers to find the data in a location that is core to NFT's and not in a Limit Break specific sector.

With respect to the added column on nft.mints and nft.trades, it would certainly be simple to just join the creator_tokens table in other queries but we believe that data is important for the data consumers (the request from OpenSea that prompted the discussion in Telegram is why we create this PR) as it drives fundamental business decisions, having it accessible from nft.mints and nft.trades is convenient and more performant for the consumers while also reducing the load on the Dune platform.

@LB-thomasp LB-thomasp requested a review from 0xRobin May 6, 2024 16:40
@LB-thomasp
Copy link
Contributor Author

Bumping this up for review based on changes made and feedback provided here as well in the Telegram chat with OpenSea who is a significant consumer of the data being requested.

Copy link
Collaborator

@0xRobin 0xRobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this time we don't feel the integration with nft.trades is necessary.
That said the creator tokens tables are still valuable to materialize, I suggest following the previous feedback and we can look to finalize this PR.

I suggest removing the integrations for :

macros/models/_sector/nft/enrich_nft_trades.sql
macros/models/_sector/nft/port_to_old_schema.sql
models/_sector/nft/mints/nft_mints.sql
And moving the creator_tokens models under a models/limitbreak/ directory and a limitbreak schema.

@dune-eng
Copy link

dune-eng commented May 7, 2024

Workflow run id 8987614507 approved.

@dune-eng
Copy link

dune-eng commented May 7, 2024

Workflow run id 8987614745 approved.

@LB-thomasp LB-thomasp marked this pull request as ready for review May 7, 2024 17:26
@LB-thomasp
Copy link
Contributor Author

@0xRobin changes have been made per your suggestions, please review for finalization and merge so we can get these materialized for consumers.

@0xRobin 0xRobin added ready-for-merging and removed WIP work in progress labels May 8, 2024
Copy link
Member

@jeff-dude jeff-dude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code looks clean, thank you and welcome to spellbook 🔥

nice collab here to get it prepped for merge. i agree with the feedback, but we look forward to seeing the usage on these and how we can explore expanding nft spells in the near future

@jeff-dude jeff-dude merged commit 3f76208 into duneanalytics:main May 8, 2024
3 checks passed
Copy link

gitpoap-bot bot commented May 8, 2024

Congrats, your important contribution to this open-source project has earned you a GitPOAP!

GitPOAP: 2024 Dune Contributor:

GitPOAP: 2024 Dune Contributor GitPOAP Badge

Head to gitpoap.io & connect your GitHub account to mint!

Learn more about GitPOAPs here.

@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dbt: nft covers the NFT dbt subproject ready-for-merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants