Query editor
-- Immutable legacy_router3-movement bridge for the 2026-07-23 tail re-cut.-- E19 backfill revision (2026-07-23): the original snapshot read-- result_tycho_router_call_fact_v3_live, whose last refresh covered through-- 2026-07-22 ~12:0x UTC, so [2026-07-22 12:01, 2026-07-23) was missing-- (TY16 raw_tail_missing_movement_key = 3,204). Part 1 keeps the live-- snapshot strictly below 2026-07-22; part 2 re-derives the full 2026-07-22-- day with the EXACT movement-tail logic (bounds only), leaving no overlap-- and no gap against the >= 2026-07-23 tails.-- D-059 cutoff-specialized exact movement tail for Router3 legacy. Raw calls,-- all three physical trace branches, and all five log branches are bounded-- >= 2026-07-23 and < current UTC date + 1 day.-- Source-pinned exact movement for the router3 legacy generation.-- The trace establishes each token/sender/receiver input pair in the router-- call subtree. Exact atomics are the matching ERC20 Transfer event amounts;-- every pair must be owned by one router call and event counts must equal-- transfer trace counts. A same-pair collision is also exact when the complete-- transaction-level multiset of exact nominal trace amounts equals the event-- multiset; each call then receives only its own descendant-trace sum.---- The three source-pinned Ethereum native-input singleSwap calls whose router-- frame has msg.value=0 are exact only when the call subtree has one positive-- native movement total, it originates at the router, it is neither a self nor-- caller refund, it equals declared amount, and no positive WETH movement is-- present. Ambiguity and non-conforming tokens/calls fail closed.WITHraw_router_calls AS (SELECT *FROM dune.propeller_heads.result_tycho_router_call_raw_v3_tailWHERE call_class = 'swap'AND parser_status = 'parsed_declared_input'AND abi_family = 'router3_legacy'AND (block_time >= TIMESTAMP '2026-07-22 00:00:00' AND block_time < TIMESTAMP '2026-07-23 00:00:00')),recognized_calls AS (SELECT*,CASEWHEN trace_address IS NULL OR cardinality(trace_address) = 0THEN ''ELSE array_join(transform(trace_address,x -> lpad(CAST(x AS VARCHAR), 10, '0')),'.')END AS router_trace_sort_key,token_in_raw IN (0x0000000000000000000000000000000000000000,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) AS token_in_is_nativeFROM raw_router_calls),router3_relevant_transactions AS (SELECT DISTINCT chain, block_date, tx_hashFROM recognized_calls),all_relevant_traces AS (SELECT