Query editor
with delegate as (SELECTa.evt_block_time,a.delegator,a.delegateFROM umaproject_ethereum.VotingV2_evt_DelegateSet aJOIN( SELECT delegator, MAX(evt_block_time) AS maxtime FROM umaproject_ethereum.VotingV2_evt_DelegateSet GROUP BY 1) bON a.delegator = b.delegator AND a.evt_block_time = b.maxtime), commit as (SELECTc.evt_tx_hash,c.evt_block_time,c.voter,c.ancillarydata,c.time,c.roundIDFROMumaproject_ethereum.VotingV2_evt_VoteCommitted cJOIN( SELECT voter, ancillarydata, time, roundID, MAX(evt_block_time) AS maxtime FROM umaproject_ethereum.VotingV2_evt_VoteCommitted GROUP BY 1,2,3,4) bON c.voter = b.voter AND c.evt_block_time = b.maxtime AND c.ancillarydata = b.ancillarydata and c.time = b.time and c.roundID = b.roundID), uma_staked AS (SELECTvoter, CAST(SUM(amount) as DOUBLE) / 10e17 as stakedFROMumaproject_ethereum.VotingV2_evt_StakedGROUP BY1), uma_unstaked AS (SELECTvoter, CAST(SUM(tokensSent) as DOUBLE) / 10e17 as unstakedFROMumaproject_ethereum.VotingV2_evt_ExecutedUnstakeGROUP BY1), uma_slashed AS (SELECTvoter, SUM(CASE WHEN CAST(slashedTokens AS DOUBLE) > 0 THEN CAST(slashedTokens AS DOUBLE) ELSE 0 END) / 10e17 as rewards, SUM(CASE WHEN CAST(slashedTokens AS DOUBLE) < 0 THEN CAST(slashedTokens AS DOUBLE) ELSE 0 END) / 10e17 as slashedFROMumaproject_ethereum.VotingV2_evt_VoterSlashAppliedGROUP BY 1), uma_summary AS (SELECTa.voter, SUM(a.staked) as staked, SUM(COALESCE(b.unstaked,0)) as unstaked