Query editor
withnative_token as (selecttime, blockchain, case when blockchain = 'ethereum' then 'ETH'when blockchain = 'arbitrum' then 'ETH'when blockchain = 'optimism' then 'ETH'when blockchain = 'polygon' then 'MATIC'when blockchain = 'bnb' then 'BNB'when blockchain = 'avalanche_c' then 'AVAX'when blockchain = 'fantom' then 'FTM'when blockchain = 'gnosis' then 'XDAI'end as symbol, case when blockchain = 'ethereum' then 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2when blockchain = 'arbitrum' then 0x82af49447d8a07e3bd95bd0d56f35241523fbab1when blockchain = 'optimism' then 0x4200000000000000000000000000000000000006when blockchain = 'polygon' then 0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270when blockchain = 'bnb' then 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095cwhen blockchain = 'avalanche_c' then 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7when blockchain = 'fantom' then 0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83when blockchain = 'gnosis' then 0xe91d153e0b41518a2ce8dd3d7944fa863463a97dend as contract_address, sum(amount) as amountfrom (selectdate_trunc('day', block_time) as time, blockchain, sum(cast(value as double) / pow(10,18)) as amountfrom evms.traceswhere to in (0x908f0a969d71bb71c56f4f0909c58a42d0ec1481, 0x20bb82f2db6ff52b42c60ce79cde4c7094ce133f, 0x6d4c67d5bc8797380802c07550d861d40dfddf02, 0xcB93a5880f9d9E855aA08B1cE3211ae06539463d)and block_time >= cast('2023-03-16' as timestamp)and successand (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null)group by 1 ,2union allselectdate_trunc('day', block_time) as time, blockchain, sum(cast(value as double) / pow(10,18)) * (-1) as amountfrom evms.traceswhere "from" in (0x908f0a969d71bb71c56f4f0909c58a42d0ec1481, 0x20bb82f2db6ff52b42c60ce79cde4c7094ce133f, 0x6d4c67d5bc8797380802c07550d861d40dfddf02, 0xcB93a5880f9d9E855aA08B1cE3211ae06539463d)and block_time >= cast('2023-03-16' as timestamp)and successand (call_type not in ('delegatecall', 'callcode', 'staticcall') or call_type is null)group by 1 ,2)group by 1,2,3,4), erc20 as (select