Query editor
WITHorderly_arbitrum_deposits (chain, flow_type, hour, day, week, total) as (SELECT'arbitrum' as chain,'deposit' as flow_type,date_trunc('hour', evt_block_time) as stat_hour, -- Convert to hourdate_trunc('day', evt_block_time) as stat_date, -- Convert to daydate_trunc('week', evt_block_time) as stat_week, -- Convert to weeksum(value / power(10, 6)) as deposit_valueFROMerc20_arbitrum.evt_TransferWHEREcontract_address = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 AND to = 0x816f722424b49cf1275cc86da9840fbd5a6167e9GROUP BY3, 4, 5ORDER BYstat_hour DESC),orderly_arbitrum_withdrawals (chain, flow_type, hour, day, week, total) as (SELECT'arbitrum' as chain,'withdrawal' as flow_type,date_trunc('hour', evt_block_time) as stat_hour, -- Convert to hourdate_trunc('day', evt_block_time) as stat_date, -- Convert to daydate_trunc('week', evt_block_time) as stat_week, -- Convert to week-1 * sum(value / power(10, 6)) as withdrawal_valueFROMerc20_arbitrum.evt_TransferWHEREcontract_address = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 AND "from" = 0x816f722424b49cf1275cc86da9840fbd5a6167e9GROUP BY3, 4, 5ORDER BYstat_hour DESC),orderly_optimism_deposits (chain, flow_type, hour, day, week, total) as (SELECT'optimism' as chain,'deposit' as flow_type,date_trunc('hour', evt_block_time) as stat_hour, -- Convert to hourdate_trunc('day', evt_block_time) as stat_date, -- Convert to daydate_trunc('week', evt_block_time) as stat_week, -- Convert to weeksum(value / power(10, 6)) as deposit_valueFROMerc20_optimism.evt_TransferWHEREcontract_address = 0x0b2c639c533813f4aa9d7837caf62653d097ff85 AND to = 0x816f722424B49Cf1275cc86DA9840Fbd5a6167e9GROUP BY3, 4, 5ORDER BYstat_hour DESC),orderly_optimism_withdrawals (chain, flow_type, hour, day, week, total) as (SELECT'optimism' as chain,'withdrawal' as flow_type,date_trunc('hour', evt_block_time) as stat_hour, -- Convert to hourdate_trunc('day', evt_block_time) as stat_date, -- Convert to daydate_trunc('week', evt_block_time) as stat_week, -- Convert to week