Skip to content

fix(bundler): sweep srcToken after Paraswap_Sell with sellEntireBalance#519

Merged
Rubilmax merged 2 commits intomainfrom
Rubilmax/fix-paraswap-sweep
Mar 9, 2026
Merged

fix(bundler): sweep srcToken after Paraswap_Sell with sellEntireBalance#519
Rubilmax merged 2 commits intomainfrom
Rubilmax/fix-paraswap-sweep

Conversation

@Rubilmax
Copy link
Collaborator

@Rubilmax Rubilmax commented Mar 6, 2026

Summary

  • Always sweep leftover srcToken from paraswapAdapter back to generalAdapter1 after Paraswap_Sell, regardless of sellEntireBalance
  • Previously, when sellEntireBalance=true, the sweep was skipped, leaving unswapped tokens stranded on the adapter where they could be stolen via permissionless Bundler3.multicall
  • Now consistent with Paraswap_Buy and Blue_Paraswap_BuyDebt, which both unconditionally sweep

Resolves SDK-92

Test plan

  • Verify generated bundle for Paraswap_Sell with sellEntireBalance=true includes the erc20Transfer sweep action
  • Run bundler-sdk-viem tests
  • Run full test suite for regressions

🤖 Generated with Claude Code

@linear
Copy link

linear bot commented Mar 6, 2026

@Rubilmax Rubilmax marked this pull request as ready for review March 6, 2026 16:33
@Rubilmax Rubilmax self-assigned this Mar 6, 2026
@Rubilmax
Copy link
Collaborator Author

Rubilmax commented Mar 6, 2026

@codex

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

oumar-fall
oumar-fall previously approved these changes Mar 9, 2026
Copy link
Collaborator

@oumar-fall oumar-fall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a test?

Foulks-Plb
Foulks-Plb previously approved these changes Mar 9, 2026
oumar-fall
oumar-fall previously approved these changes Mar 9, 2026
Rubilmax and others added 2 commits March 9, 2026 14:13
…ap_Sell

When sellEntireBalance=true, leftover srcToken was not swept from
paraswapAdapter back to generalAdapter1, leaving it stealable via
permissionless Bundler3 multicall. Now sweeps unconditionally, matching
Paraswap_Buy and Blue_Paraswap_BuyDebt.

Resolves SDK-92

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that encodeOperation always includes the erc20Transfer sweep
of srcToken from paraswapAdapter back to generalAdapter1, regardless
of sellEntireBalance. This test fails without the fix from the
previous commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Rubilmax Rubilmax dismissed stale reviews from oumar-fall and Foulks-Plb via 23d2ddb March 9, 2026 13:14
@Rubilmax Rubilmax force-pushed the Rubilmax/fix-paraswap-sweep branch from 4357abc to 23d2ddb Compare March 9, 2026 13:14
@Rubilmax Rubilmax merged commit 0bdb64f into main Mar 9, 2026
16 checks passed
@Rubilmax Rubilmax deleted the Rubilmax/fix-paraswap-sweep branch March 9, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants