Query editor
WITHV2 as (SELECTvarbinary_substring(topic1,13) as user,varbinary_substring(topic2,13) as proxyfromethereum.logswhereblock_number >= 21683156and contract_address = 0x636dEb767Cd7D0f15ca4aB8eA9a9b26E98B426AC -- liquity v2 governanceand topic0 = 0xda66ba232f4fb8c122b7026f55eeff1d0b9cf2560b7873b2bba6eaab4c3d5989 -- DeployUserProxy),l AS (SELECTevt_block_time as t,newStake as amount,if(staker in (select proxy from V2), (select user from v2 where staker = proxy),staker) as address,if(staker in (select proxy from V2), 2, 1) as vFROMliquity_ethereum.LQTYStaking_evt_StakeChanged),m as (select max(t) as last, address from l group by address),n as (select m.address as address, l.amount as amount, l.t as last_action, l.vFROMljoin mon l.t=m.last and l.address=m.address)select CONCAT('<a href=https://debank.com/profile/', CAST(address AS VARCHAR), ' target=_blank>👛</a> <a href=https://etherscan.io/address/', CAST(address AS VARCHAR),' target=_blank>🔎</a>') AS "Links",case addresswhen 0x6665e62ef6f6db29d5f8191fbac472222c2cc80f then 'The Defi Collective'when 0x02feb744ca516fd6e41d940ae2d0f7cb6fcb1ac3 then 'Rozengarden.eth'else cast(address as varchar)end as address,amount / power(10,18) as "amount staked",format('%.2f%%', amount / cast((select sum(amount) from n) as double) * 100) as "ratio",v as "version",last_action as "last action",format('%.2f%%', (select sum(amount) from n where v = 2) / cast((select sum(amount) from n) as double) * 100) as "migration"from n where amount != 0order by "amount staked" desc--select sum(amount) from n