fix: a permit after a swap step shows on its own lines instead of replacing Token In (closes #370)
A PERMIT2_PERMIT read after a step had set the input side named Token In, and its amount could stand as the Amount figure, so the approval screen could show an allowance where the swap's own input belonged. Such a permit now leaves Token In and Amount to the swap and gets three lines of its own: Permit2 allowance, Allowance token and Allowance spender. A permit before the swap steps works as before, and a later permit still keeps its amount from standing. README Transaction Decoding and the TxApproval element list match. Model: opus-5-5
This commit is contained in:
@@ -2422,10 +2422,11 @@ view would leave a wallet one click from deletion.
|
||||
transaction"
|
||||
- Decoded action (if calldata is recognized): action name, token details,
|
||||
amounts, what each swap step spends that the `Amount` line does not give,
|
||||
what each `PERMIT2_TRANSFER_FROM` moves and where to, steps, deadline, and
|
||||
unless a swap pays only the From address, a `Paid to` line for each other
|
||||
address it pays, or saying that a token stays in the router or who it pays
|
||||
is unknown (see Transaction Decoding)
|
||||
what each `PERMIT2_TRANSFER_FROM` moves and where to, what each
|
||||
`PERMIT2_PERMIT` after the step that sets the input side lets its spender
|
||||
take, steps, deadline, and unless a swap pays only the From address, a
|
||||
`Paid to` line for each other address it pays, or saying that a token
|
||||
stays in the router or who it pays is unknown (see Transaction Decoding)
|
||||
- From: color dot + full address + etherscan link
|
||||
- Contract: color dot + full address + etherscan link, token symbol label if
|
||||
known; for a contract creation, the same sentence as on WaitTx
|
||||
@@ -3215,37 +3216,37 @@ Currently supported:
|
||||
V2 exact-in of 400 USDT, both paid by the user, read `1000.0000 USDT`. When
|
||||
the decoder does not know a take's amount, the total is not known and there is
|
||||
no `Amount` line. `Token In` is the token of the last `PERMIT2_PERMIT` the
|
||||
decoder reads, when there is one. Its amount, `Unlimited` included, stands as
|
||||
the `Amount` figure in place of the total only in the plain shape of Uniswap's
|
||||
own routes: it is the only `PERMIT2_PERMIT`, its spender is the router, the
|
||||
router may not let it fail, no step before it takes its token or a token the
|
||||
decoder does not know, and the decoder reads every step after it in full.
|
||||
Permit2 then lets the router take no more of the token than that amount, so
|
||||
the permit covers every take of it. A step the decoder does not read in full
|
||||
may raise what Permit2 lets the router take, as a `PERMIT2_PERMIT_BATCH` can:
|
||||
a command the decoder does not read (listed at the end of this section), a
|
||||
step whose input it cannot read, in whole or in part, and a step it fails on.
|
||||
In any other case the line gives the total, as with no permit. When the step
|
||||
that sets the input side spends a token other than the permit's, or one the
|
||||
decoder does not know, its amount gets lines of its own, unless it states no
|
||||
amount and the user pays it none of its input token, and the total has no
|
||||
figure to start from: unless the permit's amount stands there is no `Amount`
|
||||
line, and each take of the permit's token gets lines of its own. Each take the
|
||||
total does not count gives three lines after the `Amount` line (after
|
||||
`Token In` when there is none): one of a token other than `Token In`; one of
|
||||
`Token In` after an amount that is not a quantity (a V4 open delta,
|
||||
`ALREADY_PAID`, which keep their wording on the `Amount` line, or no stated
|
||||
amount, as of a V4 exact-out step); and one whose amount the decoder does not
|
||||
know. When the step that sets the input side states no amount, the user pays
|
||||
it some of its input token, and there is no `Amount` line, that step gets them
|
||||
too whenever another take's lines give a figure, or a `PERMIT2_TRANSFER_FROM`
|
||||
of its token gives one, on the lines below or, into the router, on its
|
||||
`Paid to` line, so that figure cannot read as all that leaves. When it states
|
||||
no amount and the user pays it none of its input token, as when the router
|
||||
pays it, that step takes none of that token from the user's wallet and never
|
||||
gets them, with a permit or without. They come in step order, the step that
|
||||
sets the input side first when it has them: `Moved from the sender`, its
|
||||
amount, worded as the `Amount` line words one, or
|
||||
decoder reads before the step that sets the input side, when there is one. Its
|
||||
amount, `Unlimited` included, stands as the `Amount` figure in place of the
|
||||
total only in the plain shape of Uniswap's own routes: it is the only
|
||||
`PERMIT2_PERMIT` in the transaction, its spender is the router, the router may
|
||||
not let it fail, no step before it takes its token or a token the decoder does
|
||||
not know, and the decoder reads every step after it in full. Permit2 then lets
|
||||
the router take no more of the token than that amount, so the permit covers
|
||||
every take of it. A step the decoder does not read in full may raise what
|
||||
Permit2 lets the router take, as a `PERMIT2_PERMIT_BATCH` can: a command the
|
||||
decoder does not read (listed at the end of this section), a step whose input
|
||||
it cannot read, in whole or in part, and a step it fails on. In any other case
|
||||
the line gives the total, as with no permit. When the step that sets the input
|
||||
side spends a token other than the permit's, or one the decoder does not know,
|
||||
its amount gets lines of its own, unless it states no amount and the user pays
|
||||
it none of its input token, and the total has no figure to start from: unless
|
||||
the permit's amount stands there is no `Amount` line, and each take of the
|
||||
permit's token gets lines of its own. Each take the total does not count gives
|
||||
three lines after the `Amount` line (after `Token In` when there is none): one
|
||||
of a token other than `Token In`; one of `Token In` after an amount that is
|
||||
not a quantity (a V4 open delta, `ALREADY_PAID`, which keep their wording on
|
||||
the `Amount` line, or no stated amount, as of a V4 exact-out step); and one
|
||||
whose amount the decoder does not know. When the step that sets the input side
|
||||
states no amount, the user pays it some of its input token, and there is no
|
||||
`Amount` line, that step gets them too whenever another take's lines give a
|
||||
figure, or a `PERMIT2_TRANSFER_FROM` of its token gives one, on the lines
|
||||
below or, into the router, on its `Paid to` line, so that figure cannot read
|
||||
as all that leaves. When it states no amount and the user pays it none of its
|
||||
input token, as when the router pays it, that step takes none of that token
|
||||
from the user's wallet and never gets them, with a permit or without. They
|
||||
come in step order, the step that sets the input side first when it has them:
|
||||
`Moved from the sender`, its amount, worded as the `Amount` line words one, or
|
||||
`Unknown (could not be decoded)` when the decoder does not know it;
|
||||
`Token moved`, giving the token's address as the `Token In` line does; and
|
||||
`Moved to`, which reads `The swap step that spends it`. A token the decoder
|
||||
@@ -3268,15 +3269,23 @@ 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. These lines change neither the
|
||||
`Paid to` lines nor the minimum's label. A step goes unread when its recipient
|
||||
does not decode as an address, when it is a V3 swap step whose path is shorter
|
||||
than one token address or has bytes after its last hop, or when it is a
|
||||
command the decoder does not read: every command other than `PERMIT2_PERMIT`,
|
||||
`PERMIT2_TRANSFER_FROM`, `V2_SWAP_EXACT_IN`, `V2_SWAP_EXACT_OUT`,
|
||||
`V3_SWAP_EXACT_IN`, `V3_SWAP_EXACT_OUT`, `V4_SWAP`, `SWEEP`, `TRANSFER`,
|
||||
`PAY_PORTION`, `PAY_PORTION_FULL_PRECISION`, `ACROSS_V4_DEPOSIT_V3`,
|
||||
`WRAP_ETH`, `UNWRAP_WETH` and `BALANCE_CHECK_ERC20`
|
||||
where it goes, and so its amount is shown once. A `PERMIT2_PERMIT` after the
|
||||
step that sets the input side names neither `Token In` nor the `Amount`
|
||||
figure, which keep that step's token and the total: a V3 exact-in of 600 USDT
|
||||
followed by a permit of 5,000 DAI reads `Swap USDT → USDC` with
|
||||
`Amount 600.0000 USDT`. Each such permit, in step order, gives three lines
|
||||
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. These lines change
|
||||
neither the `Paid to` lines nor the minimum's label. A step goes unread when
|
||||
its recipient does not decode as an address, when it is a V3 swap step whose
|
||||
path is shorter than one token address or has bytes after its last hop, or
|
||||
when it is a command the decoder does not read: every command other than
|
||||
`PERMIT2_PERMIT`, `PERMIT2_TRANSFER_FROM`, `V2_SWAP_EXACT_IN`,
|
||||
`V2_SWAP_EXACT_OUT`, `V3_SWAP_EXACT_IN`, `V3_SWAP_EXACT_OUT`, `V4_SWAP`,
|
||||
`SWEEP`, `TRANSFER`, `PAY_PORTION`, `PAY_PORTION_FULL_PRECISION`,
|
||||
`ACROSS_V4_DEPOSIT_V3`, `WRAP_ETH`, `UNWRAP_WETH` and `BALANCE_CHECK_ERC20`
|
||||
(`PERMIT2_TRANSFER_FROM_BATCH`, `EXECUTE_SUB_PLAN` and the NFT commands among
|
||||
them), or a type its release names no command for.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user