Metiocrenumber of voters pre day
    Updated 2022-05-24
    -- Return the last 60 days proposal votes
    WITH all_proposals AS
    (SELECT block_timestamp :: DATE AS DATE,
    attribute_value AS proposal,
    tx_id
    FROM osmosis.core.fact_msg_attributes
    WHERE block_timestamp > CURRENT_DATE()-60
    AND msg_type = 'proposal_vote'
    AND attribute_key = 'proposal_id')

    -- Count daily terra and non-terra governance votes
    SELECT allp.date as date,
    CASE
    WHEN allp.proposal not IN ('172', '222', '223', '224', '225', '226', '227', '228', '230', '234') THEN 'non-terra'
    ELSE 'terra'
    END AS prop_type,
    COUNT(prop_type) as number_of_votes,
    count(distinct txs.tx_from) as number_of_voters
    FROM all_proposals as allp
    left join osmosis.core.fact_transactions as txs on allp.tx_id=txs.tx_id
    GROUP BY allp.date, prop_type

    Run a query to Download Data