Skip to content

Commit

Permalink
Add Thruster Dex Trades Blast - Ready for review (duneanalytics#6193)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
henrystats authored Jun 19, 2024
1 parent eda823e commit 2dd53e4
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 1 deletion.
1 change: 1 addition & 0 deletions dex/models/dex_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
17 changes: 17 additions & 0 deletions dex/models/trades/blast/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
1 change: 1 addition & 0 deletions dex/models/trades/blast/dex_blast_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
106 changes: 106 additions & 0 deletions dex/models/trades/blast/platforms/thruster_blast_base_trades.sql
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

7 changes: 7 additions & 0 deletions dex/seeds/trades/thruster_blast_base_trades_seed.csv
Original file line number Diff line number Diff line change
@@ -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
10 changes: 9 additions & 1 deletion sources/_sector/dex/trades/blast/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@ sources:
- name: uniswap_v2_blast
tables:
- name: Pair_evt_Swap
- name: UniswapV2Factory_evt_PairCreated
- 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

0 comments on commit 2dd53e4

Please sign in to comment.