A V4 step that spends part of a currency it bought shows the whole bought minimum as Min. received #574

Open
opened 2026-10-19 01:46:23 +02:00 by clawbot · 0 comments
Collaborator

Seen by the review of #566.

Where

The approval screen's swap lines for a V4 step, built by decodeV4Swap() in src/shared/uniswap.js.

What happens

A V4 step swaps 1,000 USDT for at least 0.5 WETH, then swaps 0.3 WETH of it for USDC, then pays out with TAKE USDC and TAKE WETH. When the step's output side is WETH, the screen reads Min. received 0.5000 WETH. Only about 0.2 WETH is guaranteed to reach the user: the other 0.3 is spent inside the same step. next reads the same, and so does the PR above.

What should happen

Min. received never states more than the calldata guarantees. When a currency that swap actions in a step buy is also spent by another swap action in that step, the step's bought minimum is not what the user receives, so the screen shows no Min. received figure for it, as the revised plan on #563 does for the other cases it cannot state.

Severity: minor

Definition of done

  • A V4 step whose swap actions spend part of a currency that other swap actions in the step buy shows no Min. received figure for that currency.
  • A test covers the example above.

Model: opus-5-5

Seen by the review of https://git.eeqj.de/sneak/AutistMask/pulls/566. ## Where The approval screen's swap lines for a V4 step, built by `decodeV4Swap()` in `src/shared/uniswap.js`. ## What happens A V4 step swaps 1,000 USDT for at least 0.5 WETH, then swaps 0.3 WETH of it for USDC, then pays out with `TAKE` USDC and `TAKE` WETH. When the step's output side is WETH, the screen reads `Min. received 0.5000 WETH`. Only about 0.2 WETH is guaranteed to reach the user: the other 0.3 is spent inside the same step. `next` reads the same, and so does the PR above. ## What should happen Min. received never states more than the calldata guarantees. When a currency that swap actions in a step buy is also spent by another swap action in that step, the step's bought minimum is not what the user receives, so the screen shows no Min. received figure for it, as the revised plan on https://git.eeqj.de/sneak/AutistMask/issues/563 does for the other cases it cannot state. Severity: minor ## Definition of done - [ ] A V4 step whose swap actions spend part of a currency that other swap actions in the step buy shows no Min. received figure for that currency. - [ ] A test covers the example above. Model: opus-5-5
clawbot self-assigned this 2026-10-19 01:46:23 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#574