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

Create airdrop.claims with 38 airdrops #2979

Merged
merged 70 commits into from
May 25, 2023

Conversation

hildobby
Copy link
Collaborator

@hildobby hildobby commented Mar 18, 2023

Brief comments on the purpose of your changes:

Here I created a new sector airdrop since without standardisation, things are starting to get messy in spellbook. The goal is to have 3 main tables at the end (airdrop.claims, airdrop.eligible, airdrop.total_stats):

  • airdrop.claims is what this PR creates, its onchain claims of airdrops
  • airdrop.eligible would have the eligible address lists and since the breakdown is different per airdrop, this would only contain the address and total its eligible for with the breakdown still in the sub models.
  • airdrop.total_stats would have 1 line per airdrop and consist of total claimable, % claimed, etc

All those depend on their blockchain dependant sub-abstractions (ie airdrop.claims depends on airdrop_ethereum.claims and airdrop_optimism.claims) in this PR. And those depend on the protocol specific tables (ie looksrare_ethereum.airdrop_claims).

This PR creates airdrop.claims with those airdrops included so far:

  • Ampleforth (FORTH)
  • ApeCoin (APE)
  • BendDAO (BEND)
  • Blur (BLUR airdrop 1)
  • Cow Protocol (COW)
  • DappRadar (RADAR)
  • dYdX (DYDX)
  • ENS (ENS)
  • Forta Network (FORT)
  • Galxe (GAL)
  • Gas DAO (GAS)
  • Gitcoin (GTC)
  • Hop Protocol (HOP)
  • LooksRare (LOOKS)
  • 1inch (1INCH)
  • Paladin (PAL)
  • Paraswap (PSP)
  • Ribbon (RBN)
  • Safe (SAFE)
  • Sudoswap (SUDO)
  • Tornado Cash (TORN)
  • Uniswap (UNI)
  • X2Y2 (X2Y2)
  • Optimism (OP airdrop 1)
  • Velodrome (VELO)

General checks:

  • I tested the query on dune.com after compiling the model with dbt compile (compiled queries are written to the target directory)
  • I used "refs" to reference other models in this repo and "sources" to reference raw or decoded tables
  • if adding a new model, I added a test
  • the filename is unique and ends with .sql
  • each sql file is a select statement and has only one view, table or function defined
  • column names are lowercase_snake_cased
  • if adding a new model, I edited the dbt project YAML file with new directory path for both models and seeds (if applicable)
  • if wanting to expose a model in the UI (Dune data explorer), I added a post-hook in the JINJA config to add metadata (blockchains, sector/project, name and contributor Dune usernames)

Pricing checks:

  • coin_id represents the ID of the coin on coinpaprika.com
  • all the coins are active on coinpaprika.com (please remove inactive ones)

Join logic:

  • if joining to base table (i.e. ethereum transactions or traces), I looked to make it an inner join if possible

Incremental logic:

  • I used is_incremental & not is_incremental jinja block filters on both base tables and decoded tables
    • where block_time >= date_trunc("day", now() - interval '1 week')
  • if joining to base table (i.e. ethereum transactions or traces), I applied join condition where block_time >= date_trunc("day", now() - interval '1 week')
  • if joining to prices view, I applied join condition where minute >= date_trunc("day", now() - interval '1 week')

@hildobby hildobby added WIP work in progress do not merge labels Mar 20, 2023
@hildobby hildobby changed the title Create airdrop_claims.all with 25 airdrops Create airdrop.claims with 25+ airdrops Mar 20, 2023
@hildobby hildobby removed do not merge WIP work in progress labels Mar 20, 2023
@hildobby hildobby changed the title Create airdrop.claims with 25+ airdrops Create airdrop.claims with 25 airdrops Mar 20, 2023
@hildobby hildobby added the ready-for-review this PR development is complete, please review label Mar 20, 2023
@Hosuke
Copy link
Collaborator

Hosuke commented Mar 21, 2023

Since this is a new sector, maybe @augustog can take a look.

, account AS recipient
, contract_address
, evt_tx_hash AS tx_hash
, amount/POWER(10, 18) AS quantity
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to cast any of these as double for dunesql future-proofing? Many had decimal amounts (i.e. 778.79)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call! All of the quantity rows were replaced by (amount_raw, amount_original and amount_usd) to be consistent with other spells, those are respectively cast as decimal(38, 0), double and double as they should be to not cause any issues with DuneSQL

@hildobby hildobby added the ready-for-review this PR development is complete, please review label May 5, 2023
@hildobby hildobby requested a review from jeff-dude May 5, 2023 18:10
@jeff-dude
Copy link
Member

sorry, more merge conflicts to resolve 😅 also -- looks like some models are maybe missing in schema file, hence the error on pre-commit hooks test?

@jeff-dude jeff-dude added in review Assignee is currently reviewing the PR and removed ready-for-review this PR development is complete, please review labels May 23, 2023
@jeff-dude
Copy link
Member

need to resolve some issues on why the ci test is timing out, then get a successful run as expected, then we can proceed 🙏

@jeff-dude jeff-dude added ready-for-final-review and removed in review Assignee is currently reviewing the PR labels May 24, 2023
@jeff-dude jeff-dude added in review Assignee is currently reviewing the PR and removed ready-for-final-review labels May 24, 2023
@jeff-dude
Copy link
Member

jeff-dude commented May 25, 2023

looks like it timed out on dunesql check, that should be fine. i'll let it run this last time on latest merge and then we should be good

edit: trying again without other PRs at same time

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.

looks like we're finally all good 🤞

@jeff-dude jeff-dude merged commit 4e4aa95 into duneanalytics:main May 25, 2023
2 checks passed
jeff-dude added a commit that referenced this pull request May 25, 2023
jeff-dude added a commit that referenced this pull request May 25, 2023
hildobby added a commit to hildobby/spellbook that referenced this pull request May 27, 2023
jeff-dude pushed a commit that referenced this pull request Jun 5, 2023
* Revert "Revert "Create `airdrop.claims` with 38 airdrops (#2979)" (#3418)"

This reverts commit 478ef1d.

* added schema to all configs

---------

Co-authored-by: Huang Geyang <Sukebeta@outlook.com>
olgafetisova pushed a commit to olgafetisova/spellbook that referenced this pull request Nov 14, 2023
* create airdrop_claims.all

* fix

* more fixes

* fix

* fix

* fix

* fix

* fix

* fix

* fixx

* add safe

* fix

* refactor

* fix

* add galxe to dbt_project

* fix

* fix

* cast as doubles and remove post airdrop token movements

* add 13 airdrops

* fix

* add readme draft

* estend ci timeout

* change from quantity to (amount_raw, amount_original & amount_usd)

* fix

* fix

* fix

* fix

* add earliest price for pre-trading claims

* fix

* fix

* dex.prices for tokens not on coinpaprika

* fix

* fix

* turn finished airdrops into static tables

* add genie/uniswap airdrop

* added gnosis, bnb and avalanche airdrops so it`s easy to work with going forward

* extend ci timeout

* fixes

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* change ci timeout back to 1h

* fox

* fix

* fix

* fix

* fix

---------

Co-authored-by: jeff-dude <102681548+jeff-dude@users.noreply.github.com>
olgafetisova pushed a commit to olgafetisova/spellbook that referenced this pull request Nov 14, 2023
olgafetisova pushed a commit to olgafetisova/spellbook that referenced this pull request Nov 14, 2023
* Revert "Revert "Create `airdrop.claims` with 38 airdrops (duneanalytics#2979)" (duneanalytics#3418)"

This reverts commit 478ef1d.

* added schema to all configs

---------

Co-authored-by: Huang Geyang <Sukebeta@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Assignee is currently reviewing the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants