From 67d2c0084390d5af1f53a32e1e52bd243ec81a92 Mon Sep 17 00:00:00 2001 From: jaxperro Date: Fri, 10 Jul 2026 00:36:47 -0400 Subject: [PATCH] fly image: add unified SDK; probe reads positions from client.wallet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit polymarket-client==0.1.0b16 baked into the worker image (py-clob-client stays for legacy read paths). Probe: drop the manual-wrap block (bankroll already converted to pUSD via the bridge — the onramp pauses native USDC) and stop reading positions from LIVE_FUNDER_ADDRESS (the emptied legacy proxy); the SDK-resolved deposit wallet is the position holder now. Co-Authored-By: Claude Fable 5 --- fly.Dockerfile | 7 +++++-- host/order_probe_v2.py | 43 +++--------------------------------------- 2 files changed, 8 insertions(+), 42 deletions(-) diff --git a/fly.Dockerfile b/fly.Dockerfile index c4a312b1..a7ab986e 100644 --- a/fly.Dockerfile +++ b/fly.Dockerfile @@ -6,9 +6,12 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends git ca-certificates \ && rm -rf /var/lib/apt/lists/* # LIVE_ROLLOUT 1.3 — live-trading deps (LedgerLiveExecutor + redeem.py). -# Pinned to the versions preflight_live.py was validated against on the Mac. # The paper path never imports these (import-lazy), so paper boots unchanged. -RUN pip install --no-cache-dir py-clob-client==0.34.6 web3==7.16.0 +# polymarket-client = the unified SDK (py-clob-client was ARCHIVED May 2026; +# the CLOB rejects its order format — reads still work, so it stays for the +# legacy read paths). Pinned to the beta the wrap+probe were validated on. +RUN pip install --no-cache-dir py-clob-client==0.34.6 web3==7.16.0 \ + polymarket-client==0.1.0b16 WORKDIR /app COPY host/ /app/host/ CMD ["bash", "host/start.sh"] diff --git a/host/order_probe_v2.py b/host/order_probe_v2.py index 6bf1bb46..049b9c31 100644 --- a/host/order_probe_v2.py +++ b/host/order_probe_v2.py @@ -70,46 +70,9 @@ with client: print(" approvals result:", str(h)[:200]) except Exception as e: print(" setup_trading_approvals:", type(e).__name__, str(e)[:250]) - # the SDK approvals list covers the COLLATERAL token only — but funds - # arriving as raw native USDC get wrapped by the exchange AT MATCH, which - # needs the maker's USDC approved to the collateral contract. Approve it. - USDC = "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359" - COLLAT = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB" - try: - h = client.approve_erc20(token_address=USDC, spender_address=COLLAT, amount="max") - if h is not None and hasattr(h, "wait"): - print(" USDC→collateral approval:", str(h.wait())[:150]) - else: - print(" USDC→collateral approval:", str(h)[:150]) - except Exception as e: - print(" approve_erc20:", type(e).__name__, str(e)[:250]) - # PRE-WRAP is mandatory: the exchange's balance view counts the - # COLLATERAL token only. The public wrapper periphery (0x93070a…, holds - # the wrapper role; used by the UI's 4337 flows) exposes - # wrap(asset, to, amount). Approve + wrap the full USDC balance in one - # gasless transaction from the deposit wallet. - from polymarket.calls import TransactionCall, erc20_approval_call - from web3 import Web3 - from eth_abi import encode as abi_encode - WRAPPER = "0x93070a847efef7f70739046a929d47a521f5b8ee" - dw = str(client.wallet) - rpc_body = json.dumps({"id":1,"jsonrpc":"2.0","method":"eth_call","params":[ - {"to": USDC, "data": "0x70a08231" + dw[2:].lower().rjust(64, "0")}, "latest"]}).encode() - rq = urllib.request.Request(os.environ["ALCHEMY_RPC_URL"].strip(), data=rpc_body, - headers={"content-type": "application/json"}) - units = int(json.load(urllib.request.urlopen(rq, timeout=20, context=_SSL))["result"], 16) - print(f" wrapping {units/1e6:.2f} USDC → collateral…") - if units > 0: - appr = erc20_approval_call(token_address=USDC, spender=WRAPPER, amount=units) - sel = Web3.keccak(text="wrap(address,address,uint256)")[:4] - data = "0x" + sel.hex().replace("0x", "") + abi_encode( - ["address", "address", "uint256"], [USDC, dw, units]).hex() - wrap_call = TransactionCall(to=WRAPPER, data=data) - try: - h = client.execute_transaction(calls=[appr, wrap_call], metadata="wrap USDC to collateral") - print(" wrap outcome:", str(h.wait())[:200]) - except Exception as e: - print(" wrap failed:", type(e).__name__, str(e)[:250]) + # bankroll is already pUSD: the bridge wraps on deposit (2026-07-10 — + # host/wrap_via_bridge.py converted the native-USDC bankroll; the old + # manual wrap here died on the onramp's paused(nativeUSDC) gate) try: b = client.get_balance_allowance(asset_type="COLLATERAL") print(" exchange-view balance:", str(b)[:220])