Query editor
-- ============================================================================-- Robinhood Chain — v2C Stage 1 — Attribution-- COMPLETE FILE — build candidate, not yet execution-stamped-- build_data_version = v2c-extraction-build-20260816-006-- cutoff = 2026-08-12 00:00 UTC-- ============================================================================-- Stage 1/5: frozen candidate filtering, ERC-4337 attribution and eligible DEX legs.-- Export the complete result as CSV. Record the Dune execution ID and SHA-256-- before any downstream use. Intermediate stages are re-uploaded as frozen-- datasets; the sentinel and final stage remain custody evidence/outputs.-- ============================================================================WITH-- BEGIN FROZEN PARAMETER CONTRACTparams AS (SELECTTIMESTAMP '2026-08-12 00:00:00 UTC' AS cutoff_time,DATE '2026-08-12' AS cutoff_date,TIMESTAMP '2026-07-13 00:00:00 UTC' AS scoring_start_time,TIMESTAMP '2026-07-01 00:00:00 UTC' AS public_launch_time,'v2c-extraction-build-20260816-006' AS data_version,'v2c-params-cutoff-20260812-score-1.0.1-candidates-5219' AS contract_id,'cutoff:2026-08-12T00:00:00.000Z' AS cutoff_contract,'qa1v3.2-r2parity-20260814-001' AS candidate_data_version,'fa10cbc765c29a8dd6a2ff3de89f7fe19aa05913231606225d822c99cd4cf09f' AS candidate_source_sha256,'1.0.1' AS score_version,5219 AS expected_candidate_count)-- END FROZEN PARAMETER CONTRACT,candidate_source AS (SELECT-- The canonical Dune upload infers the uniform 0x-address column as-- VARBINARY. Preserve that native type; do not apply string functions or-- perform a redundant hex round-trip here.trader AS trader,CAST(source_data_version AS VARCHAR) AS source_data_version,CAST(strict_actions AS BIGINT) AS strict_actions,CAST(strict_buy_days AS BIGINT) AS strict_buy_days,CAST(strict_buy_targets AS BIGINT) AS strict_buy_targets,CAST(strict_buys_7d AS BIGINT) AS strict_buys_7d,CAST(exact_partition_holds AS BOOLEAN) AS exact_partition_holds,CAST(origin_chain_holds AS BOOLEAN) AS origin_chain_holds,CAST(action_invariant_breach_count AS BIGINT) AS action_invariant_breach_count,LOWER(TRIM(CAST(source_snapshot_sha256 AS VARCHAR))) AS source_snapshot_sha256FROM {{candidate_table}}),candidate_integrity AS (SELECTCOUNT(*) AS candidate_rows,COUNT(DISTINCT trader) AS unique_candidates,COUNT(*) FILTER (WHERE trader IS NULL OR VARBINARY_LENGTH(trader) <> 20) AS invalid_address_rows,COUNT(*) FILTER (WHERE source_data_version IS DISTINCT FROM p.candidate_data_versionOR source_snapshot_sha256 IS DISTINCT FROM p.candidate_source_sha256) AS wrong_source_rows,COUNT(*) FILTER (