jkhuhnke11AAVE - Delegated AAVE By Number of Votes
    Updated 2023-05-13
    WITH monthly_v AS (
    SELECT
    voter,
    voting_power AS vp,
    count(*) as num_votes
    FROM ethereum.core.ez_snapshot
    WHERE space_id = 'aave.eth'
    GROUP BY voter, voting_power

    UNION ALL

    SELECT
    voter,
    voting_power / POW(10, 18) AS vp,
    count(*) as num_votes
    FROM ethereum.aave.ez_votes
    GROUP BY voter, voting_power
    ),
    bals AS (
    SELECT
    voter,
    sum(vp) as vp,
    sum(num_votes) as num_votes
    FROM monthly_v
    GROUP BY voter
    ),
    voted AS (
    SELECT
    sum(vp) AS vt
    FROM bals
    WHERE num_votes = 1
    ),
    last_30 AS (
    SELECT
    sum(vp) as l30
    FROM bals
    Run a query to Download Data