From 95769b410fc2763e81c74427cb8a29167760d966 Mon Sep 17 00:00:00 2001 From: chef-seaweed <121569855+chef-seaweed@users.noreply.github.com> Date: Tue, 18 Jun 2024 23:34:02 +0800 Subject: [PATCH 1/4] Add Uniswap V3 Linea Dex Trades --- dex/models/trades/linea/_schema.yml | 19 +++++++++++++++++ .../trades/linea/dex_linea_base_trades.sql | 1 + .../uniswap_v3_linea_base_trades.sql | 21 +++++++++++++++++++ .../trades/uniswap_linea_base_trades_seed.csv | 4 ++++ sources/_sector/dex/trades/linea/_sources.yml | 4 ++++ 5 files changed, 49 insertions(+) create mode 100644 dex/models/trades/linea/platforms/uniswap_v3_linea_base_trades.sql create mode 100644 dex/seeds/trades/uniswap_linea_base_trades_seed.csv diff --git a/dex/models/trades/linea/_schema.yml b/dex/models/trades/linea/_schema.yml index dc4e3f062bc..219b050ec92 100644 --- a/dex/models/trades/linea/_schema.yml +++ b/dex/models/trades/linea/_schema.yml @@ -148,3 +148,22 @@ models: filter: version: 1 + - name: uniswap_v3_linea_base_trades + meta: + blockchain: linea + sector: dex + project: uniswap + contributors: chef_seaweed + config: + tags: [ 'linea', 'dex', 'trades', 'uniswap', 'v3' ] + description: "uniswap linea 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('uniswap_linea_base_trades_seed') + filter: + version: 3 + diff --git a/dex/models/trades/linea/dex_linea_base_trades.sql b/dex/models/trades/linea/dex_linea_base_trades.sql index b1b016b71e8..b414cb49cd0 100644 --- a/dex/models/trades/linea/dex_linea_base_trades.sql +++ b/dex/models/trades/linea/dex_linea_base_trades.sql @@ -14,6 +14,7 @@ , ref('pancakeswap_v2_linea_base_trades') , ref('pancakeswap_v3_linea_base_trades') , ref('horizondex_linea_base_trades') + , ref('uniswap_v3_zksync_base_trades') ] %} WITH base_union AS ( diff --git a/dex/models/trades/linea/platforms/uniswap_v3_linea_base_trades.sql b/dex/models/trades/linea/platforms/uniswap_v3_linea_base_trades.sql new file mode 100644 index 00000000000..f3c42938a84 --- /dev/null +++ b/dex/models/trades/linea/platforms/uniswap_v3_linea_base_trades.sql @@ -0,0 +1,21 @@ +{{ config( + schema = 'uniswap_v3_linea' + , 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_v3_trades( + blockchain = 'linea' + , project = 'uniswap' + , version = '3' + , Pair_evt_Swap = source('uniswap_v3_linea', 'UniswapV3Pool_evt_Swap') + , Factory_evt_PoolCreated = source('uniswap_v3_linea', 'UniswapV3Factory_evt_PoolCreated') + ) +}} + diff --git a/dex/seeds/trades/uniswap_linea_base_trades_seed.csv b/dex/seeds/trades/uniswap_linea_base_trades_seed.csv new file mode 100644 index 00000000000..820d3ccd3f4 --- /dev/null +++ b/dex/seeds/trades/uniswap_linea_base_trades_seed.csv @@ -0,0 +1,4 @@ +blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw +linea,uniswap,3,2024-06-18,0x9a565c9faab8d043b23c0f46fd3e499f102c03c58fceba98052c6985bdcf163d,10,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,0x176211869ca2b568f2a7d4ee941e073a821ee1ff,5659062,500000000000000000,1691314139 +linea,uniswap,3,2024-06-18,0xcc3bc023858ab85b067ab12c65dddc0a7822fb8d5e78168cf7c3354a24279cb9,5,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4,5659061,384578225348879304,2015494 +linea,uniswap,3,2024-06-18,0x0e957a3383db59cdb8ece4e99253726b571e7f939a6080e070c75e03be9e92e1,26,0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f,0x176211869ca2b568f2a7d4ee941e073a821ee1ff,5661062,527210960128358766,1794523511 diff --git a/sources/_sector/dex/trades/linea/_sources.yml b/sources/_sector/dex/trades/linea/_sources.yml index d6cad87de38..779d181843c 100644 --- a/sources/_sector/dex/trades/linea/_sources.yml +++ b/sources/_sector/dex/trades/linea/_sources.yml @@ -33,4 +33,8 @@ sources: tables: - name: Pool_evt_Swap - name: Factory_evt_PoolCreated + - name: uniswap_v3_linea + tables: + - name: UniswapV3Pool_evt_Swap + - name: UniswapV3Factory_evt_PoolCreated From 772aca2179c4747576e370a1b4ca0010212f90a2 Mon Sep 17 00:00:00 2001 From: chef-seaweed <121569855+chef-seaweed@users.noreply.github.com> Date: Tue, 18 Jun 2024 23:36:31 +0800 Subject: [PATCH 2/4] Update _schema.yml --- dex/seeds/trades/_schema.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index 7b366cf6143..a3f803fcf47 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -2010,6 +2010,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: uniswap_linea_base_trades_seed + config: + column_types: + blockchain: varchar + project: varchar + version: varchar + tx_hash: varbinary + evt_index: uint256 + block_number: uint256 + token_bought_address: varbinary + token_sold_address: varbinary + token_bought_amount_raw: uint256 + token_sold_amount_raw: uint256 + block_date: timestamp + - name: velodrome_optimism_base_trades_seed config: column_types: From f9dc78864ed3c4c03d31c554829af9d18de093b4 Mon Sep 17 00:00:00 2001 From: Huang Geyang Date: Wed, 19 Jun 2024 22:27:22 +0800 Subject: [PATCH 3/4] Fix typo --- dex/models/trades/linea/dex_linea_base_trades.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dex/models/trades/linea/dex_linea_base_trades.sql b/dex/models/trades/linea/dex_linea_base_trades.sql index b414cb49cd0..167c9aa5267 100644 --- a/dex/models/trades/linea/dex_linea_base_trades.sql +++ b/dex/models/trades/linea/dex_linea_base_trades.sql @@ -14,7 +14,7 @@ , ref('pancakeswap_v2_linea_base_trades') , ref('pancakeswap_v3_linea_base_trades') , ref('horizondex_linea_base_trades') - , ref('uniswap_v3_zksync_base_trades') + , ref('uniswap_v3_linea_base_trades') ] %} WITH base_union AS ( From 55c845fe7a76658ab0890ae13107b3994748cf03 Mon Sep 17 00:00:00 2001 From: chef-seaweed <121569855+chef-seaweed@users.noreply.github.com> Date: Wed, 19 Jun 2024 22:29:05 +0800 Subject: [PATCH 4/4] Update dex_linea_base_trades.sql --- dex/models/trades/linea/dex_linea_base_trades.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dex/models/trades/linea/dex_linea_base_trades.sql b/dex/models/trades/linea/dex_linea_base_trades.sql index b414cb49cd0..167c9aa5267 100644 --- a/dex/models/trades/linea/dex_linea_base_trades.sql +++ b/dex/models/trades/linea/dex_linea_base_trades.sql @@ -14,7 +14,7 @@ , ref('pancakeswap_v2_linea_base_trades') , ref('pancakeswap_v3_linea_base_trades') , ref('horizondex_linea_base_trades') - , ref('uniswap_v3_zksync_base_trades') + , ref('uniswap_v3_linea_base_trades') ] %} WITH base_union AS (