freemartianProposals
    Updated 2023-05-10


    with delegatees AS (
    SELECT
    decoded_log:delegatee AS Delegatee,
    count(distinct decoded_log:delegator) AS delegated_wallets
    FROM ethereum.core.fact_decoded_event_logs
    WHERE contract_address = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
    AND event_name in ('DelegateChanged')
    GROUP BY delegatee
    HAVING delegated_wallets > 2
    )

    SELECT
    'Delegates' AS User_Type,
    proposal_id,
    sum(voting_power)/pow(10,18) AS voting_powerr
    FROM ethereum.aave.ez_votes
    WHERE voter IN (SELECT delegatee FROM delegatees)
    AND block_timestamp > current_date - 180
    GROUP BY proposal_id

    UNION

    SELECT
    'Regular Users' AS User_Type,
    proposal_id,
    sum(voting_power)/pow(10,18) AS voting_powerr
    FROM ethereum.aave.ez_votes
    WHERE voter NOT IN (SELECT delegatee FROM delegatees)
    AND block_timestamp > current_date - 180
    GROUP BY proposal_id




    Run a query to Download Data