From 2dd53e44eef2a66ae7d5c3489f182769e033c746 Mon Sep 17 00:00:00 2001 From: henrystats <65398020+henrystats@users.noreply.github.com> Date: Wed, 19 Jun 2024 18:52:48 +0100 Subject: [PATCH] Add Thruster Dex Trades Blast - Ready for review (#6193) * Add Uniswap Blast (V2 & V3) * fix seed naming * push * Update tests * trigger rerun * smol fix * Add Thruster Blast Dex Trades * fix typo * add schema for seed file * update seed and x (formerly twitter) username * fix version --- dex/models/dex_info.sql | 1 + dex/models/trades/blast/_schema.yml | 17 +++ .../trades/blast/dex_blast_base_trades.sql | 1 + .../platforms/thruster_blast_base_trades.sql | 106 ++++++++++++++++++ dex/seeds/trades/_schema.yml | 16 +++ .../thruster_blast_base_trades_seed.csv | 7 ++ sources/_sector/dex/trades/blast/_sources.yml | 10 +- 7 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 dex/models/trades/blast/platforms/thruster_blast_base_trades.sql create mode 100644 dex/seeds/trades/thruster_blast_base_trades_seed.csv diff --git a/dex/models/dex_info.sql b/dex/models/dex_info.sql index 85c78a54fe6..2004f6edba6 100644 --- a/dex/models/dex_info.sql +++ b/dex/models/dex_info.sql @@ -160,4 +160,5 @@ FROM (VALUES , ('nile', 'Nile', 'Direct', 'Nile') , ('nuri', 'Nuri', 'Direct', 'nuriexchange') , ('icecreamswap', 'IceCreamSwap', 'Direct', 'icecream_swap') + , ('thruster', 'Thruster Finance', 'Direct', 'ThrusterFi') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/dex/models/trades/blast/_schema.yml b/dex/models/trades/blast/_schema.yml index e74f37f10ef..4bf2719ad92 100644 --- a/dex/models/trades/blast/_schema.yml +++ b/dex/models/trades/blast/_schema.yml @@ -42,3 +42,20 @@ models: seed_file: ref('uniswap_blast_base_trades_seed') filter: version: 2 + + - name: thruster_blast_base_trades + meta: + blockchain: blast + sector: dex + project: thruster + contributors: Henrystats + config: + tags: [ 'blast', 'dex', 'trades', 'thruster' ] + description: "Thruster blast v2 base trades" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('thruster_blast_base_trades_seed') diff --git a/dex/models/trades/blast/dex_blast_base_trades.sql b/dex/models/trades/blast/dex_blast_base_trades.sql index d97b4ba73d4..532614cd02f 100644 --- a/dex/models/trades/blast/dex_blast_base_trades.sql +++ b/dex/models/trades/blast/dex_blast_base_trades.sql @@ -8,6 +8,7 @@ {% set base_models = [ ref('uniswap_v3_blast_base_trades') , ref('uniswap_v2_blast_base_trades') + , ref('thruster_blast_base_trades') ] %} WITH base_union AS ( diff --git a/dex/models/trades/blast/platforms/thruster_blast_base_trades.sql b/dex/models/trades/blast/platforms/thruster_blast_base_trades.sql new file mode 100644 index 00000000000..8ba9252ca12 --- /dev/null +++ b/dex/models/trades/blast/platforms/thruster_blast_base_trades.sql @@ -0,0 +1,106 @@ +{{ + config( + schema = 'thruster_blast', + 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')] + ) +}} + +WITH + +dexs_v1_30bps AS ( + {{ + uniswap_compatible_v2_trades( + blockchain = 'blast', + project = 'thruster', + version = 'UNI-V2-30bps', + Pair_evt_Swap = source('thruster_blast', 'ThrusterPair_V2_Point_3_Fee_evt_Swap'), + Factory_evt_PairCreated = source('thruster_blast', 'ThrusterFactory_Point_3_Fee_evt_PairCreated') + ) + }} +), + +dexs_v1_100bps AS ( + {{ + uniswap_compatible_v2_trades( + blockchain = 'blast', + project = 'thruster', + version = 'UNI-V2-100bps', + Pair_evt_Swap = source('thruster_blast', 'ThrusterPair_V2_1_Fee_evt_Swap'), + Factory_evt_PairCreated = source('thruster_blast', 'ThrusterFactory_1_Fee_evt_PairCreated') + ) + }} +), + +dexs_v1_univ3 AS ( + {{ + uniswap_compatible_v3_trades( + blockchain = 'blast' + , project = 'thruster' + , version = 'UNI-V3' + , Pair_evt_Swap = source('thruster_blast', 'ThrusterPool_V3_Point_3_Fee_evt_Swap') + , Factory_evt_PoolCreated = source('thruster_blast', 'ThrusterPoolFactory_evt_PoolCreated') + ) + }} +) + +SELECT + dexs_v1_30bps.blockchain, + dexs_v1_30bps.project, + dexs_v1_30bps.version, + dexs_v1_30bps.block_month, + dexs_v1_30bps.block_date, + dexs_v1_30bps.block_time, + dexs_v1_30bps.block_number, + dexs_v1_30bps.token_bought_amount_raw, + dexs_v1_30bps.token_sold_amount_raw, + dexs_v1_30bps.token_bought_address, + dexs_v1_30bps.token_sold_address, + dexs_v1_30bps.taker, + dexs_v1_30bps.maker, + dexs_v1_30bps.project_contract_address, + dexs_v1_30bps.tx_hash, + dexs_v1_30bps.evt_index +FROM dexs_v1_30bps +UNION ALL +SELECT + dexs_v1_100bps.blockchain, + dexs_v1_100bps.project, + dexs_v1_100bps.version, + dexs_v1_100bps.block_month, + dexs_v1_100bps.block_date, + dexs_v1_100bps.block_time, + dexs_v1_100bps.block_number, + dexs_v1_100bps.token_bought_amount_raw, + dexs_v1_100bps.token_sold_amount_raw, + dexs_v1_100bps.token_bought_address, + dexs_v1_100bps.token_sold_address, + dexs_v1_100bps.taker, + dexs_v1_100bps.maker, + dexs_v1_100bps.project_contract_address, + dexs_v1_100bps.tx_hash, + dexs_v1_100bps.evt_index +FROM dexs_v1_100bps +UNION ALL +SELECT + dexs_v1_univ3.blockchain, + dexs_v1_univ3.project, + dexs_v1_univ3.version, + dexs_v1_univ3.block_month, + dexs_v1_univ3.block_date, + dexs_v1_univ3.block_time, + dexs_v1_univ3.block_number, + dexs_v1_univ3.token_bought_amount_raw, + dexs_v1_univ3.token_sold_amount_raw, + dexs_v1_univ3.token_bought_address, + dexs_v1_univ3.token_sold_address, + dexs_v1_univ3.taker, + dexs_v1_univ3.maker, + dexs_v1_univ3.project_contract_address, + dexs_v1_univ3.tx_hash, + dexs_v1_univ3.evt_index +FROM dexs_v1_univ3 \ No newline at end of file diff --git a/dex/seeds/trades/_schema.yml b/dex/seeds/trades/_schema.yml index c5fec7dd907..44f1e46e863 100644 --- a/dex/seeds/trades/_schema.yml +++ b/dex/seeds/trades/_schema.yml @@ -3720,3 +3720,19 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: thruster_blast_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 + diff --git a/dex/seeds/trades/thruster_blast_base_trades_seed.csv b/dex/seeds/trades/thruster_blast_base_trades_seed.csv new file mode 100644 index 00000000000..be8a88bd43a --- /dev/null +++ b/dex/seeds/trades/thruster_blast_base_trades_seed.csv @@ -0,0 +1,7 @@ +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 +blast,thruster,UNI-V2-100bps,2024-02-29,0x484f21348695db7d35c558d259c7caff8fe6d8ff358d084392205d5d7ac8cece,73,0x4300000000000000000000000000000000000004,0x44a2f2303933e71e5fa779ce463c7d71607e968a,204201,87453,540044297484934 +blast,thruster,UNI-V2-100bps,2024-03-02,0x22a3cec67c7ded4387810f0e91592f83224f43cc68688fe2efcdeea28f02800a,27,0x1ab36fd3ea73db6c1c4d7c1236e99f942f225550,0x4300000000000000000000000000000000000004,304466,870266525314993986598,320000000000000000 +blast,thruster,UNI-V2-30bps,2024-05-27,0x26582d34111d36c28dc77ee888461560f6daaac3a5106632a337565fb6e0e46d,138,0x2aa236e546614f18a51fcc8e4238be194d720fa4,0x4300000000000000000000000000000000000004,3985280,37417538581914724457373,2450000000000000 +blast,thruster,UNI-V2-30bps,2024-05-27,0x92412259d6e7267aa53b29a82cd546dc3ef14c5cc618990cd115f94b7178d8f0,195,0x2aa236e546614f18a51fcc8e4238be194d720fa4,0x4300000000000000000000000000000000000004,3985014,6274627375250141469648,100000000000000 +blast,thruster,UNI-V3,2024-05-14,0x1ebfe078700f79b536091785e31667394b4f63cc47921b7255b91e314421f5eb,45,0x4300000000000000000000000000000000000003,0x4300000000000000000000000000000000000004,3441478,32226590148836069138,11090000000000000 +blast,thruster,UNI-V3,2024-05-09,0x7c847b6ff32f6ecc65477f6850c59846352221308ee5a13a43e289cacb5d5637,50,0x5ffd9ebd27f2fcab044c0f0a26a45cb62fa29c06,0x4300000000000000000000000000000000000003,3210022,13539251642158192509,2382510511664620118 \ No newline at end of file diff --git a/sources/_sector/dex/trades/blast/_sources.yml b/sources/_sector/dex/trades/blast/_sources.yml index 67a7326cd80..fdca1346e77 100644 --- a/sources/_sector/dex/trades/blast/_sources.yml +++ b/sources/_sector/dex/trades/blast/_sources.yml @@ -8,4 +8,12 @@ sources: - name: uniswap_v2_blast tables: - name: Pair_evt_Swap - - name: UniswapV2Factory_evt_PairCreated \ No newline at end of file + - name: UniswapV2Factory_evt_PairCreated + - name: thruster_blast + tables: + - name: ThrusterPool_V3_Point_3_Fee_evt_Swap + - name: ThrusterPoolFactory_evt_PoolCreated + - name: ThrusterPair_V2_Point_3_Fee_evt_Swap + - name: ThrusterFactory_Point_3_Fee_evt_PairCreated + - name: ThrusterPair_V2_1_Fee_evt_Swap + - name: ThrusterFactory_1_Fee_evt_PairCreated