Skip to content

Commit

Permalink
Add Celo & zkSync (#4984)
Browse files Browse the repository at this point in the history
  • Loading branch information
hildobby authored Dec 13, 2023
1 parent 6eea03b commit e80529a
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 4 deletions.
168 changes: 168 additions & 0 deletions models/dex/chains/dex_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions models/dex/chains/mev/sandwiches/dex_celo_sandwiched.sql
Original file line number Diff line number Diff line change
@@ -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')
)}}
18 changes: 18 additions & 0 deletions models/dex/chains/mev/sandwiches/dex_celo_sandwiches.sql
Original file line number Diff line number Diff line change
@@ -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')
)}}
20 changes: 20 additions & 0 deletions models/dex/chains/mev/sandwiches/dex_zksync_sandwiched.sql
Original file line number Diff line number Diff line change
@@ -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')
)}}
18 changes: 18 additions & 0 deletions models/dex/chains/mev/sandwiches/dex_zksync_sandwiches.sql
Original file line number Diff line number Diff line change
@@ -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')
)}}
4 changes: 3 additions & 1 deletion models/dex/dex_sandwiched.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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"]\') }}'
Expand All @@ -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 *
Expand Down
4 changes: 3 additions & 1 deletion models/dex/dex_sandwiches.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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"]\') }}'
Expand All @@ -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 *
Expand Down
4 changes: 2 additions & 2 deletions models/dex/dex_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e80529a

Please sign in to comment.