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

Abstract Token Transfers #7556

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
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
)
}}
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'
)
}}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
}}

{% set chains = [
'arbitrum'
'abstract'
,'arbitrum'
,'avalanche_c'
,'base'
,'blast'
Expand Down
Loading
Loading