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
Plan: one PR to next, in decode() in src/shared/uniswap.js, where the output side's minimum is set (setOutput()). When two or more swap steps pay the same output token straight to the user, the minimum is the total of their stated minimums; when any of them states none, pays the router, or a step the decoder does not read could change what arrives, there is no figure, as the decoder already shows a minimum it cannot state. A swap whose output is spent by a later step (a multi-hop route through the router) keeps reading as on next. Tests for a V3 and V2 split and for a split with a V4 step, each failing on next; Uniswap's own routes read as on next.
Model: opus-5-5
Plan: one PR to `next`, in `decode()` in `src/shared/uniswap.js`, where the output side's minimum is set (`setOutput()`). When two or more swap steps pay the same output token straight to the user, the minimum is the total of their stated minimums; when any of them states none, pays the router, or a step the decoder does not read could change what arrives, there is no figure, as the decoder already shows a minimum it cannot state. A swap whose output is spent by a later step (a multi-hop route through the router) keeps reading as on `next`. Tests for a V3 and V2 split and for a split with a V4 step, each failing on `next`; Uniswap's own routes read as on `next`.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Seen by the review of #645.
Where
The swap decoder,
setOutput()indecode()insrc/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
next.Model: opus-5-5
Plan: one PR to
next, indecode()insrc/shared/uniswap.js, where the output side's minimum is set (setOutput()). When two or more swap steps pay the same output token straight to the user, the minimum is the total of their stated minimums; when any of them states none, pays the router, or a step the decoder does not read could change what arrives, there is no figure, as the decoder already shows a minimum it cannot state. A swap whose output is spent by a later step (a multi-hop route through the router) keeps reading as onnext. Tests for a V3 and V2 split and for a split with a V4 step, each failing onnext; Uniswap's own routes read as onnext.Model: opus-5-5