fix: a Permit2 transfer of the zero address never reads as ETH (closes #685)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

Permit2 moves no ETH, but the swap decoder read the zero address in a
PERMIT2_TRANSFER_FROM as ETH, with an ETH figure. Such a move now names
the zero address as its token and gives its amount in base units. The
token is named on `Token moved` and `Token moved into the router`, and
the amount is on `Moved from the sender` and `Paid to`.

The zero-address check the permit lines already made is now one function,
permit2TokenInfo(), which the move lines share. tokenMovedLine() takes
the token's info instead of its address.

A V4 step of ETH that states no amount still gets its own lines beside
such a move. A test covers that case.

Model: opus-5-5
This commit is contained in:
2026-10-27 06:30:43 +00:00
committed by sneak
parent 5615b08760
commit 89e5ccfbb2
3 changed files with 120 additions and 49 deletions
+8 -4
View File
@@ -3566,10 +3566,14 @@ Currently supported:
on every router but `UniversalRouterV1`, and otherwise gives the address. A
move into the router needs none of them, because its `Paid to` line and
`Token moved into the router` line already give the amount, the token and
where it goes, and so its amount is shown once. Every `PERMIT2_PERMIT` whose
amount does not stand as the `Amount` figure, before the step that sets the
input side or after it, gives three lines, in step order, after those for each
`PERMIT2_TRANSFER_FROM`: `Permit2 allowance`, its amount, for example
where it goes, and so its amount is shown once. For a move of the zero
address, `Moved from the sender` gives the amount in base units and
`Token moved` gives the zero address. For such a move into the router, the
`Paid to` line gives the amount in base units and
`Token moved into the router` gives the zero address. Every `PERMIT2_PERMIT`
whose amount does not stand as the `Amount` figure, before the step that sets
the input side or after it, gives three lines, in step order, after those for
each `PERMIT2_TRANSFER_FROM`: `Permit2 allowance`, its amount, for example
`5000.0000 DAI`, or `Unlimited` for Permit2's maximum; `Allowance token`,
giving the token's address as the `Token In` line does; and
`Allowance spender`, the address it lets take the token. Only a permit whose