chore(v2): 彻底删除 V1 backward-compat surfaces (no @deprecated, V2-only)#32
Merged
Merged
Conversation
V2 cutover (2026-04-28) 后 V1 trading 永久死亡, SDK 应只支持 V2 path. PR #30 留下了 @deprecated 标记的 V1 aliases 噪音, 本次彻底清理. 删除内容 ======== constants/v2-contracts.ts: - POLYGON_CONTRACTS_V1_LEGACY 整体删除 (V1 ctfExchange / negRiskExchange) - EIP_712.domainVersionV1 字段删除 (V2 only) clients/ctf-client.ts: - NEG_RISK_CTF_EXCHANGE_V1_DEPRECATED 删除 - CTF_EXCHANGE_V1_DEPRECATED 删除 - NEG_RISK_CTF_EXCHANGE 别名删除 (= V1 地址) - CTF_EXCHANGE 别名删除 (= V1 地址) - 保留 NEG_RISK_CTF_EXCHANGE_V2 / CTF_EXCHANGE_V2 (= POLYGON_CONTRACTS_V2.*) utils/calldata-decoder.ts: - MATCH_ORDERS_SELECTOR 顶层别名删除 (= V1 selector) - 移除 CTF_ROUTER / NEG_RISK_ROUTER 上的 @deprecated 标记 (这些不是 deprecated, 是 V1-mempool-tail-by-design constants, smart-money 仍消费) index.ts: - 同步移除上述 V1 surfaces 的 re-export services/relayer-service.ts: - split / merge / redeem / redeemBatch 删除 token 参数 (pUSD-only) - transferUsdc / approveUsdc 保留 CollateralToken 参数 (Onramp/Offramp + fund-out collect 仍合法消费) services/authorization-service.ts: - AllowancesResult.usdcBalance @deprecated 别名删除 保留的合理项 ============ - POLYGON_CONTRACTS_V2.usdcE: wrap helper / off-exchange flow 必需 - wrapUsdcToPUSD / unwrapPUSDtoUsdc: V2 architecture 必需 - transferUsdc(token = pUSD | USDC.e): main wallet 仍持 USDC.e 走 fund-out - approveUsdc(token = pUSD | USDC.e): Onramp/Offramp 需 USDC.e/pUSD approval - decodeMatchOrdersCalldataV1 + MATCH_ORDERS_SELECTOR_V1 + CTF_ROUTER / NEG_RISK_ROUTER: smart-money mempool tail (Plan 11 §6) 真实消费 - createBuilderApiKey / BuilderKeyResult.builderCreds: earning-engine cli 通过它生成 L3 HMAC creds 给 RelayerService bootstrap (cli/wallet.ts caller 实测仍消费, 删了会破) - 其他非 V1 的 @deprecated 标记 (OrderStatus migration / WS subscription format / Bridge types 等历史 API 演进, 不在本次 V2 cleanup 范围) 测试 ==== - 12 test files / 152 tests 全绿 - v2-relayer-token-routing.test.ts 删除 split/merge/redeem 的 USDC.e override 测试 (函数已不接受 token), 保留 approveUsdc / transferUsdc 的 dual-token 路由测试 - ctf-client.integration.test.ts 改用 NEG_RISK_CTF_EXCHANGE_V2 跨仓库影响 (P0 follow-up) ========================= earning-engine/cli/src/commands/wallet.ts 6 处仍 import 已删除的 CTF_EXCHANGE / NEG_RISK_CTF_EXCHANGE (V1 地址), 用于 wallet approval 矩阵. post-V2 这些 V1 地址不需要 approval, 应改用 POLYGON_CONTRACTS_V2.*. 详细 blocker 见: .claude/skills/guide-polymarket-v2-migration/notes/v2-aggressive-cleanup-blockers.md 净行数: +67 / -215 Branch: chore/v2-only-aggressive-cleanup 不开 PR (Lead 统一管理).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
V2 cutover 已于 2026-04-28 完成。User 反馈 PR #30 cleanup 不够彻底——V2 后不必要的代码不应保留,也不该用 `@deprecated` 标签做 backward-compat (噪音 + 拖延 cleanup)。
本 PR aggressively 删除所有 V2 不必要的 V1 surface,no @deprecated。
删除清单
重新评估的决策(保留)
calldata-decoder V1 path: KEPT. `decodeMatchOrdersCalldataV1` + `MATCH_ORDERS_SELECTOR_V1` + `CTF_ROUTER` + `NEG_RISK_ROUTER` 在 `src/smart-money/monitor.ts` (PR feat(smart-money): 接受 V1 routers + V2 exchanges in mempool filter (Plan 11 §6) #31 Plan 11 §6) 真实消费, 用于 mempool 中的 V1 cutover-tail / 历史 replay. 不是 deprecated, 是 by-design V1-historical-tail constants. 仅清理 `@deprecated` 标记的噪音.
createBuilderApiKey + BuilderKeyResult.builderCreds: KEPT. earning-engine `cli/src/commands/wallet.ts` 仍消费此返回结构, 把 L3 HMAC creds 写入钱包 store, 后续 RelayerService 启动时再读. V2 后 RelayerService 仍需 HMAC creds (builder-relayer-client SDK 要求).
CollateralToken type 部分保留: trading helpers (split/merge/redeem) pUSD-only; off-exchange helpers (approveUsdc/transferUsdc) 保留 token 参数 — Onramp/Offramp + fund-out collect 是合法 dual-token 路径.
非 V1 的 @deprecated 不动: src/ 仍有 17 个 `@deprecated`, 全部为非 V1 历史 API 演进 (OrderStatus enum migration / WS subscription format / Bridge types 等), 不在本次 V2 cleanup 范围.
改动 + 测试
Self-review
跨仓库 sequence
✅ earning-engine PR #12 (`cli/wallet.ts` V1 alias → V2 address) 已 merged 在前, 解锁本 PR.
部署顺序:
🤖 Generated with Claude Code