Query editor
-- Fail closed on structural or value-integrity defects while allowing a-- bounded set of economically unresolved calls to be parked for review.-- Parked calls retain a NULL economic amount and therefore cannot enter the-- verified external-input headline.WITHr AS (SELECT *FROM dune.propeller_heads.result_tycho_router_call_raw_v3_tailWHERE call_class = 'swap'AND parser_status = 'parsed_declared_input'),m AS (SELECT * FROM dune.propeller_heads.result_tycho_movement_modern_v3_tailUNION ALLSELECT *FROM dune.propeller_heads.result_tycho_movement_legacy_router3_v3_tailUNION ALLSELECT *FROM dune.propeller_heads.result_tycho_movement_legacy_router12_v3_tail),unresolved AS (SELECTr.chain,r.tx_hash,r.router_address,m.economic_input_status,m.economic_amount_in_atomicFROM rINNER JOIN mON m.router_call_key = r.router_call_keyWHERE m.economic_input_status IS NOT NULLAND TRIM(m.economic_input_status) <> ''AND m.economic_input_status NOT LIKE 'verified_%'AND m.economic_input_status<> 'excluded_source_proven_empty_sequential_no_executor_non_dex'),checks AS (SELECT 'movement_duplicate_key' AS metric, COUNT(*) AS observedFROM (SELECT router_call_key FROM m GROUP BY 1 HAVING COUNT(*) > 1)UNION ALLSELECT 'raw_tail_missing_movement_key', COUNT(*)FROM rLEFT JOIN mON m.router_call_key = r.router_call_keyWHERE m.router_call_key IS NULLUNION ALLSELECT 'verified_tail_value_null', COUNT(*)FROM rINNER JOIN mON m.router_call_key = r.router_call_keyWHERE m.economic_input_status LIKE 'verified_%'AND m.economic_amount_in_atomic IS NULLUNION ALLSELECT 'movement_status_missing', COUNT(*)FROM rINNER JOIN m