bergCompare Number of Voters of Each Proposal
    Updated 2022-12-12
    with nonfirstvoters as (
    select block_timestamp,
    tx_id,
    a.attribute_value as voter,
    try_parse_json (c.attribute_value) as metadata,
    metadata:option as vote_option,
    case vote_option
    when '1' then 'Yes'
    when'2' then 'Abstain'
    when '3' then 'No'
    when '4' then 'No With Veto'
    end as vote_value
    from cosmos.core.fact_msg_attributes a
    join cosmos.core.fact_msg_attributes b
    using(tx_id)
    join cosmos.core.fact_msg_attributes c
    using(tx_id)
    where a.attribute_key = 'spender'
    and b.attribute_key = 'proposal_id'
    and b.attribute_value = '82'
    and c.attribute_key = 'option'
    and a.tx_succeeded = 1
    ),

    firstvoters as (
    select tx_id,
    b.block_timestamp,
    b.attribute_value as voter,
    a.attribute_value as proposal_id,
    try_parse_json (c.attribute_value) as metadata,
    metadata:option as vote_option,
    case vote_option when '1' then 'Yes'
    when '2' then 'Abstain'
    when '3' then 'No'
    when '4' then 'No With Veto'
    end as vote_type,
    Run a query to Download Data