Skip to content

Commit

Permalink
create tokens_blast_transfers (#6302)
Browse files Browse the repository at this point in the history
  • Loading branch information
hildobby authored Jul 2, 2024
1 parent 03d54ee commit d30a005
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
106 changes: 106 additions & 0 deletions models/_sector/tokens/blast/_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
version: 2

models:
- name: tokens_blast_base_transfers
meta:
blockchain: blast
sector: tokens
contributors: aalan3, jeff-dude, hildobby
config:
tags: ['tokens','transfers', 'blast']
description: >
Token transfers
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_blast_transfers
meta:
blockchain: blast
sector: tokens
contributors: aalan3, jeff-dude, hildobby
config:
tags: ['tokens','transfers', 'blast']
description: >
Token transfers
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 models/_sector/tokens/blast/tokens_blast_base_transfers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{config(
schema = 'tokens_blast',
alias = 'base_transfers',
partition_by = ['block_date'],
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='blast',
traces = source('blast','traces'),
transactions = source('blast','transactions'),
erc20_transfers = source('erc20_blast','evt_transfer'),
native_contract_address = null
)
}}
26 changes: 26 additions & 0 deletions models/_sector/tokens/blast/tokens_blast_transfers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{config(
schema = 'tokens_blast',
alias = 'transfers',
partition_by = ['block_date'],
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(\'["blast"]\',
"sector",
"tokens",
\'["aalan3", "jeff-dude", "hildobby"]\') }}'
)
}}

{{
transfers_enrich(
base_transfers = ref('tokens_blast_base_transfers')
, tokens_erc20_model = source('tokens', 'erc20')
, prices_model = source('prices', 'usd')
, evms_info_model = ref('evms_info')
, transfers_start_date = '2020-04-22'
, blockchain = 'blast'
)
}}
1 change: 1 addition & 0 deletions models/_sector/tokens/tokens_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
,'zkevm'
,'linea'
,'mantle'
,'blast'
] %}

SELECT *
Expand Down

0 comments on commit d30a005

Please sign in to comment.