NavidCopy of Untitled Query
    Updated 2022-12-14
    with proposal_transactions as (
    select
    tx_id, ATTRIBUTE_VALUE as proposal_id
    from
    cosmos.core.fact_msg_attributes
    where
    ATTRIBUTE_KEY= 'proposal_id' and ATTRIBUTE_VALUE='82' and tx_succeeded
    ), senders as (
    select
    a.tx_id,
    a.ATTRIBUTE_VALUE as sender,
    b.proposal_id
    from
    cosmos.core.fact_msg_attributes a join proposal_transactions b using (tx_id)
    where
    a.ATTRIBUTE_KEY='sender'
    ), votes as (
    select
    block_timestamp,
    tx_id,
    s.proposal_id,
    s.sender,
    try_parse_json(a.ATTRIBUTE_VALUE) as jsonvals,
    jsonvals['option'] as vote,
    jsonvals['weight'] as weight,
    case
    when vote = '1' then 'Yes'
    when vote = '2' then 'Abstain'
    when vote = '3' then 'No'
    when vote = '4' then 'No With Veto'
    end as vote_label
    from
    cosmos.core.fact_msg_attributes a join senders s using (tx_id)
    where
    ATTRIBUTE_KEY='option'
    ), d_votes as (
    Run a query to Download Data