Skip to content

Incorrect Parameter in Uniswap v4 Docs for IV4Router #901

Closed
@cqlyj

Description

@cqlyj

I've noticed a discrepancy in the Swapping on Uniswap v4

Problem

In section 3.4: Preparing the Swap Inputs, the example shows the IV4Router.ExactInputSingleParams struct with six parameters:

  IV4Router.ExactInputSingleParams({
        poolKey: key,
        zeroForOne: true,            // true if we're swapping token0 for token1
        amountIn: amountIn,          // amount of tokens we're swapping
        amountOutMinimum: minAmountOut, // minimum amount we expect to receive
@>  sqrtPriceLimitX96: uint160(0),  // no price limit set
        hookData: bytes("")             // no hook data needed
    })

However, when following the import path:

import { IV4Router } from "@uniswap/v4-periphery/contracts/interfaces/IV4Router.sol";

The actual interface for ExactInputSingleParams is:

 /// @notice Parameters for a single-hop exact-input swap
    struct ExactInputSingleParams {
        PoolKey poolKey;
        bool zeroForOne;
        uint128 amountIn;
        uint128 amountOutMinimum;
        bytes hookData;
    }

Issue

  • The documentation includes an extra parameter, sqrtPriceLimitX96, which is not present in the actual interface.
  • Attempting to compile using the example results in a contract error due to the unexpected sqrtPriceLimitX96 parameter.

Expected Fix

  • Either update the documentation to remove sqrtPriceLimitX96, or clarify if an updated contract interface includes it.

Could you confirm whether the docs are outdated or if sqrtPriceLimitX96 was intended to be part of ExactInputSingleParams?

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions