jkhuhnke11Summary Table
    Updated 2023-11-07
    WITH user_delegations AS (
    SELECT
    delegator,
    current_delegate,
    current_voting_power
    FROM
    (
    SELECT
    block_number,
    block_timestamp,
    tx_hash,
    delegator,
    from_delegate AS old_delegate,
    to_delegate AS current_delegate,
    raw_new_balance as current_voting_power,
    DENSE_RANK() OVER (
    PARTITION BY delegator ORDER BY block_timestamp DESC
    ) AS rank
    FROM "OPTIMISM"."CORE"."FACT_DELEGATIONS"
    WHERE status = 'SUCCESS'
    )
    WHERE rank = 1
    ),

    grp AS (
    SELECT
    LOWER(voter) as delegate,
    voting_power AS voting_power
    FROM ETHEREUM.CORE.EZ_SNAPSHOT
    WHERE space_id = 'opcollective.eth'
    QUALIFY(ROW_NUMBER() over(PARTITION BY voter
    ORDER BY
    vote_timestamp DESC)) = 1
    ),
    Run a query to Download Data