Query editor
-- Daily swap volume from a Uniswap V3 pool on Robinhood Chain.-- amounts are signed int256 in raw wei; abs and cast before SUM to preserve precision.WITH swaps AS (SELECTblock_time,bytearray_to_int256(bytearray_substring(data, 1, 32)) AS amount0,bytearray_to_int256(bytearray_substring(data, 33, 32)) AS amount1FROM robinhood.logsWHERE contract_address = {{pool_address}}AND topic0 = 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67),sided AS (SELECTdate_trunc('day', block_time) AS day,CAST(CASE WHEN {{cashcat_is_token0}} THEN abs(amount0) ELSE abs(amount1) END AS DECIMAL(38,0)) AS cashcat_raw,CAST(CASE WHEN {{cashcat_is_token0}} THEN abs(amount1) ELSE abs(amount0) END AS DECIMAL(38,0)) AS paired_rawFROM swaps)SELECTday,SUM(cashcat_raw) / 1e18 AS cashcat_volume,SUM(paired_raw) / 1e18 AS paired_volume,COUNT(*) AS swap_countFROM sidedGROUP BY 1ORDER BY 1;