Sbhn_NPTotal Proposals by Their Status
Updated 2023-02-17Copy Reference Fork
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
›
⌄
with voting as (
select proposal_id,
count(DISTINCT tx_id) as votes,
count(DISTINCT voter) as voters,
sum(CASE
WHEN VOTE_OPTION_TEXT = 'Yes' THEN 1
ELSE -1 end) as vote_count
from terra.core.fact_governance_votes
where tx_succeeded='TRUE'
group by 1
),
base as (
select
CASE
WHEN vote_count > 0 THEN 'Passed✅'
ELSE 'Rejected❌' END as status,
count( DISTINCT tx:body:messages[0]:content:title) as Proposal_Title
from terra.core.fact_governance_submit_proposal a
join terra.core.fact_transactions b using(tx_id)
left join voting using (proposal_id)
where proposal_type = 'CommunityPoolSpend'
group by 1
)
select
Proposal_Title ,
status
from base
Run a query to Download Data