diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/_schema.yml b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/_schema.yml new file mode 100644 index 00000000000..e5d885597ec --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/_schema.yml @@ -0,0 +1,76 @@ +version: 2 + +models: + - name: dex_avalanche_c_automated_base_trades + description: "all dex trades on avalanche_c, mass decoded" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v2_avalanche_c_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v2 factory contract on avalanche_c + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_avalanche_c_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v2 pool contracts on avalanche_c + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_avalanche_c_automated_base_trades + meta: + blockchain: avalanche_c + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'avalanche_c', 'dex', 'trades', 'uniswap', 'v2', 'forks' ] + description: "base trades for all forks of uniswap v2 on avalanche_c" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v3_avalanche_c_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v3 factory contract on avalanche_c + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_avalanche_c_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v3 pool contracts on avalanche_c + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_avalanche_c_automated_base_trades + meta: + blockchain: avalanche_c + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'avalanche_c', 'dex', 'trades', 'uniswap', 'v3', 'forks' ] + description: "base trades for all forks of uniswap v3 on avalanche_c" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/dex_avalanche_c_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/dex_avalanche_c_automated_base_trades.sql new file mode 100644 index 00000000000..f1e87ec9ac4 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/dex_avalanche_c_automated_base_trades.sql @@ -0,0 +1,52 @@ +{{ config( + schema = 'dex_avalanche_c' + , alias = 'automated_base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('uniswap_v2_avalanche_c_automated_base_trades') + , ref('uniswap_v3_avalanche_c_automated_base_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , dex_type + , factory_address + , block_month + , block_date + , block_time + , block_number + , token_bought_amount_raw + , token_sold_amount_raw + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , evt_index + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +{{ + add_tx_columns( + model_cte = 'base_union' + , blockchain = 'avalanche_c' + , columns = ['from', 'to', 'index'] + ) +}} + diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_automated_base_trades.sql new file mode 100644 index 00000000000..15ca9dd0564 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v2_avalanche_c', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v2_forks_trades( + blockchain = 'avalanche_c' + , version = '2' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v2_avalanche_c_decoded_pool_evt_swap') + , Factory_evt_PairCreated = ref('uniswap_v2_avalanche_c_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_decoded_factory_evt.sql new file mode 100644 index 00000000000..1429848e115 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_decoded_factory_evt.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_avalanche_c', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_factory_event_decoding( + logs = source('avalanche_c', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..89c07248a88 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v2_avalanche_c_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_avalanche_c', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_pool_event_decoding( + logs = source('avalanche_c', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_automated_base_trades.sql new file mode 100644 index 00000000000..cc9726bf849 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v3_avalanche_c', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v3_forks_trades( + blockchain = 'avalanche_c' + , version = '3' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v3_avalanche_c_decoded_pool_evt_swap') + , Factory_evt_PoolCreated = ref('uniswap_v3_avalanche_c_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_decoded_factory_evt.sql new file mode 100644 index 00000000000..94bf64eb0fb --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_decoded_factory_evt.sql @@ -0,0 +1,16 @@ +{{ config( + schema = 'uniswap_v3_avalanche_c', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_factory_event_decoding( + logs = source('avalanche_c', 'logs') +)}} + diff --git a/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..c8d1b7fb366 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/avalanche_c/projects/uniswap/uniswap_v3_avalanche_c_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v3_avalanche_c', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_pool_event_decoding( + logs = source('avalanche_c', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/_schema.yml b/dbt_subprojects/dex/models/automated_trades/base/projects/_schema.yml new file mode 100644 index 00000000000..affab033782 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/_schema.yml @@ -0,0 +1,76 @@ +version: 2 + +models: + - name: dex_base_automated_base_trades + description: "all dex trades on base, mass decoded" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v2_base_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v2 factory contract on base + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_base_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v2 pool contracts on base + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_base_automated_base_trades + meta: + blockchain: base + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'base', 'dex', 'trades', 'uniswap', 'v2', 'forks' ] + description: "base trades for all forks of uniswap v2 on base" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v3_base_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v3 factory contract on base + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_base_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v3 pool contracts on base + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_base_automated_base_trades + meta: + blockchain: base + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'base', 'dex', 'trades', 'uniswap', 'v3', 'forks' ] + description: "base trades for all forks of uniswap v3 on base" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/dex_base_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/dex_base_automated_base_trades.sql new file mode 100644 index 00000000000..3f256c1ef6c --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/dex_base_automated_base_trades.sql @@ -0,0 +1,52 @@ +{{ config( + schema = 'dex_base' + , alias = 'automated_base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('uniswap_v2_base_automated_base_trades') + , ref('uniswap_v3_base_automated_base_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , dex_type + , factory_address + , block_month + , block_date + , block_time + , block_number + , token_bought_amount_raw + , token_sold_amount_raw + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , evt_index + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +{{ + add_tx_columns( + model_cte = 'base_union' + , blockchain = 'base' + , columns = ['from', 'to', 'index'] + ) +}} + diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_automated_base_trades.sql new file mode 100644 index 00000000000..40685b619cb --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v2_base', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v2_forks_trades( + blockchain = 'base' + , version = '2' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v2_base_decoded_pool_evt_swap') + , Factory_evt_PairCreated = ref('uniswap_v2_base_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_decoded_factory_evt.sql new file mode 100644 index 00000000000..a6bbd9889ce --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_decoded_factory_evt.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_base', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_factory_event_decoding( + logs = source('base', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..54473eda8d8 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v2_base_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_base', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_pool_event_decoding( + logs = source('base', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_automated_base_trades.sql new file mode 100644 index 00000000000..dcbd5fd09be --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v3_base', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v3_forks_trades( + blockchain = 'base' + , version = '3' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v3_base_decoded_pool_evt_swap') + , Factory_evt_PoolCreated = ref('uniswap_v3_base_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_decoded_factory_evt.sql new file mode 100644 index 00000000000..6889d459de3 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_decoded_factory_evt.sql @@ -0,0 +1,16 @@ +{{ config( + schema = 'uniswap_v3_base', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_factory_event_decoding( + logs = source('base', 'logs') +)}} + diff --git a/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..baaec47df6e --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/base/projects/uniswap/uniswap_v3_base_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v3_base', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_pool_event_decoding( + logs = source('base', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/_schema.yml b/dbt_subprojects/dex/models/automated_trades/blast/projects/_schema.yml new file mode 100644 index 00000000000..f0061136294 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/_schema.yml @@ -0,0 +1,76 @@ +version: 2 + +models: + - name: dex_blast_automated_base_trades + description: "all dex trades on blast, mass decoded" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v2_blast_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v2 factory contract on blast + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_blast_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v2 pool contracts on blast + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_blast_automated_base_trades + meta: + blockchain: blast + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'blast', 'dex', 'trades', 'uniswap', 'v2', 'forks' ] + description: "base trades for all forks of uniswap v2 on blast" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v3_blast_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v3 factory contract on blast + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_blast_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v3 pool contracts on blast + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_blast_automated_base_trades + meta: + blockchain: blast + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'blast', 'dex', 'trades', 'uniswap', 'v3', 'forks' ] + description: "base trades for all forks of uniswap v3 on blast" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/dex_blast_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/dex_blast_automated_base_trades.sql new file mode 100644 index 00000000000..33b3592c426 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/dex_blast_automated_base_trades.sql @@ -0,0 +1,52 @@ +{{ config( + schema = 'dex_blast' + , alias = 'automated_base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('uniswap_v2_blast_automated_base_trades') + , ref('uniswap_v3_blast_automated_base_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , dex_type + , factory_address + , block_month + , block_date + , block_time + , block_number + , token_bought_amount_raw + , token_sold_amount_raw + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , evt_index + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +{{ + add_tx_columns( + model_cte = 'base_union' + , blockchain = 'blast' + , columns = ['from', 'to', 'index'] + ) +}} + diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_automated_base_trades.sql new file mode 100644 index 00000000000..3f5b2ed5a0f --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v2_blast', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v2_forks_trades( + blockchain = 'blast' + , version = '2' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v2_blast_decoded_pool_evt_swap') + , Factory_evt_PairCreated = ref('uniswap_v2_blast_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_decoded_factory_evt.sql new file mode 100644 index 00000000000..d483e118554 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_decoded_factory_evt.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_blast', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_factory_event_decoding( + logs = source('blast', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..91625c115ee --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v2_blast_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_blast', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_pool_event_decoding( + logs = source('blast', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_automated_base_trades.sql new file mode 100644 index 00000000000..eb0472707e4 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v3_blast', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v3_forks_trades( + blockchain = 'blast' + , version = '3' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v3_blast_decoded_pool_evt_swap') + , Factory_evt_PoolCreated = ref('uniswap_v3_blast_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_decoded_factory_evt.sql new file mode 100644 index 00000000000..f47d2667144 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_decoded_factory_evt.sql @@ -0,0 +1,16 @@ +{{ config( + schema = 'uniswap_v3_blast', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_factory_event_decoding( + logs = source('blast', 'logs') +)}} + diff --git a/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..8fd2f3ba9ca --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/blast/projects/uniswap/uniswap_v3_blast_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v3_blast', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_pool_event_decoding( + logs = source('blast', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/_schema.yml b/dbt_subprojects/dex/models/automated_trades/celo/projects/_schema.yml new file mode 100644 index 00000000000..0b158ecdef9 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/_schema.yml @@ -0,0 +1,76 @@ +version: 2 + +models: + - name: dex_celo_automated_base_trades + description: "all dex trades on celo, mass decoded" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v2_celo_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v2 factory contract on celo + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_celo_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v2 pool contracts on celo + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v2_celo_automated_base_trades + meta: + blockchain: celo + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'celo', 'dex', 'trades', 'uniswap', 'v2', 'forks' ] + description: "base trades for all forks of uniswap v2 on celo" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: uniswap_v3_celo_decoded_factory_evt + description: > + mass decoding of all forks of uniswap v3 factory contract on celo + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_celo_decoded_pool_evt_swap + description: > + mass decoding of all forks of uniswap v3 pool contracts on celo + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + + - name: uniswap_v3_celo_automated_base_trades + meta: + blockchain: celo + sector: dex + project: uniswap + contributors: 0xboxer + config: + tags: [ 'celo', 'dex', 'trades', 'uniswap', 'v3', 'forks' ] + description: "base trades for all forks of uniswap v3 on celo" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/dex_celo_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/dex_celo_automated_base_trades.sql new file mode 100644 index 00000000000..479926a0094 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/dex_celo_automated_base_trades.sql @@ -0,0 +1,52 @@ +{{ config( + schema = 'dex_celo' + , alias = 'automated_base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('uniswap_v2_celo_automated_base_trades') + , ref('uniswap_v3_celo_automated_base_trades') +] %} + +WITH base_union AS ( + SELECT * + FROM ( + {% for base_model in base_models %} + SELECT + blockchain + , project + , version + , dex_type + , factory_address + , block_month + , block_date + , block_time + , block_number + , token_bought_amount_raw + , token_sold_amount_raw + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , evt_index + FROM + {{ base_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ) +) + +{{ + add_tx_columns( + model_cte = 'base_union' + , blockchain = 'celo' + , columns = ['from', 'to', 'index'] + ) +}} + diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_automated_base_trades.sql new file mode 100644 index 00000000000..f4e7038aad7 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v2_celo', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v2_forks_trades( + blockchain = 'celo' + , version = '2' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v2_celo_decoded_pool_evt_swap') + , Factory_evt_PairCreated = ref('uniswap_v2_celo_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_decoded_factory_evt.sql new file mode 100644 index 00000000000..598c670d5a3 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_decoded_factory_evt.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_celo', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_factory_event_decoding( + logs = source('celo', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..e23d6d6d6ae --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v2_celo_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v2_celo', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v2_pool_event_decoding( + logs = source('celo', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_automated_base_trades.sql new file mode 100644 index 00000000000..9c251523f04 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_automated_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v3_celo', + alias = 'automated_base_trades', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_v3_forks_trades( + blockchain = 'celo' + , version = '3' + , project = 'null' + , Pair_evt_Swap = ref('uniswap_v3_celo_decoded_pool_evt_swap') + , Factory_evt_PoolCreated = ref('uniswap_v3_celo_decoded_factory_evt') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_decoded_factory_evt.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_decoded_factory_evt.sql new file mode 100644 index 00000000000..4c67a2cb9b0 --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_decoded_factory_evt.sql @@ -0,0 +1,16 @@ +{{ config( + schema = 'uniswap_v3_celo', + alias = 'decoded_factory_evt', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_factory_event_decoding( + logs = source('celo', 'logs') +)}} + diff --git a/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_decoded_pool_evt_swap.sql b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_decoded_pool_evt_swap.sql new file mode 100644 index 00000000000..5cb8868878c --- /dev/null +++ b/dbt_subprojects/dex/models/automated_trades/celo/projects/uniswap/uniswap_v3_celo_decoded_pool_evt_swap.sql @@ -0,0 +1,15 @@ +{{ config( + schema = 'uniswap_v3_celo', + alias = 'decoded_pool_evt_swap', + partition_by = ['block_date'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{uniswap_v3_pool_event_decoding( + logs = source('celo', 'logs') +)}} diff --git a/dbt_subprojects/dex/models/automated_trades/dex_automated_base_trades.sql b/dbt_subprojects/dex/models/automated_trades/dex_automated_base_trades.sql index 52ccf9c4547..2c1e9b1fe0f 100644 --- a/dbt_subprojects/dex/models/automated_trades/dex_automated_base_trades.sql +++ b/dbt_subprojects/dex/models/automated_trades/dex_automated_base_trades.sql @@ -13,6 +13,11 @@ {% set models = [ ref('dex_ethereum_automated_base_trades') , ref('dex_arbitrum_automated_base_trades') + , ref('dex_avalanche_c_automated_base_trades') + , ref('dex_base_automated_base_trades') + , ref('dex_blast_automated_base_trades') + , ref('dex_celo_automated_base_trades') + ] %} with base_union as (