nits% Staked LUNA Over Time
Updated 2022-12-15Copy 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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with t1 as
(select
date_trunc('day',BLOCK_TIMESTAMP) as date,
sum(case when FROM_CURRENCY='uluna' then FROM_AMOUNT/1e6 else null end) as from_amount_,
sum(case when to_CURRENCY='uluna' then FROM_AMOUNT/1e6 else null end) as to_amount_ ,
from_amount_-to_amount_ as circulating_volume,
sum(circulating_volume) over (order by date) as circulating_supply
from
terra.core.ez_swaps
group by date
), sender as
(select sum(AMOUNT) as sent, SENDER
from
terra.core.ez_transfers
WHERE
CURRENCY='uluna'
group by 2),
receiver as
(select sum(AMOUNT) as rec, RECEIVER
from
terra.core.ez_transfers
WHERE
CURRENCY='uluna'
group by 2),
total_ as
(select sum(rec)/1e4 as total_supply from receiver a left join sender b on a.RECEIVER=b.SENDER
where sent is null) ,
supply as
(select * , circulating_supply/(SELECT * from total_)*100 as ratio from t1
where ratio >=0 and circulating_supply >0 )
SELECT *, cum_amount/1e9*100 as percent_staked from
(SELECT date(block_timestamp) as day, count(DISTINCT tx_id) as total_txs,
count(DISTINCT delegator_address) as total_delegators,
sum(case when action = 'undelegate' then amount*(-1) else amount end ) as total_amount,
Run a query to Download Data