Query editor
with arb_deposit as (selectdate_trunc('day', block_time) as day,sum(bytearray_to_int256(substring(data from 1 for 32))/1e18) as totfrom arbitrum.logswhere contract_address = 0x29b9fd9941caa27c1d778abb5fddafe85821283e --sCUand topic0 = 0x34194be2f096bdb2ad418add902a4da76d3d6f6d387d86d857f56c7711ecca70and block_time > cast('2024-05-01' as timestamp)group by 1),arb_withdraw as (selectdate_trunc('day', block_time) as day,sum(bytearray_to_int256(substring(data from 1 for 32))/1e18) as totfrom arbitrum.logswhere contract_address = 0x29b9fd9941caa27c1d778abb5fddafe85821283e --staking v3and topic0 = 0xe5df19de43c8c04fd192bc68e484b2593570925fbb6ad8c07ccafbc2aa5c37a1and block_time > cast('2024-05-01' as timestamp)group by 1),scu_m as (selectdate_trunc('day', evt_block_time) as day,sum(value/1e18) as sCUfrom erc20_arbitrum.evt_transferwhere contract_address = 0x29b9fd9941caA27c1D778AbB5fddafE85821283Eand evt_block_time > cast('2024-05-01' as timestamp)and "from" = 0x0000000000000000000000000000000000000000group by 1),scu_b as (selectdate_trunc('day', evt_block_time) as day,sum(value/1e18) as sCUfrom erc20_arbitrum.evt_transferwhere contract_address = 0x29b9fd9941caA27c1D778AbB5fddafE85821283Eand evt_block_time > cast('2024-05-01' as timestamp)and "to" = 0x0000000000000000000000000000000000000000group by 1),days as (selectcast(day as timestamp) as dayfrom unnest(sequence(date('2024-05-01'), cast(now() as date), interval '1' day)) as t(day))selectd.day,coalesce(de.tot,0) as cu_deposit,coalesce(w.tot,0) as cu_withdraw,sum(coalesce(de.tot,0)) over (order by d.day) - sum(coalesce(w.tot,0)) over (order by d.day) as cu_staked,coalesce(m.sCU,0) as scu_mint,coalesce(b.sCU,0) as scu_burn,sum(coalesce(m.sCU,0)) over (order by d.day) - sum(coalesce(b.sCU,0)) over (order by d.day) as sCU_circulatingfrom days dleft join arb_deposit de on d.day = de.dayleft join arb_withdraw w on d.day = w.dayleft join scu_m m on d.day = m.dayleft join scu_b b on d.day = b.dayorder by 1 desc