hess5 Recent Proposals
    Updated 2023-01-26
    with final as ( select max(block_timestamp) as date , proposal_id
    from terra.core.fact_governance_votes
    group by 2)
    ,
    proposal as ( select DISTINCT proposal_id
    from final
    order by 1 desc
    limit 5)
    ,
    proposal_info as ( select proposal_id, count(DISTINCT(voter)) as total_voter,
    count(DISTINCT(tx_id)) as total_votes, sum(vote_weight) as total_power
    from terra.core.fact_governance_votes
    where block_timestamp >= '2022-11-19'
    and proposal_id in (select proposal_id from proposal)
    group by 1)
    ,
    yes as ( select proposal_id , count(DISTINCT(tx_id)) as YES
    from terra.core.fact_governance_votes
    where vote_option_text = 'Yes'
    and proposal_id in (select proposal_id from proposal)
    group by 1)
    ,
    no_ as ( select proposal_id , count(DISTINCT(tx_id)) as NO
    from terra.core.fact_governance_votes
    where vote_option_text = 'No'
    and proposal_id in (select proposal_id from proposal)
    group by 1)
    ,
    abstain as ( select proposal_id , count(DISTINCT(tx_id)) as Abstain
    from terra.core.fact_governance_votes
    where vote_option_text = 'Abstain'
    and proposal_id in (select proposal_id from proposal)
    group by 1)
    ,
    other as ( select proposal_id , count(DISTINCT(tx_id)) as NoWithVeto
    from terra.core.fact_governance_votes
    Run a query to Download Data