1 Commits
Author SHA1 Message Date
sneak bef1271cf9 fix: only a permit whose amount is the Amount figure names Token In (closes #370)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s
A PERMIT2_PERMIT named Token In whether or not its amount stood as the
Amount figure, so the approval screen could show a permit's token, or an
allowance, where the swap's own input belonged. A permit whose spender
was not the router, or that the router may let fail, had no line naming
its spender.

Now only a permit whose amount stands names Token In. Every other
permit, before the swap steps or after them, leaves Token In and Amount
as they read with no permit and gets three lines of its own: Permit2
allowance, Allowance token and Allowance spender. README Transaction
Decoding, its unknown token scale passage and the TxApproval element
list match.

Model: opus-5-5
2026-10-20 21:12:47 +00:00
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -1480,8 +1480,8 @@ function decode(data, toAddress, chainId, sources, fromAddress) {
// Only a permit whose amount stands as the Amount figure
// names Token In (see permitStands). Every other permit,
// before the step that sets the input side or after it,
// leaves Token In and Amount as they read with no permit
// and gets lines of its own. One after a step set the input
// leaves Token In and Amount as they read without it and
// gets lines of its own. One after a step set the input
// side never stands, so only one before it is kept here.
if (p && !inputEstablished) {
// Whether a step before it took its token, or may
@@ -1966,8 +1966,8 @@ function decode(data, toAddress, chainId, sources, fromAddress) {
// the permit covers every take of it. A later step this decoder did
// not read may raise what Permit2 lets the router take, as a
// PERMIT2_PERMIT_BATCH can. Every other PERMIT2_PERMIT leaves Token In
// and the Amount line as they read with no permit, and gets lines of
// its own below. A step that may take from the sender what this decoder
// and the Amount line as they read without it, and gets lines of its
// own below. A step that may take from the sender what this decoder
// did not read leaves no figure, permit or not (see spentUnread()),
// and an EXECUTE_SUB_PLAN step leaves both sides unknown (below).
const stepCommands = Array.from(
+2 -2
View File
@@ -2263,8 +2263,8 @@ describe("uniswap decoder", () => {
// that step's token, and its amount could stand as the Amount figure.
// Only a permit whose amount stands as the Amount figure names Token
// In now. Every other, before the swap steps or after them, leaves
// Token In and Amount as they read with no permit and gets lines of
// its own.
// Token In and Amount as they read without it and gets lines of its
// own.
describe("a PERMIT2_PERMIT whose amount does not stand as the Amount figure", () => {
const DAI_5000 = 5000000000000000000000n;
const USDT_5000 = 5000000000n;