Context
With the V2 parallel stack in place from the prep issue in this series, this issue migrates the collateral plumbing across the bot. Behind the POLYMARKET_V2_ENABLED flag, every USDC.e reference becomes pUSD, and the deposit helper switches from USDC.e swap to pUSD wrap.
- Cutover: 2026-04-28 ~11:00 UTC
- pUSD is an ERC-20 on Polygon, backed 1:1 by native USDC, backing enforced onchain
- Frontend auto-wraps for retail users; API/bot integrators must call
wrap() on the Collateral Onramp contract
References:
Scope
Production code
Behind the V2 flag, swap collateral references:
backend/core/trading/executor.py — splitPosition collateral arg → pUSD
backend/core/positions/manager.py — mergePositions collateral arg → pUSD
backend/core/wallet/manager.py — balance check reads pUSD; approvals target the V2 exchange + V2 NegRisk exchange addresses; allowance asset is pUSD
Experiments (kept mirrored with production)
- Replace
experiments/trading/02_swap_to_usdc_e.py with 02_wrap_to_pusd.py — calls wrap() on Collateral Onramp with native USDC input
- Update
experiments/trading/01_setup_wallet.py, 03_buy_position.py, 04_transfer_tokens.py to read pUSD when the V2 flag is set
experiments/onchain-otc/* use the NegRisk adapter directly, which is a separate contract from CTF Exchange — verify against the migration guide whether the adapter ABI changes under V2; if unchanged, no edits needed
Pre-cutover ops checklist (PR description)
Out of scope
- ClobClient V2 flip + order-struct changes + fee-model adaptation — separate issue.
- Removing V1 collateral paths — separate post-cutover cleanup issue.
Deadline
Land + tested by 2026-04-27 EOD.
Prerequisites
Blocks
Context
With the V2 parallel stack in place from the prep issue in this series, this issue migrates the collateral plumbing across the bot. Behind the
POLYMARKET_V2_ENABLEDflag, every USDC.e reference becomes pUSD, and the deposit helper switches from USDC.e swap to pUSD wrap.wrap()on the Collateral Onramp contractReferences:
Scope
Production code
Behind the V2 flag, swap collateral references:
backend/core/trading/executor.py—splitPositioncollateral arg → pUSDbackend/core/positions/manager.py—mergePositionscollateral arg → pUSDbackend/core/wallet/manager.py— balance check reads pUSD; approvals target the V2 exchange + V2 NegRisk exchange addresses; allowance asset is pUSDExperiments (kept mirrored with production)
experiments/trading/02_swap_to_usdc_e.pywith02_wrap_to_pusd.py— callswrap()on Collateral Onramp with native USDC inputexperiments/trading/01_setup_wallet.py,03_buy_position.py,04_transfer_tokens.pyto read pUSD when the V2 flag is setexperiments/onchain-otc/*use the NegRisk adapter directly, which is a separate contract from CTF Exchange — verify against the migration guide whether the adapter ABI changes under V2; if unchanged, no edits neededPre-cutover ops checklist (PR description)
wrap()→ pUSD balance increasesOut of scope
Deadline
Land + tested by 2026-04-27 EOD.
Prerequisites
py-clob-client-v2,V2_CONTRACTSdict (with pUSD + Collateral Onramp addresses), and thePOLYMARKET_V2_ENABLEDfeature flag.Blocks