John_GaltLuna and UST mints and burns
Updated 2022-05-05
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
›
⌄
WITH luna as (select
date(block_timestamp) as date,
sum(token_0_amount) as burnt_luna,
sum(token_1_amount) as minted_ust,
sum(burnt_luna) over (ORDER BY date) as cum_burnt_luna,
sum(minted_ust) over (ORDER BY date) as cum_minted_ust
from terra.swaps
where date between dateadd(day, -90, current_date) and current_date
and swap_pair = 'LUNA to UST'
and tx_status = 'SUCCEEDED'
group by date
),
ust as (select
date(block_timestamp) as date,
sum(token_0_amount) as burnt_ust,
sum(token_1_amount) as minted_luna,
sum(burnt_ust) over (ORDER BY date) as cum_burnt_ust,
sum(minted_luna) over (ORDER BY date) as cum_minted_luna
from terra.swaps
where date between dateadd(day, -90, current_date) and current_date
and swap_pair = 'UST to LUNA'
and tx_status = 'SUCCEEDED'
group by date
),
final as (select luna.date, burnt_ust, burnt_luna, minted_ust, minted_luna,
minted_ust - burnt_ust as net_minted_ust,
burnt_luna - minted_luna as net_burnt_luna,
sum(net_minted_ust) over (order by luna.date) as cum_ust_mint,
sum(net_burnt_luna) over (order by luna.date) as cum_luna_burn
from luna
left outer join ust on luna.date = ust.date
order by date
)
Run a query to Download Data