From d30a0059b52dd745f671f7c236a72468c86cfa60 Mon Sep 17 00:00:00 2001 From: hildobby Date: Tue, 2 Jul 2024 11:27:24 +0200 Subject: [PATCH] create tokens_blast_transfers (#6302) --- models/_sector/tokens/blast/_schema.yml | 106 ++++++++++++++++++ .../blast/tokens_blast_base_transfers.sql | 20 ++++ .../tokens/blast/tokens_blast_transfers.sql | 26 +++++ models/_sector/tokens/tokens_transfers.sql | 1 + 4 files changed, 153 insertions(+) create mode 100644 models/_sector/tokens/blast/_schema.yml create mode 100644 models/_sector/tokens/blast/tokens_blast_base_transfers.sql create mode 100644 models/_sector/tokens/blast/tokens_blast_transfers.sql diff --git a/models/_sector/tokens/blast/_schema.yml b/models/_sector/tokens/blast/_schema.yml new file mode 100644 index 00000000000..6e80a23498b --- /dev/null +++ b/models/_sector/tokens/blast/_schema.yml @@ -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" \ No newline at end of file diff --git a/models/_sector/tokens/blast/tokens_blast_base_transfers.sql b/models/_sector/tokens/blast/tokens_blast_base_transfers.sql new file mode 100644 index 00000000000..c25bd007405 --- /dev/null +++ b/models/_sector/tokens/blast/tokens_blast_base_transfers.sql @@ -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 +) +}} diff --git a/models/_sector/tokens/blast/tokens_blast_transfers.sql b/models/_sector/tokens/blast/tokens_blast_transfers.sql new file mode 100644 index 00000000000..0f85fc3bf16 --- /dev/null +++ b/models/_sector/tokens/blast/tokens_blast_transfers.sql @@ -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' + ) +}} \ No newline at end of file diff --git a/models/_sector/tokens/tokens_transfers.sql b/models/_sector/tokens/tokens_transfers.sql index e923183431d..d5e32baeead 100644 --- a/models/_sector/tokens/tokens_transfers.sql +++ b/models/_sector/tokens/tokens_transfers.sql @@ -21,6 +21,7 @@ ,'zkevm' ,'linea' ,'mantle' + ,'blast' ] %} SELECT *