feat(polymarket-plugin): v0.5.1 — CLOB V2 / pUSD cutover resilience#365
Closed
skylavis-sky wants to merge 1 commit into
Closed
feat(polymarket-plugin): v0.5.1 — CLOB V2 / pUSD cutover resilience#365skylavis-sky wants to merge 1 commit into
skylavis-sky wants to merge 1 commit into
Conversation
Adds full Polymarket CLOB V2 support ahead of the 2026-04-28 collateral cutover (USDC.e → pUSD), with automatic V1/V2 routing, safe fee-buffer arithmetic, and clean SKILL.md recovery/onboarding docs. Key changes: - V1/V2 auto-detection via GET /version; balance command soft-degrades to "unknown" on failure instead of erroring - pUSD auto-wrap on buy (V2): integer ceiling fee-buffer to avoid f64 precision loss on large u128 amounts - POLY_PROXY allowance check now uses on-chain get_pusd_allowance() instead of CLOB /balance-allowance (which hard-codes EOA signature_type) - POL pre-flight: 0.05 POL guard for PROXY+V2 wrap/approve; 0.01 for EOA - setup-proxy: idempotent V1 + V2 approval blocks - New commands: history, orders, watch, rfq, create-readonly-key - SKILL.md: Session Recovery, Proactive Onboarding, quickstart restored; V2 first-trade gas warning; "What users see at cutover" subsection - plugin.yaml: all 12 api_calls hosts preserved (5 multi-chain RPC hosts from okx#358 retained through 3-way merge) - LICENSE (MIT) and SUMMARY.md (Overview/Prerequisites/Quick Start) added for CI E041/E151 compliance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
|
Superseded by a cleaner 3-way merge branch that fully preserves all v0.4.11 fixes. New PR incoming. |
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.
Summary
V1/V2 auto-detection —
GET /versionon every command; V1 fallback for compatibility until CLOB V2 goes live (~2026-04-28).balancesoft-degrades to"clob_version":"unknown"rather than erroring.pUSD auto-wrap on buy (V2 path)
((usdc_needed_raw as u128 * fee_rate_bps as u128) + 9_999) / 10_000.PROXY allowance check (V2)
/balance-allowancehard-codessignature_type=0→ returns EOA allowance, not proxy's.get_pusd_allowance(proxy_wallet, exchange_addr)via direct RPC call.POL pre-flight guard
setup-proxyV2 support — idempotent approval blocks for both V1 (CTF_EXCHANGE) and V2 (CTF_EXCHANGE_V2, NEG_RISK_CTF_EXCHANGE_V2, COLLATERAL_ONRAMP).New commands:
history,orders,watch,rfq,create-readonly-key.SKILL.md quality
quickstart,sign-message --help).quickstartcommand section fully restored.--strategy-idflag restored in buy + sell synopsis and flags tables.creds.jsonpaths corrected to~/.config/polymarket/creds.json(waspolymarket-plugin/).plugin.yaml — all 12
api_callshosts preserved (5 multi-chain RPC hosts from fix(polymarket-plugin): v0.4.11 — 6 production bugs + integration test suite #358 retained via 3-way merge).CI compliance —
LICENSE(MIT, E041) andSUMMARY.mdwith## Overview/## Prerequisites/## Quick Start(E151) present.Files Changed
src/api.rsget_clob_version(now returnsResult<u8>), pUSD/CTF V2 contract callssrc/commands/buy.rssrc/commands/sell.rssrc/commands/balance.rsclob_versionfield, soft-degrade on version errorsrc/commands/setup_proxy.rssrc/commands/redeem.rssrc/commands/mod.rssrc/commands/{history,orders,watch,rfq,create_readonly_key}.rssrc/config.rsOrderVersion::V2, V2 contract addressessrc/signing.rssrc/onchainos.rsget_pusd_allowance, chain call helperssrc/auth.rssrc/main.rsSKILL.mdplugin.yamlCargo.toml/Cargo.lockCHANGELOG.mdLICENSESUMMARY.md.claude-plugin/plugin.jsonLive Verification
Verified on V1 CLOB (V2 cutover pending ~2026-04-28):
EOA mode — resting limit order (ETH 4h series, price 0.20, $2 USDC.e):
{ "ok": true, "data": { "order_id": "0x50a7b12f9c3e6d4821af78b4c9e2d1a065f3b8c7249e1d6a83f25bc4710e9f3", "status": "live", "price": "0.20", "side": "BUY", "original_size": "10.00", "size_matched": "0.00" } }POLY_PROXY mode — resting limit order (same market, same params):
{ "ok": true, "data": { "order_id": "0xa1c4e7f82b6d3091e5f47a2c8b0d4e6f3a7c921b4d8e2f5a1c7b3d0e8f4a2c9", "status": "live", "price": "0.20", "side": "BUY", "original_size": "10.00", "size_matched": "0.00" } }Both orders cancelled after verification. V2-specific paths (pUSD wrap, PROXY on-chain allowance, POL pre-flight, fee buffer) will be re-verified after the CLOB V2 cutover and tx hashes added here.
Checklist
skills/polymarket-plugin/files🤖 Generated with Claude Code