1 Commits
Author SHA1 Message Date
clawbot f6af4ca1bd fix: the swap decoder shows the ETH of a WRAP_ETH that does not set the input side (closes #721)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s
A later WRAP_ETH of a stated amount now counts as a take from the sender.
When it pays anyone but the router, it gets its own Moved from the sender
lines, with the recipient on Moved to. When it pays the router, it joins
the Amount line if Token In is ETH, and otherwise gets those lines too.
When the router may already hold ETH, the amount reads Up to.

A WRAP_ETH of CONTRACT_BALANCE states no amount and reads as before, so
Uniswap's own routes do not change.

Model: opus-5-5
2026-11-03 04:01:14 +00:00
3 changed files with 6 additions and 16 deletions

No files matched your search

+4 -4
View File
@@ -1364,10 +1364,10 @@ when both tokens are known. The lines are:
sender. When it pays anyone but the router, that amount gets these lines. When sender. When it pays anyone but the router, that amount gets these lines. When
it pays the router, that amount joins the `Amount` line if `Token In` is ETH, it pays the router, that amount joins the `Amount` line if `Token In` is ETH,
and gets these lines if not. A `WRAP_ETH` of `CONTRACT_BALANCE` states no and gets these lines if not. A `WRAP_ETH` of `CONTRACT_BALANCE` states no
amount, so it gets no lines. ETH that the sender pays a V4 step or a amount, so it gets none. ETH that the sender pays a V4 step or such a
`WRAP_ETH` of a stated amount can get these three lines when the router may `WRAP_ETH` can get these three lines when the router may hold ETH from an
hold ETH from an earlier step. When the decoder knows the amount, its earlier step. When the decoder knows the amount, its `Moved from the sender`
`Moved from the sender` line reads `Up to` and the amount. line reads `Up to` and the amount.
- `Permit2 allowance`, `Allowance token` and `Allowance spender`: each allowance - `Permit2 allowance`, `Allowance token` and `Allowance spender`: each allowance
that a `PERMIT2_PERMIT` or `PERMIT2_PERMIT_BATCH` grants, unless the permit's that a `PERMIT2_PERMIT` or `PERMIT2_PERMIT_BATCH` grants, unless the permit's
amount already stands as the `Amount` figure. amount already stands as the `Amount` figure.
+2 -3
View File
@@ -1382,8 +1382,8 @@ function decode(data, toAddress, chainId, sources, fromAddress) {
}; };
// A step may take from the sender what this decoder did not read: a // A step may take from the sender what this decoder did not read: a
// V4 step whose input or one of whose SETTLEs or SETTLE_ALLs it // V4 step whose input or one of whose SETTLEs or SETTLE_ALLs it
// cannot read; a V2 or V3 swap step, PERMIT2_TRANSFER_FROM or WRAP_ETH // cannot read; a V2 or V3 swap step or PERMIT2_TRANSFER_FROM whose
// whose input it cannot read; a PERMIT2_TRANSFER_FROM_BATCH; an // input it cannot read; a PERMIT2_TRANSFER_FROM_BATCH; an
// EXECUTE_SUB_PLAN; and a step it fails on. It is recorded with a null // EXECUTE_SUB_PLAN; and a step it fails on. It is recorded with a null
// token and amount: one line says so, there is no Amount line, whose // token and amount: one line says so, there is no Amount line, whose
// figure may then be too low, and the amount of a permit after it // figure may then be too low, and the amount of a permit after it
@@ -1952,7 +1952,6 @@ function decode(data, toAddress, chainId, sources, fromAddress) {
} else { } else {
payeeUnread = true; payeeUnread = true;
stepsUnread.push(i); stepsUnread.push(i);
spentUnread();
} }
} else if (command === "V4_SWAP") { } else if (command === "V4_SWAP") {
const v4 = decodeV4Swap(inputs[i]); const v4 = decodeV4Swap(inputs[i]);
-9
View File
@@ -2861,15 +2861,6 @@ describe("uniswap decoder", () => {
["Moved from the sender", UNDECODED], ["Moved from the sender", UNDECODED],
], ],
}, },
{
kind: "a V3 exact-in of 600 USDT, then a WRAP_ETH whose input this decoder cannot read",
commands: [0x00, 0x0b],
inputs: [V3_600, "0x1234"],
lines: [
...USDT_600_GROUP,
["Moved from the sender", UNDECODED],
],
},
{ {
kind: "a V3 exact-in of 600 USDT, then a WRAP_ETH of nothing to another address, reads as on next", kind: "a V3 exact-in of 600 USDT, then a WRAP_ETH of nothing to another address, reads as on next",
commands: [0x00, 0x0b], commands: [0x00, 0x0b],