From 7209efe344e8a5513e6befc1c656fdfa86301416 Mon Sep 17 00:00:00 2001 From: hinus <64959125+cxheng315@users.noreply.github.com> Date: Mon, 30 Dec 2024 17:06:27 +0800 Subject: [PATCH] feat: add katana v3 dex ronin (#7354) * feat: add katana v3 dex ronin * Update _sources.yml fix source not found * Update katana_v3_ronin_base_trades.sql add line break * merge katana seed file * fix file not found in schema --------- Co-authored-by: 0xRob <83790096+0xRobin@users.noreply.github.com> Co-authored-by: Huang Geyang --- .../dex/models/trades/ronin/_schema.yml | 31 ++++++++++++++++--- .../trades/ronin/dex_ronin_base_trades.sql | 3 +- ...es.sql => katana_v2_ronin_base_trades.sql} | 2 +- .../platforms/katana_v3_ronin_base_trades.sql | 21 +++++++++++++ dbt_subprojects/dex/seeds/trades/_schema.yml | 12 +++---- .../trades/katana_ronin_base_trades_seed.csv | 4 ++- sources/_sector/dex/trades/ronin/_sources.yml | 6 +++- 7 files changed, 64 insertions(+), 15 deletions(-) rename dbt_subprojects/dex/models/trades/ronin/platforms/{katana_ronin_base_trades.sql => katana_v2_ronin_base_trades.sql} (98%) create mode 100644 dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql diff --git a/dbt_subprojects/dex/models/trades/ronin/_schema.yml b/dbt_subprojects/dex/models/trades/ronin/_schema.yml index 9d9035dda64..9402dc644cc 100644 --- a/dbt_subprojects/dex/models/trades/ronin/_schema.yml +++ b/dbt_subprojects/dex/models/trades/ronin/_schema.yml @@ -5,19 +5,40 @@ models: data_tests: - check_dex_info_relationship - - name: katana_ronin_base_trades + - name: katana_v2_ronin_base_trades meta: blockchain: ronin sector: dex project: katana - contributors: jeff-dude + contributors: jeff-dude, cxheng315 config: - tags: [ 'ronin', 'dex', 'trades', 'katana' ] - description: "Katana ronin base trades" + tags: ["ronin", "dex", "trades", "katana"] + description: "Katana v2 ronin base trades" data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: - tx_hash - evt_index - check_dex_base_trades_seed: - seed_file: ref('katana_ronin_base_trades_seed') \ No newline at end of file + seed_file: ref('katana_ronin_base_trades_seed') + filter: + version: 2 + + - name: katana_v3_ronin_base_trades + meta: + blockchain: ronin + sector: dex + project: katana + contributors: cxheng315 + config: + tags: ["ronin", "dex", "trades", "katana"] + description: "Katana v3 ronin base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('katana_ronin_base_trades_seed') + filter: + version: 3 diff --git a/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql b/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql index 1cd7eaa3262..108ff7cd73d 100644 --- a/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ronin/dex_ronin_base_trades.sql @@ -6,7 +6,8 @@ }} {% set base_models = [ - ref('katana_ronin_base_trades') + ref('katana_v2_ronin_base_trades') + , ref('katana_v3_ronin_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/ronin/platforms/katana_ronin_base_trades.sql b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v2_ronin_base_trades.sql similarity index 98% rename from dbt_subprojects/dex/models/trades/ronin/platforms/katana_ronin_base_trades.sql rename to dbt_subprojects/dex/models/trades/ronin/platforms/katana_v2_ronin_base_trades.sql index c2f1d62f8a6..e6a6eeb4997 100644 --- a/dbt_subprojects/dex/models/trades/ronin/platforms/katana_ronin_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v2_ronin_base_trades.sql @@ -1,5 +1,5 @@ {{ config( - schema = 'katana_ronin' + schema = 'katana_v2_ronin' , alias = 'base_trades' , materialized = 'incremental' , file_format = 'delta' diff --git a/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql new file mode 100644 index 00000000000..ad3b9dd5e27 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/ronin/platforms/katana_v3_ronin_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'katana_v3_ronin' + , 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 = 'ronin' + , project = 'katana' + , version = '3' + , Pair_evt_Swap = source('katana_dex_ronin', 'KatanaV3Pool_evt_Swap') + , Factory_evt_PoolCreated = source('katana_dex_ronin', 'KatanaV3Factory_evt_PoolCreated') + ) +}} diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index da4c398563d..dd32d6da28d 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4454,7 +4454,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: infusion_base_base_trades_seed config: column_types: @@ -4514,7 +4514,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: akronswap_base_base_trades_seed config: column_types: @@ -4529,7 +4529,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: katana_ronin_base_trades_seed config: column_types: @@ -4559,7 +4559,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: elk_finance_gnosis_base_trades_seed config: column_types: @@ -4574,7 +4574,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: levinswap_gnosis_base_trades_seed config: column_types: @@ -4604,7 +4604,7 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp - + - name: fluid_ethereum_base_trades_seed config: column_types: diff --git a/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv index d8a0d2f8ea0..a34825a4783 100644 --- a/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/katana_ronin_base_trades_seed.csv @@ -1,3 +1,5 @@ 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 ronin,katana,2,2024-01-17,0xca2c3b5d6aec890d5bfe1fb8616036a01b702948107fdb4a243453cfe5a6d86a,10,0x1b918543b518e34902e1e8dd76052bee43c762ff,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,31230074,12492104858888467232497,5109345881300390132 -ronin,katana,2,2023-03-01,0xcab674e07e3c5b0b6dd53b52971edabc929a2fd907b85d781f70bac74767c6e3,10,0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,22465731,1700000000000000,3070678253641756888 \ No newline at end of file +ronin,katana,2,2023-03-01,0xcab674e07e3c5b0b6dd53b52971edabc929a2fd907b85d781f70bac74767c6e3,10,0xc99a6a985ed2cac1ef41640596c5a5f9f4e19ef5,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,22465731,1700000000000000,3070678253641756888 +ronin,katana,3,2024-12-19,0x92f922acbb1a4a80b2ad56d8b6ce2cc587f2851fac7b3e37582f7578db55ee4d,160,0xc6046fa4b8961b0e9d823bb3f2dde8fe161d547d,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,40907478,234401580938417717096,26553212520000000000 +ronin,katana,3,2024-12-19,0x340763e80131db74ce992733518944ad35d1290aaae53f5eeacaeb994057f49e,39,0xe514d9deb7966c8be0ca922de8a064264ea6bcd4,0x0b7007c13325c48911f73a2dad5fa5dcbf808adc,40908371,141505036347788395809,300000000 diff --git a/sources/_sector/dex/trades/ronin/_sources.yml b/sources/_sector/dex/trades/ronin/_sources.yml index 8c61432710f..4e40c27221e 100644 --- a/sources/_sector/dex/trades/ronin/_sources.yml +++ b/sources/_sector/dex/trades/ronin/_sources.yml @@ -4,4 +4,8 @@ sources: - name: katana_dex_ronin tables: - name: KatanaPair_evt_Swap - - name: KatanaFactory_evt_PairCreated \ No newline at end of file + - name: KatanaFactory_evt_PairCreated + - name: katana_dex_ronin + tables: + - name: KatanaV3Pool_evt_Swap + - name: KatanaV3Factory_evt_PoolCreated