CryptoIcicleUntitled Query
    Updated 2023-02-16
    -- Examine grants funding since the launch of Terra 2. If possible, identify the grants transactions (feel free to supplement this with off-chain research to identify who’s been funded and in what amounts).
    -- Based on your investigation, produce a simple, clean dashboard that tracks grant funding thus far on Terra 2.


    with txns as (
    select
    attributes:transfer:amount/1e6 as amount,
    attributes:transfer:currency as currency,
    attributes:transfer:recipient as recipient,
    attributes:transfer:sender as sender,
    message_value:contract as contract,
    *
    from terra.core.ez_messages
    where 1=1
    and message_value:msg:execute:proposal_id is not null
    and amount > 0
    ),
    passed_proposals as (
    select
    proposal_id,
    count(*) as n_total,
    count_if(vote_option_text = 'Yes') as n_yes,
    count_if(vote_option_text in ('No', 'NoWithVeto')) as n_no,
    count_if(vote_option_text in ('Abstain')) as n_abstain,
    100 * (n_yes/n_total) as yes_pct,
    100 * (n_no/n_total) as no_pct,
    100 * (n_abstain/n_total) as abstain_pct
    from terra.core.fact_governance_votes
    where tx_succeeded = 'TRUE'
    and proposal_id not in ('3460')
    group by 1
    having yes_pct > 50
    ),
    proposals as (
    select
    e.message_value:content:title as title,
    Run a query to Download Data