Query editor
/* This is a pre-processing query that parses raw Ambient traces into something thathigh level queries will be able to work with easily. It doesn't parse every possiblecommand, just what I thought was needed - liquidity, limit orders, and swaps. */WITH eth_croc_traces AS (SELECT1 as chain_id, t.tx_hash as tx_hash,bytearray_substring(t.input, 1, 4) AS method_id,t.tx_index as t_tx_index, t.block_number as t_block_number, t.block_time,outer_call.to as tx_to,try(map(ARRAY[0x3d719cd9, 0xa15112f9, 0x13fd34f4, 0x08719070, 0x90b33ce5, 0x7c6dfe3d, 0x7b370fc2, 0x2370632b, 0x2ee11587],ARRAY['swap', 'userCmd', 'protocolCmd', 'userCmdRelayer', 'userCmdRouter', 'micro_burnConcLp', 'micro_swap', 'micro_mintConcLp', 'micro_mintAmbLp'])[bytearray_substring(t.input, 1, 4)]) as method,CASE bytearray_substring(t.input, 1, 4)WHEN 0xa15112f9 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 29, 4))WHEN 0x13fd34f4 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 29, 4))END as callpath_idx,CASE bytearray_substring(t.input, 1, 4)WHEN 0xa15112f9 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 96 + 29, 4))WHEN 0x13fd34f4 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 128 + 29, 4))END as cmd_idx,t.input, t.outputFROM ethereum.traces as tINNER JOIN ethereum.traces as outer_call ON outer_call.block_number = t.block_number AND outer_call.tx_index = t.tx_index AND outer_call.trace_address = ARRAY[]WHEREt.block_number >= 17361664 AND (t.to = 0xaaaaaaaaa24eeeb8d57d431224f73832bc34f688 OR t.to = 0xf241bEf0Ea64020655C70963ef81Fea333752367 OR t.to = 0x396d435f5d0756c6f7edd82e6c67bdc6c093985d) AND t.success), scroll_croc_traces AS (SELECT534352 as chain_id, t.tx_hash as tx_hash,bytearray_substring(t.input, 1, 4) AS method_id,t.tx_index as t_tx_index, t.block_number as t_block_number, t.block_time,outer_call.to as tx_to,try(map(ARRAY[0x3d719cd9, 0xa15112f9, 0x13fd34f4, 0x08719070, 0x90b33ce5, 0x7c6dfe3d, 0x7b370fc2, 0x2370632b, 0x2ee11587],ARRAY['swap', 'userCmd', 'protocolCmd', 'userCmdRelayer', 'userCmdRouter', 'micro_burnConcLp', 'micro_swap', 'micro_mintConcLp', 'micro_mintAmbLp'])[bytearray_substring(t.input, 1, 4)]) as method,CASE bytearray_substring(t.input, 1, 4)WHEN 0xa15112f9 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 29, 4))WHEN 0x13fd34f4 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 29, 4))END as callpath_idx,CASE bytearray_substring(t.input, 1, 4)WHEN 0xa15112f9 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 96 + 29, 4))WHEN 0x13fd34f4 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 128 + 29, 4))END as cmd_idx,t.input, t.outputFROM scroll.traces as tINNER JOIN scroll.traces as outer_call ON outer_call.block_number = t.block_number AND outer_call.tx_index = t.tx_index AND outer_call.trace_address = ARRAY[]WHEREt.block_number >= 267408 AND (t.to = 0xaaaaaaaacb71bf2c8cae522ea5fa455571a74106 OR t.to = 0x646929453e753565467f330110850885ead93fa9 OR t.to = 0x418c68ce5b73783abe178db12dfee9375d965dbb) AND t.success), blast_croc_traces AS (SELECT81457 as chain_id, t.tx_hash as tx_hash,bytearray_substring(t.input, 1, 4) AS method_id,t.tx_index as t_tx_index, t.block_number as t_block_number, t.block_time,outer_call.to as tx_to,try(map(ARRAY[0x3d719cd9, 0xa15112f9, 0x13fd34f4, 0x08719070, 0x90b33ce5, 0x7c6dfe3d, 0x7b370fc2, 0x2370632b, 0x2ee11587],ARRAY['swap', 'userCmd', 'protocolCmd', 'userCmdRelayer', 'userCmdRouter', 'micro_burnConcLp', 'micro_swap', 'micro_mintConcLp', 'micro_mintAmbLp'])[bytearray_substring(t.input, 1, 4)]) as method,CASE bytearray_substring(t.input, 1, 4)WHEN 0xa15112f9 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 29, 4))WHEN 0x13fd34f4 THEN bytearray_to_integer(bytearray_substring(t.input, 4 + 29, 4))