Mufasaproposals with highest number of voters
    Updated 2023-01-26
    with users as (
    select
    proposal_id,
    min(block_timestamp) as vote_minimum
    from terra.core.fact_governance_votes
    group by proposal_id
    order by vote_minimum desc
    limit 5
    ), data_one as (
    select
    *,
    proposal.tx_id
    from users join terra.core.fact_governance_submit_proposal proposal using
    (proposal_id)
    ), data_two as (
    select
    one.proposal_id,
    message.message_value:content:title as content,
    message.message_value:content:description as description
    from data_one one
    join terra.core.ez_messages message using(tx_id)
    )
    select
    to_date(block_timestamp) as date,
    concat(proposal_id,':', content) as proposal_id,
    count(distinct tx_id) as count_of_votes,
    count(distinct voter) as count_of_voters,
    sum(count_of_votes) over (partition by proposal_id order by date asc rows between unbounded preceding and current row) as cummulative_count_of_votes,
    sum(count_of_voters) over (partition by proposal_id order by date asc rows between unbounded preceding and current row) as cummulative_count_of_voters
    from terra.core.fact_governance_votes vote
    join data_two using (proposal_id)
    group by date, proposal_id, content
    order by cummulative_count_of_voters desc
    -- limit 10
    Run a query to Download Data