Repository navigation
feat(smart-money): 接受 V1 routers + V2 exchanges in mempool filter (Plan 11 §6) - #31
Merged
Merged
Conversation
…er (Plan 11 §6) Earning-engine plan 11 batch 2 §6 — extend TradeMonitor mempool filter to recognize V2 settlement TXs (post-2026-04-28 cutover). Changes: - monitor.ts: add SETTLEMENT_RECIPIENTS = V1 routers + V2 CTF Exchange + V2 NegRisk Exchange. Replace ROUTER_ADDRESSES + MATCH_ORDERS_SELECTOR (V1-only) with SETTLEMENT_RECIPIENTS + hasMatchOrdersSelector helper that accepts both V1 (0x2287e350) and V2 (0x3c2b4399) selectors. - index.ts: re-export MATCH_ORDERS_SELECTOR_V1 / _V2 + the V1/V2-specific decoder entry points so consumers (earning-engine copy-trading) can filter without reaching into utils/. - new test: v2-smart-money-monitor-filter.test.ts — 6 cases covering V2 calldata @ V2 CTF Exchange, V2 calldata @ V2 NegRisk Exchange, V1 calldata @ V1 router (legacy mempool tail), and rejection paths (random EOA recipient, non-matchOrders selector). V1 path remains live for the cutover overlap window — pre-cutover TXs may still be mempool-pending when V2 goes live; we don't want to silently drop them while the historical-replay analytics catch up. Test: 6/6 new + 156/156 full poly-sdk suite pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks done
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 后,smart-money mempool monitor 仍仅接受 V1 ROUTER_ADDRESSES + V1 `MATCH_ORDERS_SELECTOR` (`0x2287e350`),导致所有 V2 settlement TX (走 V2 CTF Exchange direct, selector `0x3c2b4399`) 被滤掉。
参考: `earning-engine/.claude/skills/guide-polymarket-v2-migration/plans/11-safety-hardening.md` §6, p0-fix-log P0-11
修改方案
`smart-money/monitor.ts`:
数据流
修改后:
```
mempool tx → smart-money/monitor.ts.processTx()
├── recipient ∈ {V1 routers, V2 CTF Exchange, V2 NegRisk Exchange} ?
│ └── if no → 跳过 (filter)
├── selector ∈ {V1 0x2287e350, V2 0x3c2b4399} ?
│ └── if no → 跳过
└── decodeMatchOrdersCalldata() 自动 V2-first / V1-fallback (已在 PR #29 实施)
```
测试
新单元测试 `v2-smart-money-monitor-filter.test.ts` (6 cases): V2 CTF Exchange + V2 NegRisk Exchange + V1 router-legacy paths + EOA/non-matchOrders rejection 都覆盖。
156/156 tests pass, tsc clean。
风险与回滚
低风险:仅扩大允许集 (V2 settlement 之前被滤掉,现在被接受)。回滚 = revert 单 commit。
🤖 Generated with Claude Code