CryptoIcicleTerra - 13. Terra Grants Funding
    Updated 2023-04-05
    -- 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 prices as (
    select
    recorded_hour::date as date,
    id as symbol,
    avg(close) as price_usd
    from crosschain.core.fact_hourly_prices
    where id ilike 'terra-luna-2'
    group by 1,2
    ),
    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 > 512
    ),
    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
    Run a query to Download Data