headitmanager6osmo
Updated 2022-11-21
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
with balance_tbl as (select sum(BALANCE/pow(10,6)) as osmo_balance , ADDRESS from osmosis.core.fact_daily_balances
where CURRENCY = 'uosmo' and DATE= '2022-09-04' and BALANCE_TYPE='staked'
group by address)
, proposals_tbl as (select VOTER,VOTE_OPTION,BLOCK_TIMESTAMP,PROPOSAL_ID from osmosis.core.fact_governance_votes
where PROPOSAL_ID in (361,362,363,365) and TX_STATUS='SUCCEEDED')
, data_tbl as (select VOTER,VOTE_OPTION,BLOCK_TIMESTAMP,PROPOSAL_ID,osmo_balance from balance_tbl
inner join proposals_tbl on ADDRESS=VOTER )
, more_vote_tbl as (select VOTER , count(distinct VOTE_OPTION) as different_vote , PROPOSAL_ID from data_tbl
group by VOTER,PROPOSAL_ID
having different_vote >= 2)
select count(1) , case
when osmo_balance < 1 then 'less than 1 OSMO'
when osmo_balance >=1 and osmo_balance <10 then 'between 1 to 10 OSMO'
when osmo_balance >=10 and osmo_balance <100 then 'between 10 to 100 OSMO'
when osmo_balance >=100 and osmo_balance <1000 then 'between 100 to 1000 OSMO'
when osmo_balance >=1000 and osmo_balance <10000 then 'between 1000 to 10000 OSMO'
when osmo_balance >=10000 then 'more than 10000 OSMO' end as category from data_tbl
where PROPOSAL_ID=365
group by category
Run a query to Download Data