Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0ec72c671 |
@@ -883,18 +883,11 @@ and the value does, the amount is extended to its first significant digit
|
||||
instead: `0.000000000000000001 DAI`, not `0.0000 DAI`. The test is on the whole
|
||||
truncated string, integer part included, so `1.00005` still shows as `1.0000` —
|
||||
the exception only fires where the entire displayed figure would read as zero.
|
||||
Truncation stays truncation: `0.99999` shows as `0.9999`, never rounded up. A
|
||||
genuine zero reaching this rule renders `0.0000`. The swap screen states a zero
|
||||
in words before it gets here in only two places. Its `Min. received` line reads
|
||||
`None (no minimum guaranteed)` for any zero minimum. Its `Amount` line reads
|
||||
`All available (V4 open delta)` when the amount it shows is a V4 exact-in
|
||||
`amountIn` of zero, which V4 treats as the whole open credit rather than a
|
||||
quantity. That line shows the amount of one step: the last `PERMIT2_PERMIT` step
|
||||
if there is any (a `Permit2 Permit Batch` step does not count), otherwise the
|
||||
first V2 or V3 exact-in, `WRAP_ETH` or V4 swap step, where a V4 swap step gives
|
||||
the `amountIn` of its first exact-in action. Every other zero amount with a
|
||||
known scale renders `0.0000`, the swap's `Amount` line included; the list of
|
||||
amount-slot strings below says where.
|
||||
Truncation stays truncation: `0.99999` shows as `0.9999`, never rounded up. The
|
||||
rule still renders a genuine zero as `0.0000`. Two lines of a swap say a zero in
|
||||
words instead: `Min. received` reads `None (no minimum guaranteed)` for a zero
|
||||
minimum, and `Amount` reads `All available (V4 open delta)` when the amount it
|
||||
shows is a V4 exact-in `amountIn` of zero.
|
||||
|
||||
The rule and its exception live in `src/shared/amountDisplay.js` as
|
||||
`truncateAmount()` and `truncateAmountNeverZero()`. Everything the approval and
|
||||
@@ -947,48 +940,40 @@ and compare against. Reading the stored field directly instead answers `null`
|
||||
for a bundled or tracked token the explorer merely omitted, which is not a
|
||||
refusal the wallet has any reason to make.
|
||||
|
||||
**Every string an amount slot can show:** taken together, the exceptions above
|
||||
mean an amount line on the dApp approval screen (and the wait/success/error
|
||||
screens that carry a figure forward) shows one of a fixed set of strings, not
|
||||
always a number:
|
||||
**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:
|
||||
|
||||
- A formatted quantity, e.g. `17.1900 USDT`: the token's scale is known. A
|
||||
figure at or above the floor is truncated to four decimals, one below it is
|
||||
extended to its first significant digit, and a genuine zero renders `0.0000`,
|
||||
e.g. `0.0000 USDT`. That zero reaches the ERC-20 `approve`/`transfer` line for
|
||||
an amount of zero, and the swap's `Amount` line when the step that sets it
|
||||
states zero: a `PERMIT2_PERMIT` step, a V2 or V3 exact-in `amountIn`, or a
|
||||
`WRAP_ETH` (`0.0000 ETH`). This is `truncateAmountNeverZero()`
|
||||
(`src/shared/amountDisplay.js`).
|
||||
- `Unlimited`: named rather than formatted, since it needs no scale to describe.
|
||||
On the ERC-20 line it is an `approve` of the `uint256` maximum, an unbounded
|
||||
allowance (`src/popup/views/approval.js`); `transfer` has no such case. On a
|
||||
swap's `Amount` line it is any input amount at or above the `uint160` maximum,
|
||||
whichever step set the line (`src/shared/uniswap.js`): a `PERMIT2_PERMIT`
|
||||
- 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.
|
||||
- `<amount> base units (decimals unknown)` when the scale is unknown: the
|
||||
base-unit integer, rather than a figure at a guessed scale (see Unknown token
|
||||
scale above).
|
||||
- `Unlimited`: on the ERC-20 `Amount` line, an `approve` of the `uint256`
|
||||
maximum, an unbounded allowance. On the swap's `Amount` line, any amount at or
|
||||
above the `uint160` maximum, whichever step set the line: a `PERMIT2_PERMIT`
|
||||
amount at that maximum, which is an unbounded permit, or a V2 or V3 exact-in
|
||||
`amountIn` or `WRAP_ETH` amount that large. That includes the router's
|
||||
whole-balance value (`2^255`), which tells the router to use all it holds of
|
||||
the token — a quantity decided at execution, not an allowance.
|
||||
- `All available (V4 open delta)`: a V4 exact-in swap whose `amountIn` is zero.
|
||||
V4 reads that zero as "use the whole open delta", not as a literal zero, so
|
||||
the calldata states no quantity at all. Swap `Amount` line only, and only when
|
||||
the swap has no `PERMIT2_PERMIT` step and its first V2 or V3 exact-in,
|
||||
`WRAP_ETH` or V4 swap step is a V4 swap step whose first exact-in action has
|
||||
an `amountIn` of zero (`src/shared/uniswap.js`).
|
||||
- `None (no minimum guaranteed)`: a zero minimum — the swap guarantees nothing
|
||||
back. It is a literal zero slippage floor on a V2/V3/V4 swap, and it also
|
||||
reaches a `BALANCE_CHECK_ERC20` step: a zero `minBalance`, which once rendered
|
||||
`0.0000` beside the token symbol, now reads this. Swap `Min. received` line
|
||||
(`src/shared/uniswap.js`).
|
||||
- `<amount> base units (decimals unknown)`: the token's scale could not be
|
||||
resolved, so the base-unit integer is shown with that caveat rather than
|
||||
formatted (see Unknown token scale above). Reaches both the ERC-20 amount line
|
||||
and the swap's `Amount` and `Min. received` (`unknownDecimalsAmount()` in
|
||||
`src/shared/approvalAmount.js`).
|
||||
- `Unknown (not named in the calldata)`: not an amount but the currency itself —
|
||||
the `Token In` or `Token Out` line when nothing in the calldata established
|
||||
which token, shown beside the amount and, like the strings above, a sentence
|
||||
rather than a value (`src/shared/uniswap.js`).
|
||||
or `WRAP_ETH` amount that large, which is not an allowance. The router's
|
||||
whole-balance value, `CONTRACT_BALANCE` (`2^255`), is one such amount.
|
||||
- `All available (V4 open delta)`: the swap's `Amount` line, when the amount it
|
||||
shows is a V4 exact-in `amountIn` of zero. V4 reads that zero as "use the
|
||||
whole open delta", so the calldata states no quantity. The line shows the
|
||||
amount of one step that names an input token or amount: the last
|
||||
`PERMIT2_PERMIT` step if there is one, otherwise the first V2 or V3 exact-in,
|
||||
`WRAP_ETH` or V4 swap step, a V4 swap step giving the `amountIn` of its first
|
||||
readable exact-in action.
|
||||
- `None (no minimum guaranteed)`: the swap's `Min. received` line, when the
|
||||
minimum it shows is zero, whether a V2, V3 or V4 swap's minimum or a
|
||||
`BALANCE_CHECK_ERC20` step's `minBalance`. Before
|
||||
[#359](https://git.eeqj.de/sneak/AutistMask/issues/359), a zero `minBalance`
|
||||
read `0.0000` when the token's scale was known.
|
||||
|
||||
The swap's `Token In` and `Token Out` lines name a currency, not an amount; each
|
||||
reads `Unknown (not named in the calldata)` when the decoder found no token for
|
||||
that side. The token permission warning on the signature screen has its own
|
||||
amount wording, including `Unknown`; the SignApproval section below describes
|
||||
it.
|
||||
|
||||
#### Partial USD totals
|
||||
|
||||
|
||||
@@ -173,23 +173,19 @@ but the review is broader than any of them.
|
||||
standalone storage entry, never part of the versioned `autistmask` profile, so
|
||||
the state schema is untouched and no existing profile is affected.
|
||||
|
||||
- 2026-09-21: `README.md` now documents the approval screen's amount-slot
|
||||
vocabulary and no longer contradicts itself
|
||||
([#369](https://git.eeqj.de/sneak/AutistMask/issues/369)). The stale claim
|
||||
that a genuine zero always renders `0.0000` is corrected: a zero with a known
|
||||
scale does, except where the swap screen states it in words first —
|
||||
`Min. received` always, and the `Amount` line when the amount it shows is a V4
|
||||
exact-in `amountIn` of zero. That line shows the amount of the last
|
||||
`PERMIT2_PERMIT` step if there is any, otherwise of the first V2/V3 exact-in,
|
||||
`WRAP_ETH` or V4 swap step, where a V4 swap step uses its first exact-in
|
||||
action; any other known-scale zero there reads `0.0000`. The amount-display
|
||||
section now names every string a slot can show and when — a formatted quantity
|
||||
(a known-scale zero included), `Unlimited` (on a swap also the router's
|
||||
whole-balance value), `All available (V4 open delta)`,
|
||||
`None (no minimum guaranteed)`, base units with decimals unknown, and
|
||||
`Unknown (not named in the calldata)` — and records that a zero `minBalance`
|
||||
on a `BALANCE_CHECK_ERC20` step now reads `None (no minimum guaranteed)` where
|
||||
it once read `0.0000`. Docs only.
|
||||
- 2026-09-21: `README.md` no longer says a genuine zero always renders `0.0000`
|
||||
([#369](https://git.eeqj.de/sneak/AutistMask/issues/369)). The amount rule
|
||||
still renders one as `0.0000`, but two swap lines say a zero in words instead:
|
||||
`Min. received` reads `None (no minimum guaranteed)` for a zero minimum, and
|
||||
`Amount` reads `All available (V4 open delta)` when the amount it shows is a
|
||||
V4 exact-in `amountIn` of zero. A new list says what the decoded ERC-20 and
|
||||
swap amount lines on the transaction approval screen can read: a formatted
|
||||
quantity, base units with decimals unknown, `Unlimited`,
|
||||
`All available (V4 open delta)` and `None (no minimum guaranteed)`, which a
|
||||
zero `minBalance` on a `BALANCE_CHECK_ERC20` step now reads instead of
|
||||
`0.0000` at a known scale. The README also names
|
||||
`Unknown (not named in the calldata)` on the swap's token lines, and points to
|
||||
SignApproval for the token permission warning's own wording. Docs only.
|
||||
|
||||
- 2026-08-30: An address no longer wraps, or is shortened to fit, in any of the
|
||||
common views ([#380](https://git.eeqj.de/sneak/AutistMask/issues/380)). The
|
||||
|
||||
Reference in New Issue
Block a user