MeirVotes per Proposal
    Updated 2023-06-08
    with proposals as (
    SELECT
    DECODED_LOG:description::string as description,
    DECODED_LOG:endBlock::string as end_block,
    DECODED_LOG:proposer::string as proposer,
    DECODED_LOG:proposalId::string as proposal_id,
    -- DECODED_LOG:targets::string as targets,
    BLOCK_TIMESTAMP
    FROM ethereum.core.ez_decoded_event_logs
    WHERE CONTRACT_ADDRESS = lower('0x7e880d8bD9c9612D6A9759F96aCD23df4A4650E6')
    AND EVENT_NAME = 'ProposalCreated'
    ORDER BY BLOCK_TIMESTAMP DESC
    ),

    most_recent_vote as (
    SELECT
    DECODED_LOG:voter::string as voter_list,
    DECODED_LOG:proposalId::string as proposal_id_list,
    MAX(BLOCK_TIMESTAMP) as max_time
    FROM ethereum.core.ez_decoded_event_logs
    WHERE CONTRACT_ADDRESS = lower('0x7e880d8bD9c9612D6A9759F96aCD23df4A4650E6')
    AND EVENT_NAME = 'VoteCast'
    GROUP BY proposal_id_list, voter_list
    ),

    votes as (
    SELECT
    logs.DECODED_LOG:support::int as support,
    logs.DECODED_LOG:voter::string as voter,
    (logs.DECODED_LOG:weight::int / pow(10,18)) as weight,
    logs.DECODED_LOG:proposalId::string as proposal_id,
    logs.DECODED_LOG:reason::string as reason,
    case
    Run a query to Download Data