Uniswap V2_SWAP_EXACT_OUT (command 0x09) is decoded by a function nothing calls #283
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while adding ESLint in #152 —
no-unused-varsflagged it.src/shared/uniswap.jsdefinesdecodeV2SwapExactOut()(line 105), the decoder for Universal Router command0x09. The command dispatch indecode()handles0x00(decodeV3SwapExactIn),0x08(decodeV2SwapExactIn),0x0b,0x0eand0x10, but there is nocmdId === 0x09arm, sodecodeV2SwapExactOutis never called.0x09is 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-varspointing at this issue, so the code the fix needs is still there.Done when
decode()handles0x09the way it handles0x08, a test covers a V2 exact-out calldata sample, and theeslint-disablecomment insrc/shared/uniswap.jsis removed.