Fix on-chain commands ignoring --signature-type proxy#5
Open
rursache wants to merge 2 commits intoPolymarket:mainfrom
Open
Fix on-chain commands ignoring --signature-type proxy#5rursache wants to merge 2 commits intoPolymarket:mainfrom
rursache wants to merge 2 commits intoPolymarket:mainfrom
Conversation
approve and ctf commands were not receiving the signature_type flag from the CLI, causing all on-chain transactions to be sent directly from the EOA instead of being routed through the proxy wallet. Changes: - Pass signature_type to approve and ctf commands in main.rs - Add proxy wallet contract interface (IProxyWallet.exec) and helpers (resolve_proxy_address, proxy_exec) in auth.rs - Route approve set calls through proxy.exec() when in proxy mode - Use derived proxy address for approve check when in proxy mode - Route ctf split/merge/redeem/redeem-neg-risk through proxy.exec() when in proxy mode - Make ctf output block_number optional (proxy.exec returns only tx hash) Fixes Polymarket#1, fixes Polymarket#4.
|
polymarket approve set --signature-type proxy |
The IProxyWallet interface used a non-existent `exec(address,bytes)`
function, causing all proxy-mode transactions to revert on-chain.
The actual Polymarket proxy wallet contract (deployed via the factory at
0xaB45c5A4B0c941a2F231C04C3f49182e1A254052) uses:
function proxy(ProxyCall[] memory calls) external payable
where ProxyCall is (uint8 typeCode, address to, uint256 value, bytes data).
Replace the fabricated `exec` interface with the correct `proxy` function
and construct a single-element ProxyCall array with typeCode=1 (CALL) and
value=0 for each forwarded operation.
Fixes Polymarket#5 (comment)
Contributor
Author
|
@cursor review again |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Contributor
Author
|
@mathitalend can you try again? |
|
Tried. still same error |
|
FYI. I am trying with the private key of my polymarket account created with gmail login. I imported that into polymarket CLI and trying |
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
--signature-typethrough toapproveandctfcommands (previously onlyclobreceived it)approve setcalls through the proxy wallet'sproxy(ProxyCall[])function when in proxy modeapprove checkwhen in proxy modectf split/merge/redeem/redeem-neg-riskthrough the proxy wallet'sproxy()function when in proxy modeFixes #1
Fixes #4
What was broken
When
signature_type = proxy:polymarket approve setsent approvals to the EOA, not the proxy — so the exchange had no allowance to spend the proxy's USDCpolymarket approve checkchecked the EOA's approvals, reporting everything as approved when the proxy had nonepolymarket ctf redeem(and split/merge) executed from the EOA instead of through the proxy contractChanges
src/main.rssignature_typetoapprove::execute()andctf::execute()src/auth.rsIProxyWalletsol! interface withProxyCallstruct andproxy()function,resolve_proxy_address(),proxy_exec()helpersrc/commands/approve.rscheck(uses proxy address) andset(routes through proxy wallet'sproxy())src/commands/ctf.rsproxy()src/output/ctf.rsblock_numberoptional (proxy exec only returns tx hash)Proxy wallet interface
The on-chain Polymarket ProxyWallet contract exposes:
where
ProxyCallis(uint8 typeCode, address to, uint256 value, bytes data)withtypeCode = 1for a standard CALL. Theproxy_exec()helper inauth.rswraps each operation in a single-elementProxyCallarray withtypeCode = 1andvalue = 0.Test plan
cargo buildcompiles successfullycargo test— all 94 unit tests and 49 integration tests passpolymarket approve checkwithsignature_type: proxyshould show the proxy address's approvalspolymarket approve set --signature-type proxyshould route approve txs through proxy walletpolymarket ctf redeem --condition <id> --signature-type proxyshould execute via proxy--signature-type eoabehave exactly as before