Query editor
WITH constants AS (SELECT0x8a996eB1AC6580662b66CE5Df7f1892EA6382e72 AS eth_router,0xB8d19Db51A912010b913201af33CB0CF5Df1FE83 AS arc_router,0x0077777d7EBA4688BDeF3E311b846F25870A19B9 AS arc_gateway,0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 AS sepolia_usdc,0x3600000000000000000000000000000000000000 AS arc_usdc,0x0bbc62c9760c4e6230e96c4ca2e552fad6a3303452628a4896b7639c52af99fe AS topic_intent_created,0x0eb883d6a0b2911c24f0275bda12f45653399f51c081d8e8f15d394848a04e43 AS topic_intent_executed,0xbcaef82d4a9a7d07e7ef1ff44bfc3369019874b5f70d1063b5fb88149ea8f3b4 AS topic_remote_recorded), lifecycle AS (SELECT 'ethereumSepolia' AS chain_key, 4 AS stage_order, 'destination_router_tx' AS stage, concat('0x', to_hex(tx.hash)) AS tx_hash, concat('0x', to_hex(tx."from")) AS actor, concat('0x', to_hex(tx."to")) AS product_address, tx.block_time, tx.block_number, cast(tx.success AS varchar) AS status, cast(tx.gas_used AS double) AS gas_or_amount, 'tx_hash' AS join_key_type, concat('0x', to_hex(tx.hash)) AS join_keyFROM sepolia.transactions tx, constants cWHERE tx.block_date >= current_date - interval '180' day AND (tx."to" = c.eth_router OR tx."from" = c.eth_router)UNION ALLSELECT 'ethereumSepolia' AS chain_key, CASE WHEN l.topic0=c.topic_intent_created THEN 5 WHEN l.topic0=c.topic_intent_executed THEN 6 ELSE 7 END AS stage_order, CASE WHEN l.topic0=c.topic_intent_created THEN 'router_intent_created' WHEN l.topic0=c.topic_intent_executed THEN 'router_intent_executed' ELSE 'remote_intent_recorded' END AS stage, concat('0x', to_hex(l.tx_hash)) AS tx_hash, concat('0x', to_hex(l.tx_from)) AS actor, concat('0x', to_hex(l.contract_address)) AS product_address, l.block_time, l.block_number, 'log' AS status, cast(l.index AS double) AS gas_or_amount, 'intent_id_topic1' AS join_key_type, concat('0x', to_hex(l.topic1)) AS join_keyFROM sepolia.logs l, constants cWHERE l.block_date >= current_date - interval '180' day AND l.contract_address=c.eth_router AND l.topic0 IN (c.topic_intent_created, c.topic_intent_executed, c.topic_remote_recorded)UNION ALLSELECT 'ethereumSepolia' AS chain_key, 3 AS stage_order, 'destination_router_usdc_flow' AS stage, concat('0x', to_hex(t.evt_tx_hash)) AS tx_hash, CASE WHEN t."to"=c.eth_router THEN concat('0x', to_hex(t."from")) ELSE concat('0x', to_hex(t."to")) END AS actor, concat('0x', to_hex(c.eth_router)) AS product_address, t.evt_block_time AS block_time, t.evt_block_number AS block_number, CASE WHEN t."to"=c.eth_router THEN 'token_in' ELSE 'token_out' END AS status, cast(t.value AS double) AS gas_or_amount, 'tx_hash_user_amount' AS join_key_type, concat('0x', to_hex(t.evt_tx_hash)) AS join_keyFROM erc20_sepolia.evt_transfer t, constants cWHERE t.evt_block_date >= current_date - interval '180' day AND t.contract_address=c.sepolia_usdc AND (t."from"=c.eth_router OR t."to"=c.eth_router)UNION ALLSELECT 'arcTestnet' AS chain_key, 3 AS stage_order, 'arc_product_usdc_flow' AS stage, concat('0x', to_hex(t.evt_tx_hash)) AS tx_hash, CASE WHEN t."to" IN (c.arc_router,c.arc_gateway) THEN concat('0x', to_hex(t."from")) ELSE concat('0x', to_hex(t."to")) END AS actor, CASE WHEN t."to" IN (c.arc_router,c.arc_gateway) THEN concat('0x', to_hex(t."to")) ELSE concat('0x', to_hex(t."from")) END AS product_address, t.evt_block_time AS block_time, t.evt_block_number AS block_number, CASE WHEN t."to" IN (c.arc_router,c.arc_gateway) THEN 'token_in' ELSE 'token_out' END AS status, cast(t.value AS double) AS gas_or_amount, 'tx_hash_user_amount' AS join_key_type, concat('0x', to_hex(t.evt_tx_hash)) AS join_keyFROM erc20_arc.evt_transfer t, constants cWHERE t.evt_block_date >= current_date - interval '180' day AND t.contract_address=c.arc_usdc AND (t."from" IN (c.arc_router,c.arc_gateway) OR t."to" IN (c.arc_router,c.arc_gateway)))SELECT * FROM lifecycleORDER BY block_time DESC, stage_orderLIMIT 1000