fix: the approval screen names the address a swap's output is paid to (closes #594)
The swap decoder read no recipient, so a swap paying its output to another address still showed Min. received. It now collects the address that every swap step, SWEEP, WRAP_ETH, UNWRAP_WETH, V4 TAKE and TAKE_ALL pays, across the whole transaction, leaving out payments to the router itself. The minimum reads Min. received only when some step pays the sender, none pays another address, and no step that may pay an address went unread: a recipient that does not decode, or a command or V4 action the decoder does not read. Otherwise it reads Min. paid out, with a Paid to line for each other address and one saying when who is paid is unknown. The approval and transaction detail screens pass the sender in. Model: opus-5-5
This commit is contained in:
@@ -1144,8 +1144,9 @@ fetched, without that cross-address check, and shows the row's figure.
|
||||
|
||||
**Decoded amount lines on the transaction approval screen:** the `Amount` line
|
||||
of a decoded ERC-20 call, and the `Amount` and `Min. received` lines of a
|
||||
decoded swap (see TxApproval below), do not always read as a number. They can
|
||||
read:
|
||||
decoded swap (see TxApproval below; `Min. received` reads `Min. paid out` unless
|
||||
only the user is paid, see Transaction Decoding), do not always read as a
|
||||
number. They can read:
|
||||
|
||||
- A formatted quantity, e.g. `17.1900 USDT`, when the token's scale is known:
|
||||
truncated to four decimals, with the floor and the zero cases described above.
|
||||
@@ -2279,7 +2280,9 @@ view would leave a wallet one click from deletion.
|
||||
- Site origin (bold, scheme and port included) + "wants to send a
|
||||
transaction"
|
||||
- Decoded action (if calldata is recognized): action name, token details,
|
||||
amounts, steps, deadline (see Transaction Decoding)
|
||||
amounts, steps, deadline, and unless a swap pays only the From address, a
|
||||
`Paid to` line for each other address it pays, or saying 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
|
||||
@@ -2914,7 +2917,25 @@ Currently supported:
|
||||
listed as `Execute Sub-Plan (its steps are not shown)`, and whatever the other
|
||||
steps state, the summary names no swap direction, `Token In` and `Token Out`
|
||||
read `Unknown (could not be decoded)`, and there is no `Amount` or
|
||||
`Min. received` line.
|
||||
`Min. received` line. Each swap step, `SWEEP`, `WRAP_ETH`, `UNWRAP_WETH` and
|
||||
V4 `TAKE` names the address it pays, and `TAKE_ALL` pays the transaction's
|
||||
sender. The router reads `address(1)` as the transaction's sender, and
|
||||
`address(2)` as the router itself, which holds what it is paid until a later
|
||||
step pays it out; a payment to the router, as `address(2)` or by its own
|
||||
address, is not counted as paid out. Every payment counts, in whichever step
|
||||
and of whatever token. The minimum reads `Min. received` only when some step
|
||||
pays the transaction's sender (the From address on TxApproval, the sender the
|
||||
explorer reports on TransactionDetail), no step pays any other address, and no
|
||||
step that may pay an address went unread. Otherwise it reads `Min. paid out`,
|
||||
a `Paid to` line after `Token Out` names each other address paid, and one more
|
||||
`Paid to` line reads `Unknown (could not be decoded)` when such a step went
|
||||
unread, or `Unknown (not named in the calldata)` when no step pays anyone. A
|
||||
step goes unread when its recipient does not decode as an address, or when it
|
||||
is a command or V4 action the decoder does not read: every command other than
|
||||
`PERMIT2_PERMIT`, `V2_SWAP_EXACT_IN`, `V2_SWAP_EXACT_OUT`, `V3_SWAP_EXACT_IN`,
|
||||
`V4_SWAP`, `SWEEP`, `WRAP_ETH`, `UNWRAP_WETH` and `BALANCE_CHECK_ERC20`
|
||||
(`V3_SWAP_EXACT_OUT`, `TRANSFER`, `PAY_PORTION` and `EXECUTE_SUB_PLAN` among
|
||||
them), and V4 `TAKE_PORTION`.
|
||||
|
||||
### Non-Goals Forever
|
||||
|
||||
|
||||
Reference in New Issue
Block a user