Query editor
/* Delegate changes after claiming: THOSE WHO GAINED VOTING POWERtable1 with delegator, to whom they delegated prior, that person's VP previous balancetable2 with delegator, to whom they delegated now, that person's VP previous balance, current balance, Changes in VPtable3: delegator, previos delegate, prior delegate VP, change in VP, current delegate, current delagate VP, changes in VP*/withdelegateevent as (selectevt_block_time, evt_index-- , delegator, evt_tx_from -- same as delegator, evt_tx_hash, fromDelegate --old supported delegate, toDelegate -- new supported delegate, casewhen fromDelegate = 0x0000000000000000000000000000000000000000 then 'noPriorDelegation'else 'priorDelegation' end as delegationfrom op_optimism.GovernanceToken_evt_DelegateChangedwhere evt_block_date > cast('2024-02-20' as timestamp)and evt_tx_from in (select address from dune.oplabspbc.dataset_op_airdrop_4_addresses_detailed_list) -- limit for after airdrop 4-- and evt_tx_hash = 0x72d5bac931a0b49f98b92af014dd72b6ad645d55e5017009fe3c2ff67e3e7cf2), OPnewdelegated as(select e.evt_block_time, e.evt_index as eindex, v.evt_index as vindex, e.evt_tx_hash, e.evt_tx_from as delegator -- delegator or sender of OP governance token-- , e.fromDelegate as priorDelegate -- delegator or sender of OP governance token, e.toDelegate-- , v.delegate as delegate_vp_changes -- delegator whose votingPower balance changes, round(v.previousBalance/pow(10,18),2) as previousBalance, round(v.newBalance/pow(10,18),2) as newBalance, round((v.newBalance/pow(10,18) - v.previousBalance/pow(10,18)),2) as VotePowerChange, e.delegationfrom delegateevent ejoin op_optimism.GovernanceToken_evt_DelegateVotesChanged von e.evt_tx_hash = v.evt_tx_hash-- AND e.evt_index = v.evt_indexwhere evt_tx_to = 0x4200000000000000000000000000000000000042 -- filtering to make sure only OP tokens are includedand previousBalance < newBalance -- only those who GAINED VPorder by evt_block_time asc , e.evt_index asc)select *, case whenpreviousBalance = 0 then 100else round(VotePowerChange/previousBalance*(100),2) end as perc_changefrom OPnewdelegated