harden: the swap approval screen guesses 18 decimals for any token not in the bundled list #340

Closed
opened 2026-08-23 15:25:19 +02:00 by clawbot · 0 comments
Collaborator

Raised by the review of #339 (#339 (comment)). Pre-existing, not introduced by that PR.

tokenInfo() in src/shared/uniswap.js returns decimals: 18 for any token not in the bundled token list. That is the same guessed-scale assumption #306 removed from the ERC-20 path, still live on the Uniswap path.

The consequence is the one #306 was filed for: an amount on the approval screen that is wrong by a factor of 10^n rather than merely imprecise. A 6-decimal token formatted at 18 decimals renders a real 1000.00 USDT swap as 0.000000000001 — the screen whose entire job is to state what is being authorized, stating something else. Any token off the bundled list reaches this, which includes every newly listed token.

Definition of done

  • The swap path resolves the real token scale, or refuses to format when it cannot — matching the rule #306 established for ERC-20. Do not substitute a different guess.
  • A refusal is visible on screen as a refusal, not as a number.
  • Test: a swap involving a 6-decimal token absent from the bundled list. The test fails against current head — state the mutation and its observed result.
  • make check green.
Raised by the review of https://git.eeqj.de/sneak/AutistMask/pulls/339 (https://git.eeqj.de/sneak/AutistMask/pulls/339#issuecomment-69003). Pre-existing, not introduced by that PR. `tokenInfo()` in `src/shared/uniswap.js` returns `decimals: 18` for any token not in the bundled token list. That is the same guessed-scale assumption https://git.eeqj.de/sneak/AutistMask/issues/306 removed from the ERC-20 path, still live on the Uniswap path. The consequence is the one #306 was filed for: an amount on the approval screen that is wrong by a factor of 10^n rather than merely imprecise. A 6-decimal token formatted at 18 decimals renders a real 1000.00 USDT swap as 0.000000000001 — the screen whose entire job is to state what is being authorized, stating something else. Any token off the bundled list reaches this, which includes every newly listed token. ## Definition of done - [ ] The swap path resolves the real token scale, or refuses to format when it cannot — matching the rule https://git.eeqj.de/sneak/AutistMask/issues/306 established for ERC-20. Do not substitute a different guess. - [ ] A refusal is visible on screen as a refusal, not as a number. - [ ] Test: a swap involving a 6-decimal token absent from the bundled list. The test fails against current head — state the mutation and its observed result. - [ ] `make check` green.
clawbot added this to the 1.0.0 milestone 2026-08-23 15:25:19 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#340