1 Commits
Author SHA1 Message Date
sneak 8d524b7f3d fix: a V4 step of chained swap actions shows what the user receives (closes #563)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s
A V4 step's input side is now the currency its SETTLE or SETTLE_ALL
names, and its output side the one its TAKE or TAKE_ALL names. A side
none of them names comes from the swap actions, lined up as the
exact-out ones in reverse order and then the exact-in ones in order,
since the router runs exact-out actions from the output end: the input
from the first, the output from the last. Amount is the first action's
amountIn and Min. received the last one's minimum, each shown only when
that action spends the input currency or buys the output currency.
SETTLE_ALL and TAKE_ALL were not read before, and the first swap action
set both sides.

Model: opus-5-5
2026-10-18 20:21:16 +00:00
2 changed files with 14 additions and 16 deletions
+2 -3
View File
@@ -1197,9 +1197,8 @@ exact-in actions from the input end and a chain of exact-out actions from the
output end, so a step whose swap actions are all of one kind is lined up from
what the user pays to what the user receives. A step that mixes the two kinds
need not be: one that buys WETH with USDT exact-in and then USDC with that WETH
exact-out is lined up with the USDC purchase first, so with no `SETTLE`,
`SETTLE_ALL`, `TAKE` or `TAKE_ALL` it reads `Swap WETH → WETH`. `Amount` is the
first action's `amountIn`, shown only when that action spends the step's input
exact-out is lined up with the USDC purchase first. `Amount` is the first
action's `amountIn`, shown only when that action spends the step's input
currency, and `Min. received` the last action's `amountOutMin`, shown only when
that action buys the step's output currency, so no figure is shown against a
currency it is not counted in. The decoder reads no amount from an exact-out
+12 -13
View File
@@ -414,19 +414,18 @@ function decodeV4SwapAction(actionId, param) {
// its output currency, wherever in the step they stand. A side neither one
// names is read from the swap actions, lined up as the exact-out actions in
// reverse order, then the exact-in actions in the order they appear. The
// input comes from the first action in that line and the output from the
// last. The router runs exact-in actions from the input end and a chain of
// exact-out actions from the output end, so a step whose swap actions are all
// of one kind is lined up from what the user pays to what the user receives.
// A step that mixes the two kinds need not be: one that buys WETH with USDT
// exact-in and then USDC with that WETH exact-out is lined up with the USDC
// purchase first, so with no SETTLE, SETTLE_ALL, TAKE or TAKE_ALL both its
// sides are WETH. Amount is the first action's amountIn, kept only when that
// action spends the step's input currency, and Min. received the last
// action's amountOutMin, kept only when that action buys the step's output
// currency, so a figure is never shown against a currency other than the one
// it is counted in. A swap action that could not be read keeps its place in
// the line and states nothing.
// input comes from the first action in that line and the output
// from the last. The router runs exact-in actions from the input end and a
// chain of exact-out actions from the output end, so a step whose swap actions
// are all of one kind is lined up from what the user pays to what the user
// receives. A step that mixes the two kinds need not be: one that buys WETH
// with USDT exact-in and then USDC with that WETH exact-out is lined up with
// the USDC purchase first. Amount is the first action's amountIn, kept only
// when that action spends the step's input currency, and Min. received the
// last action's amountOutMin, kept only when that action buys the step's
// output currency, so a figure is never shown against a currency other than
// the one it is counted in. A swap action that could not be read keeps its
// place in the line and states nothing.
function decodeV4Swap(input) {
try {
const d = coder.decode(["bytes", "bytes[]"], input);