From e80529af8673f9d035e1f11c32badaec76f6d45d Mon Sep 17 00:00:00 2001 From: hildobby Date: Wed, 13 Dec 2023 18:43:59 +0100 Subject: [PATCH] Add Celo & zkSync (#4984) --- models/dex/chains/dex_schema.yml | 168 ++++++++++++++++++ .../mev/sandwiches/dex_celo_sandwiched.sql | 20 +++ .../mev/sandwiches/dex_celo_sandwiches.sql | 18 ++ .../mev/sandwiches/dex_zksync_sandwiched.sql | 20 +++ .../mev/sandwiches/dex_zksync_sandwiches.sql | 18 ++ models/dex/dex_sandwiched.sql | 4 +- models/dex/dex_sandwiches.sql | 4 +- models/dex/dex_schema.yml | 4 +- 8 files changed, 252 insertions(+), 4 deletions(-) create mode 100644 models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql create mode 100644 models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql create mode 100644 models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql create mode 100644 models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql diff --git a/models/dex/chains/dex_schema.yml b/models/dex/chains/dex_schema.yml index 4227d30f7e8..090ac54211b 100644 --- a/models/dex/chains/dex_schema.yml +++ b/models/dex/chains/dex_schema.yml @@ -428,6 +428,90 @@ models: - *token_bought_amount - *amount_usd - *evt_index + + - name: dex_zksync_sandwiches + meta: + blockchain: zksync + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'sandwiches', 'zksync'] + description: > + DEX MEV Sandwich Trades on zkSync + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_celo_sandwiches + meta: + blockchain: celo + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'sandwiches', 'celo'] + description: > + DEX MEV Sandwich Trades on Celo + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index - name: dex_ethereum_sandwiched meta: @@ -809,6 +893,90 @@ models: - *amount_usd - *evt_index + - name: dex_celo_sandwiched + meta: + blockchain: celo + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'sandwiched', 'celo'] + description: > + DEX MEV Sandwiched Trades on Celo + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + + - name: dex_zksync_sandwiched + meta: + blockchain: zksync + sector: dex + contributors: hildobby + config: + tags: ['dex', 'mev', 'sandwiched', 'zksync'] + description: > + DEX MEV Sandwiched Trades on zkSync + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - tx_hash + - evt_index + columns: + - *blockchain + - *project + - *version + - *block_time + - *block_month + - *block_number + - *token_sold_address + - *token_bought_address + - *token_sold_symbol + - *token_bought_symbol + - *maker + - *taker + - *tx_hash + - *tx_from + - *tx_to + - *project_contract_address + - *trace_address + - *token_pair + - *tx_index + - *token_sold_amount_raw + - *token_bought_amount_raw + - *token_sold_amount + - *token_bought_amount + - *amount_usd + - *evt_index + - name: dex_ethereum_atomic_arbitrages meta: blockchain: ethereum diff --git a/models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql b/models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql new file mode 100644 index 00000000000..2f6a58cda0a --- /dev/null +++ b/models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'celo' %} + +{{ config( + + schema = 'dex_' + blockchain, + alias = 'sandwiched', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] +) +}} + +{{dex_sandwiched( + blockchain = blockchain + , transactions = source(blockchain,'transactions') + , sandwiches = ref('dex_' + blockchain + '_sandwiches') +)}} diff --git a/models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql b/models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql new file mode 100644 index 00000000000..52286dbeb36 --- /dev/null +++ b/models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql @@ -0,0 +1,18 @@ +{% set blockchain = 'celo' %} + +{{ config( + + schema = 'dex_' + blockchain, + alias = 'sandwiches', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'tx_hash', 'evt_index'] +) +}} + +{{dex_sandwiches( + blockchain = blockchain + , transactions = source(blockchain,'transactions') +)}} diff --git a/models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql b/models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql new file mode 100644 index 00000000000..e8a938d7e3b --- /dev/null +++ b/models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql @@ -0,0 +1,20 @@ +{% set blockchain = 'zksync' %} + +{{ config( + + schema = 'dex_' + blockchain, + alias = 'sandwiched', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] +) +}} + +{{dex_sandwiched( + blockchain = blockchain + , transactions = source(blockchain,'transactions') + , sandwiches = ref('dex_' + blockchain + '_sandwiches') +)}} diff --git a/models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql b/models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql new file mode 100644 index 00000000000..c4f9f72522f --- /dev/null +++ b/models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql @@ -0,0 +1,18 @@ +{% set blockchain = 'zksync' %} + +{{ config( + + schema = 'dex_' + blockchain, + alias = 'sandwiches', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['blockchain', 'tx_hash', 'evt_index'] +) +}} + +{{dex_sandwiches( + blockchain = blockchain + , transactions = source(blockchain,'transactions') +)}} diff --git a/models/dex/dex_sandwiched.sql b/models/dex/dex_sandwiched.sql index 04e5a95222b..4acaccdc246 100644 --- a/models/dex/dex_sandwiched.sql +++ b/models/dex/dex_sandwiched.sql @@ -8,7 +8,7 @@ incremental_strategy = 'merge', unique_key = ['blockchain', 'tx_hash', 'evt_index'], incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], - post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "fantom", "polygon", "base"]\', + post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "fantom", "polygon", "base", "celo", "zksync"]\', "sector", "dex", \'["hildobby"]\') }}' @@ -25,6 +25,8 @@ , (ref('dex_optimism_sandwiched')) , (ref('dex_polygon_sandwiched')) , (ref('dex_base_sandwiched')) + , (ref('dex_celo_sandwiched')) + , (ref('dex_zksync_sandwiched')) ] %} SELECT * diff --git a/models/dex/dex_sandwiches.sql b/models/dex/dex_sandwiches.sql index 9bbfefef78a..e342d417e93 100644 --- a/models/dex/dex_sandwiches.sql +++ b/models/dex/dex_sandwiches.sql @@ -7,7 +7,7 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['blockchain', 'tx_hash', 'project_contract_address', 'evt_index'], - post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "fantom", "polygon", "base"]\', + post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "fantom", "polygon", "base", "celo", "zksync"]\', "sector", "dex", \'["hildobby"]\') }}' @@ -24,6 +24,8 @@ , (ref('dex_optimism_sandwiches')) , (ref('dex_polygon_sandwiches')) , (ref('dex_base_sandwiches')) + , (ref('dex_celo_sandwiches')) + , (ref('dex_zksync_sandwiches')) ] %} SELECT * diff --git a/models/dex/dex_schema.yml b/models/dex/dex_schema.yml index a7c37686308..00556e3852f 100644 --- a/models/dex/dex_schema.yml +++ b/models/dex/dex_schema.yml @@ -439,7 +439,7 @@ models: - name: dex_sandwiches meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zksync sector: dex contributors: hildobby config: @@ -484,7 +484,7 @@ models: - name: dex_sandwiched meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, fantom, arbitrum, celo, zksync sector: dex contributors: hildobby config: