Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/with address(address) as (values(0x2faf487a4414fe77e2327f0bf4ae2a264a776ad2),(0xc098b2a3aa256d2140208c3de6543aaef5cd3a94)),inflow(val) as (select sum(cast(value as double)/pow(10,18))from ethereum.traceswhere block_time >= cast('2022-11-06' as timestamp) and block_time < cast('2022-11-07' as timestamp)and "to" IN (select address from address)and type = 'call'and (call_type not in ('delegatecall', 'staticcall', 'callcode') or call_type is null)),outflow(val) as (select -sum(cast(value as double)/pow(10,18))from ethereum.traceswhere block_time >= cast('2022-11-06' as timestamp) and block_time < cast('2022-11-07' as timestamp)and "from" IN (select address from address)and type = 'call'and (call_type not in ('delegatecall', 'staticcall', 'callcode') or call_type is null)),price as (select avg(price)from prices.usdwhere blockchain = 'ethereum' and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2and minute >= cast('2022-11-06' as timestamp) and minute < cast('2022-11-07' as timestamp))select sum(val) * (select * from price) / pow(10,6)from (select * from inflowunion allselect * from outflow)