-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathdex_ronin_base_trades.sql
50 lines (47 loc) · 1.05 KB
/
dex_ronin_base_trades.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{{ config(
schema = 'dex_ronin'
, alias = 'base_trades'
, materialized = 'view'
)
}}
{% set base_models = [
ref('katana_v2_ronin_base_trades')
, ref('katana_v3_ronin_base_trades')
, ref('tamadotmeme_v1_ronin_base_trades')
] %}
WITH base_union AS (
SELECT *
FROM (
{% for base_model in base_models %}
SELECT
blockchain
, project
, version
, block_month
, block_date
, block_time
, block_number
, token_bought_amount_raw
, token_sold_amount_raw
, token_bought_address
, token_sold_address
, taker
, maker
, project_contract_address
, tx_hash
, evt_index
FROM
{{ base_model }}
{% if not loop.last %}
UNION ALL
{% endif %}
{% endfor %}
)
)
{{
add_tx_columns(
model_cte = 'base_union'
, blockchain = 'ronin'
, columns = ['from', 'to', 'index']
)
}}