Pmisha-bmlMdxWhales.vote.Terra
Updated 2022-02-14
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 w1 as(
with w2 as(
-- votes on core protocol stuff
select
voter AS address,
count(distinct proposal_id) as No_votes
from terra.gov_vote
where block_timestamp > current_date - 90
and voter in(select distinct address from terra.daily_balances where balance_usd>800000 and date= CURRENT_DATE-1)
and tx_status = 'SUCCEEDED'
group by address
union
-- votes for protocols based on the gov contracts below
select
--msg_value:contract::string as staking_contract,
msg_value:sender::string as address,
count(distinct tx_id) as No_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>800000 and date= CURRENT_DATE-1)
and tx_status = 'SUCCEEDED'
group by 1
)
select
--v.address,
count(v.No_votes) as voted_whale
from
w2 v),
tot_whale as (select count(distinct address) as number_whales from terra.daily_balances where balance_usd>800000 and date= CURRENT_DATE-1)
Run a query to Download Data