kidaLUNA-UST UST Volume
Updated 2021-09-06Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
›
⌄
SELECT
CASE
WHEN event_attributes:contract_address = 'terra1tndcaqxkpc5ce9qee5ggqf430mr2z3pefe5wj6' THEN 'LUNA-UST'
WHEN event_attributes:to = 'terra1pn20mcwnmeyxf68vpt3cyel3n57qm9mp289jta' OR event_attributes:from = 'terra1pn20mcwnmeyxf68vpt3cyel3n57qm9mp289jta' THEN 'LOTA-UST'
WHEN event_attributes:to = 'terra1c0afrdc5253tkp5wt7rxhuj42xwyf2lcre0s7c' OR event_attributes:from = 'terra1c0afrdc5253tkp5wt7rxhuj42xwyf2lcre0s7c' THEN 'bETH-UST'
ELSE 'UNKNOWN'
END as pair,
MIN(block_timestamp) as start_time,
SUM(CASE event_attributes:ask_asset
WHEN 'uusd' THEN event_attributes:ask_amount
ELSE event_attributes:offer_amount
END) / 1e6 as ust_volume
FROM
terra.msg_events
WHERE
tx_status = 'SUCCEEDED'
AND event_attributes:ask_asset IS NOT NULL
AND event_attributes:offer_asset IS NOT NULL
AND event_type = 'from_contract'
AND block_timestamp >= CURRENT_TIMESTAMP - interval'24 hours'
AND (event_attributes:contract_address = 'terra1tndcaqxkpc5ce9qee5ggqf430mr2z3pefe5wj6' OR event_attributes:to IN ('terra1pn20mcwnmeyxf68vpt3cyel3n57qm9mp289jta', 'terra1c0afrdc5253tkp5wt7rxhuj42xwyf2lcre0s7c') OR event_attributes:from IN ('terra1pn20mcwnmeyxf68vpt3cyel3n57qm9mp289jta', 'terra1c0afrdc5253tkp5wt7rxhuj42xwyf2lcre0s7c'))
GROUP BY 1
Run a query to Download Data