Query editor
-- =====================================================-- Aave Governance V3 - Current Voting Power by Delegate-- STAGE 1 (Corrected & Complete)-- Includes: AAVE + stkAAVE + aAAVE-- Independent delegation for each token-- =====================================================WITHlatest_aave_voting AS (SELECTdelegator,delegatee AS voting_delegateeFROM (SELECTdelegator,delegatee,ROW_NUMBER() OVER (PARTITION BY delegatorORDER BY evt_block_number DESC, evt_index DESC) AS rnFROM aave_ethereum.aavetoken_evt_delegatechangedWHERE delegationType = 0)WHERE rn = 1),latest_stkaave_voting AS (SELECTdelegator,delegatee AS voting_delegateeFROM (SELECTdelegator,delegatee,ROW_NUMBER() OVER (PARTITION BY delegatorORDER BY evt_block_number DESC, evt_index DESC) AS rnFROM aave_ethereum.stkaave_evt_delegatechangedWHERE delegationType = 0)WHERE rn = 1),latest_aaave_voting AS (SELECTdelegator,delegatee AS voting_delegateeFROM (SELECTdelegator,delegatee,ROW_NUMBER() OVER (PARTITION BY delegatorORDER BY evt_block_number DESC, evt_index DESC) AS rnFROM aave_v3_ethereum.atokenwithdelegation_evt_delegatechangedWHERE delegationType = 0)WHERE rn = 1),