Query editor
with arb_deposit as (selectsubstring(topic1 from 13 for 20) as address,sum(bytearray_to_int256(substring(data from 1 for 32))/1e18) as depositsfrom arbitrum.logswhere contract_address = 0x942be15783585a542f77289f0723a7ee29e66c2e --sCUand topic0 = 0x34194be2f096bdb2ad418add902a4da76d3d6f6d387d86d857f56c7711ecca70and block_time > cast('2024-05-01' as timestamp)group by 1),arb_withdraw as (selectsubstring(topic2 from 13 for 20) as address,sum(bytearray_to_int256(substring(data from 1 for 32))/1e18) as withdrawsfrom arbitrum.logswhere contract_address = 0x942be15783585a542f77289f0723a7ee29e66c2e --staking v3and topic0 = 0xe5df19de43c8c04fd192bc68e484b2593570925fbb6ad8c07ccafbc2aa5c37a1and block_time > cast('2024-05-01' as timestamp)group by 1),scu_m as (selectto as player,sum(value/1e18) as sCUfrom erc20_arbitrum.evt_transferwhere contract_address = 0x942be15783585a542f77289f0723a7ee29e66c2eand evt_block_time > cast('2024-05-01' as timestamp)and "from" = 0x0000000000000000000000000000000000000000group by 1),scu_b as (select"from" as player,sum(value/1e18) as sCUfrom erc20_arbitrum.evt_transferwhere contract_address = 0x942be15783585a542f77289f0723a7ee29e66c2eand evt_block_time > cast('2024-05-01' as timestamp)and "to" = 0x0000000000000000000000000000000000000000group by 1)selectd.address,coalesce(d.deposits,0) as deposits,coalesce(w.withdraws,0) as withdraws,coalesce(d.deposits,0) - coalesce(w.withdraws,0) as CULP_Staked,coalesce(sm.sCU,0) as scu_minted,coalesce(sb.sCU,0) as scu_burned,coalesce(sm.sCU,0) - coalesce(sb.sCU,0) as sCULP_balancefrom arb_deposit dleft join arb_withdraw w on d.address = w.addressleft join scu_m sm on d.address = sm.playerleft join scu_b sb on d.address = sb.playerorder by CULP_Staked desc