SocioAnalyticaValidator's Vote
Updated 2024-06-12
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 json as (
SELECT livequery.live.udf_api ('https://api.flipsidecrypto.com/api/v2/queries/92d28ac2-933b-44e6-98c1-c61bac6eebc3/data/latest') as resp
)
,
account as (
SELECT value:ADDRESS as address,
value:ACCOUNT_ADDRESS as account_address
FROM json,
LATERAL FLATTEN(input => resp:data)
)
, main as (
SELECT
rank,
label as validator_name,
round(delegator_shares/1e6,2) as voting_power,
round(100 * voting_power / total_staked.total_value_staked,2) as "Rate of Share %",
round(sum("Rate of Share %") over (ORDER BY rank),2) as "Cumulative Share %",
a.address as validator_address,
b.account_address
FROM cosmos.gov.fact_validators a
JOIN account b using(address)
CROSS JOIN (
SELECT
sum(delegator_shares/1e6) as total_value_staked
FROM
cosmos.gov.fact_validators a
JOIN account b using(address)
) AS total_staked
ORDER BY rank
),
vote as (
SELECT
voter,
CASE when vote_option = 1 then 'YES'
when vote_option = 2 then 'ABSTAIN'
when vote_option = 3 then 'NO'
QueryRunArchived: QueryRun has been archived