Query editor
with constants as (select * from query_5207063), transactions as (selectcasewhentopic0 in (select ca from constants where name='transfertopic') andtopic2 in (select ca from constants where name='revwallettopic')then (casewhen contract_address in (select ca from constants where name='iUSD') then cast(varbinary_to_int256(data) as double)/1e18when contract_address in (select ca from constants where name='USDC') then cast(varbinary_to_int256(data) as double)/1e6end)whencontract_address in (select ca from constants where name='iUSD') andtopic0 in (select ca from constants where name='transfertopic') andtopic1 in (select ca from constants where name='yieldsharingtopic') andtopic2 in (select ca from constants where name in ('yieldescrowtopic','lockertopic'))thencast(varbinary_to_int256(data) as double)/1e18elsecast(varbinary_to_uint256(varbinary_ltrim(varbinary_substring(data,1,32))) as double) * (casewhencontract_address in (select ca from constants where name='USDC') andtopic0 in (select ca from constants where name='transfertopic')thencasewhentopic1 in (select ca from constants where name='proxytopic') andtopic2 in (select ca from constants where name='minttopic')then 1/1e6whentopic1 in (select ca from constants where name='redeemtopic')then -1/1e6else 0endwhen contract_address in (select ca from constants where name='iUSD') thencasewhen topic1 in (select ca from constants where name='zerotopic') then 1/1e18when topic2 in (select ca from constants where name='zerotopic') then -1/1e18when topic1 in (select ca from constants where name='stakingtopic') then -1/1e18when topic2 in (select ca from constants where name='stakingtopic') then 1/1e18else 0endwhen contract_address in (select ca from constants where name='locker') thencasewhen topic0 in (select ca from constants where name='unwindtopic') then -1/1e18when topic0 in (select ca from constants where name='locktopic') then 1/1e18else 0endend)end as amount,casewhen topic2 in (select ca from constants where name='revwallettopic') then 'revenue'when contract_address in (select ca from constants where name='USDC') then 'deposit'when contract_address in (select ca from constants where name='iUSD') thencase