cypherosmo staking past 60
Updated 2022-05-30
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
›
⌄
with daily_delegated as (select
date_trunc('day', block_timestamp ) as block_day,
sum(cast(rtrim(attribute_value, 'uosmo') as integer)/1e6) as total_delegated
from osmosis.core.fact_msg_attributes
where msg_type = 'delegate'
and attribute_key = 'amount'
group by block_day),
daily_unbond as (
select
date_trunc('day', block_timestamp ) as block_day,
sum(cast(rtrim(attribute_value, 'uosmo') as integer)/1e6) as total_unbonded
from osmosis.core.fact_msg_attributes
where msg_type = 'unbond'
and attribute_key = 'amount'
group by block_day),
net_delegated as (select
d.block_day,
d.total_delegated,
u.total_unbonded,
d.total_delegated - u.total_unbonded as net_delegated,
sum(net_delegated) over (order by d.block_day asc rows between unbounded preceding and current row) as OSMO_staked
from daily_delegated d, daily_unbond u
where d.block_day = u.block_day)
select * from net_delegated
where block_day > current_date() - 60
Run a query to Download Data