-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Abstract Token Transfers #7556
Open
peterrliem
wants to merge
11
commits into
duneanalytics:main
Choose a base branch
from
peterrliem:patch-10
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Abstract Token Transfers #7556
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
52edd5d
Create tokens_abstract_base_transfers
peterrliem 6a05a9e
Create tokens_abstract_transfers.sql
peterrliem c9b0b4a
Made changes
peterrliem 9b72f90
Made changes to titles
peterrliem df10408
Rename tokens_abstract_base_transfers to tokens_abstract_base_transfe…
peterrliem 050fb50
Merge branch 'main' into patch-10
peterrliem 775a3e3
Add abstract_base_sources
Hosuke c49d8a0
Add schema
Hosuke 76dd00c
Merge branch 'duneanalytics:main' into patch-10
peterrliem b785dcd
Merge branch 'main' into pr/7556
Hosuke af87eab
Merge branch 'main' into patch-10
Hosuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
dbt_subprojects/tokens/models/transfers_and_balances/abstract/_schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: tokens_abstract_base_transfers | ||
meta: | ||
blockchain: abstract | ||
sector: tokens | ||
contributors: aalan3, jeff-dude, peterrliem, hosuke | ||
config: | ||
tags: ['tokens','transfers', 'abstract'] | ||
description: > | ||
Token transfers | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- block_date | ||
- unique_key | ||
columns: | ||
- name: unique_key | ||
description: "Surrogate key to identify unique row" | ||
- name: blockchain | ||
description: "The blockchain of the transfers" | ||
- name: block_date | ||
description: "The date of the block" | ||
- name: block_time | ||
description: "The time of the block" | ||
- name: block_number | ||
description: "The block number" | ||
- name: tx_hash | ||
description: "The transaction hash" | ||
- name: evt_index | ||
description: "The log event index of the transfer if any" | ||
- name: trace_address | ||
description: "The trace address of the transfer if any" | ||
- name: token_standard | ||
description: "The token standard of the transfer" | ||
- name: tx_from | ||
description: "The transaction sender" | ||
- name: tx_to | ||
description: "The transaction receiver" | ||
- name: tx_index | ||
description: "The transaction index" | ||
- name: from | ||
description: "The sender of the transfer" | ||
- name: to | ||
description: "The receiver of the transfer" | ||
- name: contract_address | ||
description: "The contract address of the transfer" | ||
- name: amount_raw | ||
description: "The raw amount of the transfer" | ||
|
||
- name: tokens_abstract_transfers | ||
meta: | ||
blockchain: abstract | ||
sector: tokens | ||
contributors: aalan3, jeff-dude, peterrliem, hosuke | ||
config: | ||
tags: ['tokens','transfers', 'abstract'] | ||
description: > | ||
Token transfers | ||
data_tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- block_date | ||
- unique_key | ||
columns: | ||
- name: unique_key | ||
description: "Surrogate key to identify unique row" | ||
- name: blockchain | ||
description: "The blockchain of the transfers" | ||
- name: block_date | ||
description: "The date of the block" | ||
- name: block_time | ||
description: "The time of the block" | ||
- name: block_number | ||
description: "The block number" | ||
- name: tx_hash | ||
description: "The transaction hash" | ||
- name: evt_index | ||
description: "The log event index of the transfer if any" | ||
- name: trace_address | ||
description: "The trace address of the transfer if any" | ||
- name: token_standard | ||
description: "The token standard of the transfer" | ||
- name: tx_from | ||
description: "The transaction sender" | ||
- name: tx_to | ||
description: "The transaction receiver" | ||
- name: tx_index | ||
description: "The transaction index" | ||
- name: from | ||
description: "The sender of the transfer" | ||
- name: to | ||
description: "The receiver of the transfer" | ||
- name: contract_address | ||
description: "The contract address of the transfer" | ||
- name: symbol | ||
description: "The token symbol transferred" | ||
- name: amount_raw | ||
description: "The raw amount of the transfer" | ||
- name: amount | ||
description: "The formatted amount of the transfer" | ||
- name: price_usd | ||
description: "The USD price used to calculate the amount_usd" | ||
- name: amount_usd | ||
description: "The USD amount of the transfer" |
20 changes: 20 additions & 0 deletions
20
...projects/tokens/models/transfers_and_balances/abstract/tokens_abstract_base_transfers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{config( | ||
schema = 'tokens_abstract', | ||
alias = 'base_transfers', | ||
partition_by = ['block_month'], | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], | ||
unique_key = ['block_date','unique_key'], | ||
) | ||
}} | ||
|
||
{{transfers_base( | ||
blockchain='abstract', | ||
traces = source('abstract','traces'), | ||
transactions = source('abstract','transactions'), | ||
erc20_transfers = source('erc20_abstract','evt_transfer'), | ||
native_contract_address = null | ||
) | ||
}} |
26 changes: 26 additions & 0 deletions
26
dbt_subprojects/tokens/models/transfers_and_balances/abstract/tokens_abstract_transfers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{config( | ||
schema = 'tokens_abstract', | ||
alias = 'transfers', | ||
partition_by = ['block_month'], | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['block_date','unique_key'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], | ||
post_hook='{{ expose_spells(\'["abstract"]\', | ||
"sector", | ||
"tokens", | ||
\'["aalan3", "jeff-dude", "peterrliem"]\') }}' | ||
) | ||
}} | ||
|
||
{{ | ||
transfers_enrich( | ||
base_transfers = ref('tokens_abstract_base_transfers') | ||
, tokens_erc20_model = source('tokens', 'erc20') | ||
, prices_model = source('prices', 'usd') | ||
, evms_info_model = source('evms','info') | ||
, transfers_start_date = '2021-01-24' | ||
, blockchain = 'abstract' | ||
) | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,8 @@ | |
}} | ||
|
||
{% set chains = [ | ||
'arbitrum' | ||
'abstract' | ||
,'arbitrum' | ||
,'avalanche_c' | ||
,'base' | ||
,'blast' | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use evms.info to fill this field?