From c4d5c238df84186a4d46a62e2cf32c8da8f08ebe Mon Sep 17 00:00:00 2001 From: tomfutago Date: Wed, 27 Dec 2023 10:49:18 +0000 Subject: [PATCH 1/2] arbitrum --- .../_sector/dex/trades/arbitrum/_schema.yml | 17 +++++++ .../_sector/dex/trades/arbitrum/_sources.yml | 4 ++ .../arbitrum/dex_arbitrum_base_trades.sql | 1 + .../integral_arbitrum_base_trades.sql | 21 ++++++++ .../arbitrum/integral_arbitrum_sources.yml | 48 ------------------- 5 files changed, 43 insertions(+), 48 deletions(-) create mode 100644 models/_sector/dex/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql delete mode 100644 models/integral/arbitrum/integral_arbitrum_sources.yml diff --git a/models/_sector/dex/trades/arbitrum/_schema.yml b/models/_sector/dex/trades/arbitrum/_schema.yml index 2e9ece28b30..ecde519abea 100644 --- a/models/_sector/dex/trades/arbitrum/_schema.yml +++ b/models/_sector/dex/trades/arbitrum/_schema.yml @@ -234,3 +234,20 @@ models: seed_file: ref('pancakeswap_arbitrum_base_trades_seed') filter: version: 3 + + - name: integral_arbitrum_base_trades + meta: + blockchain: arbitrum + sector: dex + project: integral + contributors: integralhq, tomfutago + config: + tags: [ 'arbitrum', 'dex', 'trades', 'integral', 'uniswap', 'v2' ] + description: "Integral Arbitrum v3 base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('integral_arbitrum_base_trades_seed') diff --git a/models/_sector/dex/trades/arbitrum/_sources.yml b/models/_sector/dex/trades/arbitrum/_sources.yml index 43f6ea3ebbe..f7171633b6c 100644 --- a/models/_sector/dex/trades/arbitrum/_sources.yml +++ b/models/_sector/dex/trades/arbitrum/_sources.yml @@ -41,3 +41,7 @@ sources: - name: balancer_v2_arbitrum tables: - name: Vault_evt_Swap + - name: integral_size_arbitrum + tables: + - name: TwapFactory_evt_PairCreated + - name: TwapPair_evt_Swap diff --git a/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql b/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql index a112877a149..df1f6f26566 100644 --- a/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql +++ b/models/_sector/dex/trades/arbitrum/dex_arbitrum_base_trades.sql @@ -18,6 +18,7 @@ , ref('pancakeswap_v2_arbitrum_base_trades') , ref('pancakeswap_v3_arbitrum_base_trades') , ref('balancer_v2_arbitrum_base_trades') + , ref('integral_arbitrum_base_trades') ] %} WITH base_union AS ( diff --git a/models/_sector/dex/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql b/models/_sector/dex/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql new file mode 100644 index 00000000000..8ac8cf9f341 --- /dev/null +++ b/models/_sector/dex/trades/arbitrum/platforms/integral_arbitrum_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'integral_arbitrum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'arbitrum', + project = 'integral', + version = 'size', + Pair_evt_Swap = source('integral_size_arbitrum', 'TwapPair_evt_Swap'), + Factory_evt_PairCreated = source('integral_size_arbitrum', 'TwapFactory_evt_PairCreated') + ) +}} diff --git a/models/integral/arbitrum/integral_arbitrum_sources.yml b/models/integral/arbitrum/integral_arbitrum_sources.yml deleted file mode 100644 index 1e1cac54736..00000000000 --- a/models/integral/arbitrum/integral_arbitrum_sources.yml +++ /dev/null @@ -1,48 +0,0 @@ -version: 2 - -sources: - - name: integral_size_arbitrum - description: "Decoded tables related to Integral Size for Arbitrum" - freshness: - warn_after: { count: 12, period: hour } - tables: - - name: TwapFactory_evt_PairCreated - description: "Decoded table related to the pair creation" - loaded_at_field: evt_block_time - columns: - - name: pair - description: "Pair address" - - name: token0 - description: "First token in pair" - - name: token1 - description: "Second token in pair" - - &contract_address - name: contract_address - description: "Contract address that emitted this event" - - &evt_block_number - name: evt_block_number - description: "Block number which processed the unique transaction hash" - - &evt_block_time - name: evt_block_time - description: "Timestamp for Sell event time in UTC" - - &evt_index - name: evt_index - description: "Event index" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of the event" - - name: TwapPair_evt_Swap - description: "Decoded table related to trades" - loaded_at_field: evt_block_time - colums: - - name: amount0In - - name: amount0Out - - name: amount1In - - name: amount1Out - - name: sender - - name: to - - *contract_address - - *evt_block_number - - *evt_block_time - - *evt_index - - *evt_tx_hash From 1e7564e3ae2b315b6797074632330a5adab5d042 Mon Sep 17 00:00:00 2001 From: tomfutago Date: Wed, 27 Dec 2023 10:54:34 +0000 Subject: [PATCH 2/2] ethereum --- .../_sector/dex/trades/arbitrum/_sources.yml | 2 +- .../_sector/dex/trades/ethereum/_schema.yml | 17 +++++++ .../_sector/dex/trades/ethereum/_sources.yml | 4 ++ .../ethereum/dex_ethereum_base_trades.sql | 1 + .../integral_ethereum_base_trades.sql | 21 ++++++++ .../ethereum/integral_ethereum_sources.yml | 48 ------------------- 6 files changed, 44 insertions(+), 49 deletions(-) create mode 100644 models/_sector/dex/trades/ethereum/platforms/integral_ethereum_base_trades.sql delete mode 100644 models/integral/ethereum/integral_ethereum_sources.yml diff --git a/models/_sector/dex/trades/arbitrum/_sources.yml b/models/_sector/dex/trades/arbitrum/_sources.yml index f7171633b6c..c3504435e58 100644 --- a/models/_sector/dex/trades/arbitrum/_sources.yml +++ b/models/_sector/dex/trades/arbitrum/_sources.yml @@ -43,5 +43,5 @@ sources: - name: Vault_evt_Swap - name: integral_size_arbitrum tables: - - name: TwapFactory_evt_PairCreated - name: TwapPair_evt_Swap + - name: TwapFactory_evt_PairCreated diff --git a/models/_sector/dex/trades/ethereum/_schema.yml b/models/_sector/dex/trades/ethereum/_schema.yml index 808c5a5802e..9606f3dae9d 100644 --- a/models/_sector/dex/trades/ethereum/_schema.yml +++ b/models/_sector/dex/trades/ethereum/_schema.yml @@ -323,3 +323,20 @@ models: - evt_index - check_dex_base_trades_seed: seed_file: ref('verse_dex_ethereum_base_trades_seed') + + - name: integral_ethereum_base_trades + meta: + blockchain: ethereum + sector: dex + project: integral + contributors: integralhq, tomfutago + config: + tags: [ 'ethereum', 'dex', 'trades', 'integral', 'uniswap', 'v2' ] + description: "Integral ethereum v3 base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('integral_ethereum_base_trades_seed') diff --git a/models/_sector/dex/trades/ethereum/_sources.yml b/models/_sector/dex/trades/ethereum/_sources.yml index eb8af01df63..4300068fb8a 100644 --- a/models/_sector/dex/trades/ethereum/_sources.yml +++ b/models/_sector/dex/trades/ethereum/_sources.yml @@ -61,3 +61,7 @@ sources: tables: - name: SwapsPair_evt_Swap - name: Factory_evt_PairCreated + - name: integral_size_ethereum + tables: + - name: Pair_evt_Swap + - name: Factory_evt_PairCreated diff --git a/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql b/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql index 720a7e2ae2e..42b260105b1 100644 --- a/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql +++ b/models/_sector/dex/trades/ethereum/dex_ethereum_base_trades.sql @@ -23,6 +23,7 @@ , ref('fraxswap_ethereum_base_trades') , ref('bancor_ethereum_base_trades') , ref('verse_dex_ethereum_base_trades') + , ref('integral_ethereum_base_trades') ] %} WITH base_union AS ( diff --git a/models/_sector/dex/trades/ethereum/platforms/integral_ethereum_base_trades.sql b/models/_sector/dex/trades/ethereum/platforms/integral_ethereum_base_trades.sql new file mode 100644 index 00000000000..ad7105aafe5 --- /dev/null +++ b/models/_sector/dex/trades/ethereum/platforms/integral_ethereum_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'integral_ethereum', + alias = 'base_trades', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] + ) +}} + +{{ + uniswap_compatible_v2_trades( + blockchain = 'ethereum', + project = 'integral', + version = 'size', + Pair_evt_Swap = source('integral_size_ethereum', 'Pair_evt_Swap'), + Factory_evt_PairCreated = source('integral_size_ethereum', 'Factory_evt_PairCreated') + ) +}} diff --git a/models/integral/ethereum/integral_ethereum_sources.yml b/models/integral/ethereum/integral_ethereum_sources.yml deleted file mode 100644 index c987a31a7b5..00000000000 --- a/models/integral/ethereum/integral_ethereum_sources.yml +++ /dev/null @@ -1,48 +0,0 @@ -version: 2 - -sources: - - name: integral_size_ethereum - description: "Decoded tables related to Integral Size for Ethereum" - freshness: - warn_after: { count: 12, period: hour } - tables: - - name: Factory_evt_PairCreated - description: "Decoded table related to the pair creation" - loaded_at_field: evt_block_time - columns: - - name: pair - description: "Pair address" - - name: token0 - description: "First token in pair" - - name: token1 - description: "Second token in pair" - - &contract_address - name: contract_address - description: "Contract address that emitted this event" - - &evt_block_number - name: evt_block_number - description: "Block number which processed the unique transaction hash" - - &evt_block_time - name: evt_block_time - description: "Timestamp for Sell event time in UTC" - - &evt_index - name: evt_index - description: "Event index" - - &evt_tx_hash - name: evt_tx_hash - description: "Transaction hash of the event" - - name: Pair_evt_Swap - description: "Decoded table related to trades" - loaded_at_field: evt_block_time - colums: - - name: amount0In - - name: amount0Out - - name: amount1In - - name: amount1Out - - name: sender - - name: to - - *contract_address - - *evt_block_number - - *evt_block_time - - *evt_index - - *evt_tx_hash