fix: route approve and CTF operations through proxy wallet factory#62
Open
suhailkakar wants to merge 6 commits intomainfrom
Open
fix: route approve and CTF operations through proxy wallet factory#62suhailkakar wants to merge 6 commits intomainfrom
suhailkakar wants to merge 6 commits intomainfrom
Conversation
This was referenced Apr 5, 2026
Closed
Member
Author
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Redundant
send_via_factoryduplicates proxy path insend_call- Removed send_via_factory function and replaced its calls with send_call(use_proxy=true), eliminating code duplication and inefficient provider creation in the approval loop.
Or push these changes by commenting:
@cursor push ee4bedd305
Preview (ee4bedd305)
diff --git a/src/commands/approve.rs b/src/commands/approve.rs
--- a/src/commands/approve.rs
+++ b/src/commands/approve.rs
@@ -170,7 +170,7 @@
value: U256::MAX,
}
.abi_encode();
- let tx_hash = proxy::send_via_factory(private_key, USDC_ADDRESS, calldata)
+ let (tx_hash, _) = proxy::send_call(private_key, true, USDC_ADDRESS, calldata)
.await
.context(format!("Failed USDC approval for {}", target.name))?;
@@ -191,9 +191,10 @@
approved: true,
}
.abi_encode();
- let tx_hash = proxy::send_via_factory(private_key, config.conditional_tokens, calldata)
- .await
- .context(format!("Failed CTF approval for {}", target.name))?;
+ let (tx_hash, _) =
+ proxy::send_call(private_key, true, config.conditional_tokens, calldata)
+ .await
+ .context(format!("Failed CTF approval for {}", target.name))?;
match output {
OutputFormat::Table => print_tx_result(step, total, &label, tx_hash),
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -40,30 +40,6 @@
.ok_or_else(|| anyhow::anyhow!("Proxy wallet derivation not supported on this chain"))
}
- pub async fn send_via_factory(
- private_key: Option<&str>,
- target: Address,
- calldata: Vec<u8>,
- ) -> Result<B256> {
- let provider = auth::create_provider(private_key).await?;
- let factory = IProxyWallet::new(PROXY_FACTORY, &provider);
- let call = IProxyWallet::ProxyCall {
- typeCode: 1,
- to: target,
- value: U256::ZERO,
- data: calldata.into(),
- };
- let tx_hash = factory
- .proxy(vec![call])
- .send()
- .await
- .context("Failed to send proxy transaction")?
- .watch()
- .await
- .context("Failed to confirm proxy transaction")?;
- Ok(tx_hash)
- }
-
pub async fn send_call(
private_key: Option<&str>,
use_proxy: bool,This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
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.
Reviewed by Cursor Bugbot for commit 0c63aca. Configure here.
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.


Note
Medium Risk
Changes how on-chain transactions are constructed and sent for
approveandctfcommands, including a new proxy-wallet execution path, which could impact transaction success or target address selection. Scope is limited to these commands and dependency/feature wiring.Overview
Routes
approveand state-changingctfoperations through the Polymarket proxy wallet factory whensignature_typeresolves toproxy.This adds a shared
commands::proxyhelper that either wraps calldata in a factoryproxy(...)call or sends a rawTransactionRequest, and updatesapprove setplusctfsplit/merge/redeem/redeem-neg-riskto build ABI calldata viasol!+SolCalland submit viaproxy::send_call.approve checknow defaults to checking allowances/approvals for the derived proxy wallet address in proxy mode, and the CLI wiring passessignature_typethrough toapproveandctf. Dependency config is adjusted to enable Alloyrpc-typessupport.Reviewed by Cursor Bugbot for commit 41f965b. Bugbot is set up for automated code reviews on this repo. Configure here.