feat(clob): support PolyV2 position IDs - #112
Merged
Merged
Conversation
kartojal
marked this pull request as ready for review
September 1, 2026 08:03
cesarenaldi
approved these changes
Sep 2, 2026
cesarenaldi
left a comment
Collaborator
There was a problem hiding this comment.
The implementation matches the intended minimal clob-client-v2 port. The remaining test-fixture and terminology points are non-blocking.
Merged
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
Reference
Rust implementation of the behavior introduced in Polymarket/clob-client-v2#104:
Polymarket/clob-client-v2#104
Validation
Note
Medium Risk
Touches order construction, EIP-712 signing, and contract selection—errors could produce unfillable or wrongly signed orders—but behavior is heavily tested and token-only paths are largely unchanged.
Overview
Adds Polymarket V2 position-backed trading alongside existing CTF token orders. Limit and market builders gain
position_id(); callers must supply exactly one oftoken_idorposition_id.Position orders always use Exchange V3: EIP-712 domain version
"3",exchange_v3on Polygon/Amoy, same V2-shaped wire payload (tokenIdcarries the position ID). They skipGET /versionand neg-risk during build/sign. Token orders keep V1/V2 auto-detection and version-mismatch retry on post.Signing and types:
OrderPayload::V3,new_v3, andv3()accessors; V3 shares serialization with V2. Poly1271 is documented for V2/V3 orders.Market data and metadata: Read paths (
midpoint, books, tick size, fees,market_by_token, etc.) treat position IDs like tokens, still serialized astoken_idon the wire.README, module docs, changelog, request docs, config tests, and integration tests cover position limit/market flows, mutual exclusion of IDs, and serialization.
Reviewed by Cursor Bugbot for commit 4d2cc8a. Bugbot is set up for automated code reviews on this repo. Configure here.