fix: a V4 step that spends some of its output currency shows no Min. received (closes #574) #667

Merged
clawbot merged 1 commits from issue-574-v4-spent-output-min into next 2026-10-21 07:34:27 +02:00
Collaborator

Fixes #574.

A V4 step's Min. received was the sum of the amountOutMin of the swap actions that buy its output currency. When another swap action in the same step spends some of that currency, the user gets less than that sum: buying at least 0.5 WETH with 1,000 USDT, swapping 0.3 WETH of it for USDC and taking both read Min. received 0.5000 WETH. decodeV4Swap() now sets no minimum when any swap action in the step spends the output currency, so the screen has no Min. received line, as it already does for other minimums it cannot state.

Things the diff does not show:

  • Only a step whose TAKE or TAKE_ALL names the output currency can hit this. An output side found from the swap actions alone is always a currency none of them spends.
  • A multi-hop action records only the currency it spends and the one it ends with, so a path through WETH does not count as spending WETH. Uniswap's own routes read as before.
  • One existing row in tests/uniswapRecipient.test.js (a step that buys USDC, then spends 1 USDC of it to buy WETH back) now shows no minimum. Its 1990 USDC figure overstated what is paid out.
  • Judgement call: the three V4 rules are written in README Display Consistency, which Transaction Decoding points to, so rule 2 is updated there.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/574. A V4 step's `Min. received` was the sum of the `amountOutMin` of the swap actions that buy its output currency. When another swap action in the same step spends some of that currency, the user gets less than that sum: buying at least 0.5 WETH with 1,000 USDT, swapping 0.3 WETH of it for USDC and taking both read `Min. received 0.5000 WETH`. `decodeV4Swap()` now sets no minimum when any swap action in the step spends the output currency, so the screen has no `Min. received` line, as it already does for other minimums it cannot state. Things the diff does not show: - Only a step whose `TAKE` or `TAKE_ALL` names the output currency can hit this. An output side found from the swap actions alone is always a currency none of them spends. - A multi-hop action records only the currency it spends and the one it ends with, so a path through WETH does not count as spending WETH. Uniswap's own routes read as before. - One existing row in `tests/uniswapRecipient.test.js` (a step that buys USDC, then spends 1 USDC of it to buy WETH back) now shows no minimum. Its 1990 USDC figure overstated what is paid out. - Judgement call: the three V4 rules are written in README Display Consistency, which Transaction Decoding points to, so rule 2 is updated there. Model: opus-5-5
clawbot self-assigned this 2026-10-21 06:52:57 +02:00
clawbot added 1 commit 2026-10-21 06:52:58 +02:00
fix: a V4 step that spends some of its output currency shows no Min. received (closes #574)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
c684386a28
A V4 step's Min. received was the sum of the minimums of the swap
actions that buy its output currency, even when another swap action in
the same step spends some of that currency. The user then receives
less than that figure. decodeV4Swap() now gives no minimum when a swap
action in the step also spends the output currency, as it already does
for other minimums it cannot state. A multi-hop action counts only the
currency it spends and the one it ends with, so a path through an
intermediate currency is not read as spending it.

Model: opus-5-5
clawbot added the needs-review label 2026-10-21 06:53:05 +02:00
Author
Collaborator

Review: PASS

Model: opus-5-5

**Review: PASS** Model: opus-5-5
clawbot merged commit b9bb1569fd into next 2026-10-21 07:34:27 +02:00
clawbot deleted branch issue-574-v4-spent-output-min 2026-10-21 07:34:28 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#667