Uniswap V2_SWAP_EXACT_OUT (command 0x09) is decoded by a function nothing calls #283

Open
opened 2026-08-14 06:08:15 +02:00 by clawbot · 0 comments
Collaborator

Found while adding ESLint in #152no-unused-vars flagged it.

src/shared/uniswap.js defines decodeV2SwapExactOut() (line 105), the decoder for Universal Router command 0x09. The command dispatch in decode() handles 0x00 (decodeV3SwapExactIn), 0x08 (decodeV2SwapExactIn), 0x0b, 0x0e and 0x10, but there is no cmdId === 0x09 arm, so decodeV2SwapExactOut is never called.

0x09 is listed in the command-name table at line 23 as "V2 Swap (Exact Out)", so the name is shown but the swap's input token, output token and amounts are not extracted. The approval preview for a Uniswap V2 exact-out swap therefore shows no token or amount detail, which is exactly the detail the preview exists to show.

Not fixed there: wiring a new command arm changes what the approval screen tells the user about a transaction, which is outside a lint-adoption change. The function was left in place with a scoped eslint-disable-next-line no-unused-vars pointing at this issue, so the code the fix needs is still there.

Done when decode() handles 0x09 the way it handles 0x08, a test covers a V2 exact-out calldata sample, and the eslint-disable comment in src/shared/uniswap.js is removed.

Found while adding ESLint in https://git.eeqj.de/sneak/AutistMask/issues/152 — `no-unused-vars` flagged it. `src/shared/uniswap.js` defines `decodeV2SwapExactOut()` (line 105), the decoder for Universal Router command `0x09`. The command dispatch in `decode()` handles `0x00` (`decodeV3SwapExactIn`), `0x08` (`decodeV2SwapExactIn`), `0x0b`, `0x0e` and `0x10`, but there is no `cmdId === 0x09` arm, so `decodeV2SwapExactOut` is never called. `0x09` is listed in the command-name table at line 23 as `"V2 Swap (Exact Out)"`, so the name is shown but the swap's input token, output token and amounts are not extracted. The approval preview for a Uniswap V2 exact-out swap therefore shows no token or amount detail, which is exactly the detail the preview exists to show. Not fixed there: wiring a new command arm changes what the approval screen tells the user about a transaction, which is outside a lint-adoption change. The function was left in place with a scoped `eslint-disable-next-line no-unused-vars` pointing at this issue, so the code the fix needs is still there. Done when `decode()` handles `0x09` the way it handles `0x08`, a test covers a V2 exact-out calldata sample, and the `eslint-disable` comment in `src/shared/uniswap.js` is removed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#283