Query editor
WITH raw_swap AS (SELECT*FROM sei.logsWHEREcontract_address = 0xe51331cf95afb5e3844ac7bc0f0a85d3bd98bb9eAND topic0 = 0x121cb44ee54098b1a04743c487e7460d8dd429b27f88b1f4d4767396e1a59f79AND block_time >= CURRENT_DATE - INTERVAL '7' day), swap_evt AS (SELECTblock_time,tx_hash,contract_address,sender,recipient,TRY_CAST(amount0 AS DECIMAL(38, 0)) AS amount0,TRY_CAST(amount1 AS DECIMAL(38, 0)) AS amount1,price,liquidity,tickFROM TABLE(DECODE_EVM_EVENT(abi => '{"anonymous":false,"inputs":[{"indexed":true, "internalType":"address", "name":"sender", "type":"address"},{"indexed":true, "internalType":"address", "name":"recipient", "type":"address"},{"indexed":false,"internalType":"int256", "name":"amount0", "type":"int256"},{"indexed":false,"internalType":"int256", "name":"amount1", "type":"int256"},{"indexed":false,"internalType":"uint160", "name":"price", "type":"uint160"},{"indexed":false,"internalType":"uint128", "name":"liquidity", "type":"uint128"},{"indexed":false,"internalType":"int24", "name":"tick", "type":"int24"},{"indexed":false,"internalType":"uint24", "name":"overrideFee","type":"uint24"},{"indexed":false,"internalType":"uint24", "name":"pluginFee", "type":"uint24"}],"name":"Swap","type":"event"}',input => TABLE(raw_swap)))), swap_norm AS (SELECTblock_time,recipient,ABS(amount0) AS abs_amount0,ABS(amount1) AS abs_amount1FROM swap_evt), addr_vol AS (SELECTrecipient,SUM(abs_amount0) AS vol0,SUM(abs_amount1) AS vol1FROM swap_normGROUP BYrecipient), tot_vol AS (SELECTSUM(abs_amount0) AS tot0,SUM(abs_amount1) AS tot1