jkhuhnke11dYdX votes
    Updated 2023-11-07
    -- all on-chain dYdX votes
    WITH all_votes AS (
    SELECT
    tx_hash,
    block_timestamp :: date as date,
    origin_from_address :: STRING as voter,
    decoded_log :id :: STRING as proposal,
    decoded_log :votingPower / POW(10, 18) :: NUMBER as voting_power,
    'on-chain' as type
    FROM ethereum.core.ez_decoded_event_logs
    WHERE origin_to_address = '0x7e9b1672616ff6d6629ef2879419aae79a9018d2' --dYdX on-chain governance contract
    AND origin_function_signature = '0x612c56fa'

    UNION

    -- Snapshot Voting
    SELECT
    id :: STRING as tx_hash,
    vote_timestamp :: date as date,
    voter :: STRING as voter,
    proposal_id :: STRING as proposal,
    voting_power,
    'snapshot' as type
    FROM ETHEREUM.CORE.EZ_SNAPSHOT
    WHERE space_id = 'dydxgov.eth'
    ),
    all_votes2 AS (
    SELECT
    voter,
    proposal,
    voting_power,
    tag_name,
    start_date,
    tag_type,
    end_date
    FROM all_votes v
    Run a query to Download Data