CryptoIcicleTerra-152.Pleasure to Burn
Updated 2022-02-27
99
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
›
⌄
-- Payout 0.59 LUNA
-- Grand Prize 1.77 LUNA
-- Level Beginner
-- Terra Q152: How much LUNA has been burned over the past 30 days?
-- How has the supply of UST changed over the same time period?
-- Display both of these, using visualizations.
with luna_burn_txns as (
select
date_trunc('day',block_timestamp) as date,
sum(event_attributes:offer[0]:amount/1e6) as luna_burn_amount,
sum(luna_burn_amount) over (order by date asc rows between unbounded preceding and current row) as cum_luna_burn_amount
from terra.msg_events
where
event_type = 'swap'
and event_attributes:offer[0]:denom = 'uluna' and event_attributes:swap_coin[0]:denom = 'uusd'
and msg_type = 'market/MsgSwap'
and (event_attributes:offer[0]:amount/1e6) > 0
and block_timestamp >= CURRENT_DATE - 30
group by date
),
ust_supply as (
select
date,
sum(balance) as ust_supply
from terra.daily_balances
where currency = 'UST'
and date >= CURRENT_DATE - 30
group by date
)
select
t.date,
t.luna_burn_amount,
Run a query to Download Data