Skip to content

Commit 72f643f

Browse files
mike-x7fHosuke
andauthored
Add base blockchain to xchange trades (duneanalytics#6567)
Co-authored-by: Huang Geyang <Sukebeta@outlook.com>
1 parent 7c10034 commit 72f643f

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

dbt_subprojects/dex/models/_projects/xchange/xchange_trades.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
schema = 'xchange',
33
alias = 'trades',
44
materialized = 'view',
5-
post_hook='{{ expose_spells(blockchains = \'["ethereum","arbitrum", "polygon", "bnb"]\',
5+
post_hook='{{ expose_spells(blockchains = \'["ethereum", "arbitrum", "polygon", "bnb", "base"]\',
66
spell_type = "project",
77
spell_name = "xchange",
88
contributors = \'["mike-x7f"]\') }}'

dbt_subprojects/dex/models/trades/base/_schema.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,3 +959,20 @@ models:
959959
seed_file: ref('swaap_base_base_trades_seed')
960960
filter:
961961
version: 2
962+
963+
- name: xchange_base_base_trades
964+
meta:
965+
blockchain: base
966+
sector: dex
967+
project: xchange
968+
contributors: mike-x7f
969+
config:
970+
tags: [ 'base', 'dex', 'trades', 'xchange' ]
971+
description: "xchange base base trades"
972+
tests:
973+
- dbt_utils.unique_combination_of_columns:
974+
combination_of_columns:
975+
- tx_hash
976+
- evt_index
977+
- check_dex_base_trades_seed:
978+
seed_file: ref('xchange_base_base_trades_seed')

dbt_subprojects/dex/models/trades/base/dex_base_base_trades.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
, ref('clipper_base_base_trades')
4949
, ref('solidly_v3_base_base_trades')
5050
, ref('swaap_v2_base_base_trades')
51+
, ref('xchange_base_base_trades')
5152
] %}
5253

5354
WITH base_union AS (
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{
2+
config(
3+
schema = 'xchange_base',
4+
alias = 'base_trades',
5+
materialized = 'incremental',
6+
file_format = 'delta',
7+
incremental_strategy = 'merge',
8+
unique_key = ['tx_hash', 'evt_index'],
9+
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')]
10+
)
11+
}}
12+
13+
{{
14+
uniswap_compatible_v2_trades(
15+
blockchain = 'base',
16+
project = 'xchange',
17+
version = '1',
18+
Pair_evt_Swap = source('xchange_base', 'XchangePair_evt_Swap'),
19+
Factory_evt_PairCreated = source('xchange_base', 'XchangeFactory_evt_PairCreated')
20+
)
21+
}}

dbt_subprojects/dex/seeds/trades/_schema.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,21 @@ seeds:
22342234
token_bought_amount_raw: uint256
22352235
token_sold_amount_raw: uint256
22362236
block_date: timestamp
2237+
2238+
- name: xchange_base_base_trades_seed
2239+
config:
2240+
column_types:
2241+
blockchain: varchar
2242+
project: varchar
2243+
version: varchar
2244+
tx_hash: varbinary
2245+
evt_index: uint256
2246+
block_number: uint256
2247+
token_bought_address: varbinary
2248+
token_sold_address: varbinary
2249+
token_bought_amount_raw: uint256
2250+
token_sold_amount_raw: uint256
2251+
block_date: timestamp
22372252

22382253
- name: zigzag_arbitrum_base_trades_seed
22392254
config:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
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
2+
base,xchange,1,2024-08-15,0x2a3e91e59a74f74cfdca447437ebc8749a697dbd56956a3a3936d6efa2f3cb37,325,0xf6e932ca12afa26665dc4dde7e27be02a7c02e50,0x4200000000000000000000000000000000000006,18480405,122587776469893054305789,500000000000000
3+
base,xchange,1,2024-08-15,0xae8b1651af59df2527c31a13a99430a003da224c2dc17c144de56ab2de3d489f,77,0x4200000000000000000000000000000000000006,0xf6e932ca12afa26665dc4dde7e27be02a7c02e50,18480492,332883871677823,81578878681084805870785

sources/_sector/dex/trades/base/_sources.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,8 @@ sources:
177177
- name: ClipperPackedVerifiedExchange_evt_Swapped
178178
- name: swaap_v2_base
179179
tables:
180-
- name: Vault_evt_Swap
180+
- name: Vault_evt_Swap
181+
- name: xchange_base
182+
tables:
183+
- name: XchangePair_evt_Swap
184+
- name: XchangeFactory_evt_PairCreated

0 commit comments

Comments
 (0)