iboo-jbj2MVQuestion 146-Whale Voters
Updated 2022-02-15
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
›
⌄
with tb as(
with tb1 as(
select
voter AS address,
count(distinct proposal_id) as n_gov_votes
from terra.gov_vote
where block_timestamp > current_date - 90
and voter in(select distinct address from terra.daily_balances where balance_usd>1200000 and date= CURRENT_DATE-1)
and tx_status = 'SUCCEEDED'
group by address
union
select
msg_value:sender::string as address,
count(distinct tx_id) as n_gov_votes
from terra.msgs
where block_timestamp > current_date - 90
and msg_value:contract in (
'terra1f32xyep306hhcxxxf7mlyh0ucggc00rm2s9da5', --anchor
'terra1wh39swv7nq36pnefnupttm2nr96kz7jjddyt2x' --mir
)
and msg_value:execute_msg:cast_vote is not null
and address in(select address from terra.daily_balances where balance_usd>1200000 and date= CURRENT_DATE-1)
and tx_status = 'SUCCEEDED'
group by 1
)
select
count(v.n_gov_votes) as vt_whale
from
tb1 v),
tb2 as (select count(distinct address) as tot_whl from terra.daily_balances where balance_usd>1200000 and date= CURRENT_DATE-1)
select tot_whl,vt_whale, vt_whale/tot_whl*100 as Percentage_whl from tb, tb2
Run a query to Download Data