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 reads the recipient of every swap step, SWEEP, UNWRAP_WETH, V4 TAKE and TAKE_ALL, reads the router's placeholders as the router does (address(1) is the sender, address(2) the router, which holds the output until a later SWEEP or UNWRAP_WETH pays it out), and compares the result with the transaction's sender. When the output goes anywhere else, a Paid to line names each address it is paid to and the minimum reads Min. paid out. 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` when
|
||||
the output is paid to another address, 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 for a swap whose output is paid to an
|
||||
address other than the From address, each address it is paid to (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,24 @@ 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`, `UNWRAP_WETH` and V4 `TAKE`
|
||||
names the address it pays, and `TAKE_ALL` pays the transaction's sender. The
|
||||
router reads two of those addresses as placeholders: `address(1)` is the
|
||||
transaction's sender, and `address(2)` is the router itself, which holds what
|
||||
it is paid until a later step pays it out. The output is paid to the address
|
||||
of the step that sets the output side (for a V4 step, of every `TAKE` and
|
||||
`TAKE_ALL` of its output currency), or, when no step sets it, of the
|
||||
`UNWRAP_WETH` that makes `Token Out` ETH. While the router holds it, the next
|
||||
`SWEEP` of the output token, or `UNWRAP_WETH` of a WETH output, pays it to
|
||||
that step's address. A `BALANCE_CHECK_ERC20` step pays nothing and leaves the
|
||||
address as it was. An output nothing pays out is paid to the router. When the
|
||||
output is paid to any address other than the transaction's sender (the From
|
||||
address on TxApproval, the sender the explorer reports on TransactionDetail),
|
||||
a `Paid to` line after `Token Out` names each address it is paid to, the
|
||||
sender's included, and `Min. received` reads `Min. paid out`. A swap paid to
|
||||
the sender, directly or through the router, has neither. The decoder does not
|
||||
read `TRANSFER`, `PAY_PORTION` or V4 `TAKE_PORTION`, each of which pays an
|
||||
amount or a share to an address of its own.
|
||||
|
||||
### Non-Goals Forever
|
||||
|
||||
|
||||
Reference in New Issue
Block a user