fix: route approve commands through proxy wallet#42
fix: route approve commands through proxy wallet#42mvanhorn wants to merge 4 commits intoPolymarket:mainfrom
Conversation
…e proxy - `approve check` now queries the correct wallet (proxy or EOA) based on --signature-type, so users see actual allowances instead of zeros - `approve set` with proxy signature type routes transactions through the Proxy Wallet Factory, batching USDC and CTF approvals per target - `ctf` commands now accept --signature-type for forward compatibility Fixes Polymarket#4 Related: Polymarket#1, Polymarket#24 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents silent routing breakage if DEFAULT_SIGNATURE_TYPE is ever changed to a non-proxy value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
approve check uses resolve_wallet_address which returns the derived Safe address for gnosis-safe, but approve set only handles proxy and falls through to the EOA path. This would silently approve on the wrong address. Add an early bail for gnosis-safe with guidance to use the Safe wallet interface instead.
|
Addressed the gnosis-safe check/set inconsistency in 09aaa7a. Re: the proxy check comparison - this is already comparing against the literal |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- Replace hardcoded "proxy" string with config::DEFAULT_SIGNATURE_TYPE to stay consistent with auth.rs and prevent silent divergence - Update proxy approval label to "USDC + CTF" since the batch transaction includes both token approvals Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Fixes
approveandctfcommands ignoring--signature-type proxy, which caused all on-chain transactions to go from the EOA instead of the proxy wallet.Fixes #4
Related: #1, #24
Changes
src/auth.rsresolve_wallet_address()that returns EOA, proxy, or Safe address based on signature typesrc/main.rssignature_typetoapproveandctfcommandssrc/commands/approve.rsapprove setthrough Proxy Wallet Factory when signature type isproxy; fixapprove checkto query the correct walletsrc/commands/ctf.rssignature_typeparameter for forward compatibilityHow it works
approve check: Now resolves the wallet address based on--signature-type. Withproxy, it queries allowances of the derived proxy wallet instead of the EOA, so users see their actual allowance status.approve set: With--signature-type proxy, encodes USDC approve and CTF setApprovalForAll calls as calldata and routes them through the Proxy Wallet Factory at0xaB45.... This batches both approvals per target into a single factory call, so the proxy wallet gets the approvals instead of the EOA.ctf: Accepts--signature-typebut does not yet route through proxy (marked for follow-up). This is a smaller, separable change.Test plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo test- all 131 tests passpolymarket approve check --signature-type proxyshows proxy wallet allowancespolymarket approve set --signature-type proxysends approvals through factoryThis contribution was developed with AI assistance (Claude Code).
Note
Medium Risk
Changes how on-chain approval transactions are constructed and which wallet address they target (EOA vs proxy/Safe), which could lead to incorrect allowances if mis-derived or mis-routed. Impact is limited to approval flows but touches transaction encoding and contract calls.
Overview
Fixes
approveworkflows to correctly respect--signature-typewhen checking and setting allowances.Adds
auth::resolve_wallet_address()to derive the effective owner address (EOA vs derived proxy vs derived Gnosis Safe) and updatesapprove checkto query approvals against that resolved address.Updates
approve setsoproxymode batches USDCapprove+ CTFsetApprovalForAllinto a single call via the Proxy Wallet Factory (and blocksgnosis-safewith a clear error), while keeping the existing direct-EOA transaction path for non-proxy signatures.main.rsnow passessignature_typeintoapproveandctf(withctfcurrently accepting but not using it).Written by Cursor Bugbot for commit 51a4459. This will update automatically on new commits. Configure here.