Yousefi_1994 Governance Grind - Comparing the text of last 5 proposals
Updated 2023-01-25
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 last_5_proposal as (
select
proposal_id
from terra.core.fact_governance_votes
group by proposal_id
order by proposal_id desc
limit 5
),
governance_votes_transactions as (
select
tx_id,
block_timestamp,
voter,
proposal_id,
vote_option_text
from terra.core.fact_governance_votes
where tx_succeeded = true
and proposal_id in (select proposal_id from last_5_proposal)
),
governance_votes_counter as (
select
proposal_id,
count(distinct tx_id) as "Number of Vote",
count(case when vote_option_text = 'Yes' then 1 else null end) as "Number of Yes Vote",
count(case when vote_option_text = 'No' then 1 else null end) as "Number of No Vote",
count(case when vote_option_text = 'NoWithVeto' then 1 else null end) as "Number of NoWithVeto"
from governance_votes_transactions
group by proposal_id
),
governance_votes_counter_result as (
select
proposal_id,
round(("Number of Yes Vote" / "Number of Vote") * 100, 2) as "Percentage of Yes",
round(("Number of No Vote" / "Number of Vote") * 100, 2) as "Percentage of No",
round(("Number of NoWithVeto" / "Number of Vote") * 100, 2) as "Percentage of NoWithVeto"
from governance_votes_counter
Run a query to Download Data