maybeyonasterra_luna_market_swap
Updated 2022-04-18
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
›
⌄
with market_swap as (
select
block_timestamp,
tx_id,
case event_type
when 'burn' then 'burn'
when 'coinbase' then 'mint'
end as event,
case event_type
when 'burn' then event_attributes:burner::string
when 'coinbase' then event_attributes:minter::string
end as user,
event_attributes:amount[0]:denom::string as asset,
event_attributes:amount[0]:amount/pow(10,6) as amount,
case event_type
when 'burn' then -amount
when 'coinbase' then amount
end as vector
from terra.msg_events
where tx_status = 'SUCCEEDED'
and event_type in ('burn','coinbase')
and msg_type = 'market/MsgSwap'
and block_timestamp >= current_date - interval '30 days'
)
select
date(block_timestamp) as date,
event,
sum(amount) as luna
from market_swap
where asset = 'uluna'
group by 1,2
order by event desc
Run a query to Download Data