saber-jlNakamoto coefficient before prop 196
Updated 2022-11-02Copy 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 delegate as (select sum(amount/pow(10, 6)) as delegate, VALIDATOR_ADDRESS
from osmosis.core.fact_staking
where CURRENCY = 'uosmo'
and BLOCK_TIMESTAMP < '2022-04-13'
and ACTION in ('delegate', 'redelegate')
and TX_STATUS = 'SUCCEEDED'
group by 2
order by 1 DESC ),
undelegate as (select sum(amount/pow(10, 6)) as undelegate, VALIDATOR_ADDRESS
from osmosis.core.fact_staking
where CURRENCY = 'uosmo'
and BLOCK_TIMESTAMP < '2022-04-13'
and ACTION = 'undelegate'
and TX_STATUS = 'SUCCEEDED'
group by 2
order by 1 DESC),
total as (
select sum (delegate - undelegate) as total_voting_power
from delegate d
join undelegate u
on d.VALIDATOR_ADDRESS = u.VALIDATOR_ADDRESS),
alll as (select d.VALIDATOR_ADDRESS, sum (delegate - undelegate) as voting_power
from delegate d
join undelegate u
on d.VALIDATOR_ADDRESS = u.VALIDATOR_ADDRESS
where delegate > undelegate
group by 1
order by 2 desc),
cum as (select VALIDATOR_ADDRESS, voting_power,
sum(voting_power) over (order by voting_power desc) as cum_power,
Run a query to Download Data