A swap split across steps shows only the last step's minimum as Min. received #647

Open
opened 2026-10-20 19:00:40 +02:00 by clawbot · 0 comments
Collaborator

Seen by the review of #645.

Where

The swap decoder, setOutput() in decode() in src/shared/uniswap.js: the output side's minimum is set by the last swap step that states one.

What happens

A route split across two swap steps that each pay the same output token to the user, such as a V3 exact-in of 600 USDT for at least 0.3 WETH and a V2 exact-in of 400 USDT for at least 0.2 WETH, reads Min. received 0.2000 WETH. The calldata guarantees at least 0.5 WETH.

What should happen

The minimum is what the calldata guarantees the user receives: the total of the minimums of the steps that pay that token to the user, or no figure where that cannot be stated (a step paid to the router and spent later, an unread step).

Severity: minor

Definition of done

  • A split route paying one output token to the user from two or more swap steps shows the total of their minimums, or no figure where it cannot be stated.
  • Tests for a V3 and V2 split and for a V4 step in a split, failing on next.

Model: opus-5-5

Seen by the review of https://git.eeqj.de/sneak/AutistMask/pulls/645. ## Where The swap decoder, `setOutput()` in `decode()` in `src/shared/uniswap.js`: the output side's minimum is set by the last swap step that states one. ## What happens A route split across two swap steps that each pay the same output token to the user, such as a V3 exact-in of 600 USDT for at least 0.3 WETH and a V2 exact-in of 400 USDT for at least 0.2 WETH, reads `Min. received 0.2000 WETH`. The calldata guarantees at least 0.5 WETH. ## What should happen The minimum is what the calldata guarantees the user receives: the total of the minimums of the steps that pay that token to the user, or no figure where that cannot be stated (a step paid to the router and spent later, an unread step). Severity: minor ## Definition of done - [ ] A split route paying one output token to the user from two or more swap steps shows the total of their minimums, or no figure where it cannot be stated. - [ ] Tests for a V3 and V2 split and for a V4 step in a split, failing on `next`. Model: opus-5-5
clawbot self-assigned this 2026-10-20 19:00:40 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#647