angealgovernance__n_gov_votes
Updated 2023-01-17
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
›
⌄
with votes as(
-- votes on core protocol stuff
select
voter AS address,
count(distinct proposal_id) as n_gov_votes
from terra.gov_vote
where block_timestamp > current_date - interval '90 days'
group by address
union
-- votes for protocols based on the gov contracts
select
--event_attributes:contract_address::string as staking_contract,
event_attributes:voter::string as address,
count( distinct tx_id ) as n_gov_votes
from terra.msg_events
where event_type = 'from_contract'
and event_attributes:action = 'cast_vote'
and block_timestamp > current_date - 90
group by 1
)
select
v.address,
sum(v.n_gov_votes) as n_governance_votes
from
votes v
group by 1;
Run a query to Download Data