Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Parameter in Uniswap v4 Docs for IV4Router #901

Open
cqlyj opened this issue Feb 18, 2025 · 0 comments · May be fixed by #906
Open

Incorrect Parameter in Uniswap v4 Docs for IV4Router #901

cqlyj opened this issue Feb 18, 2025 · 0 comments · May be fixed by #906
Assignees

Comments

@cqlyj
Copy link

cqlyj commented Feb 18, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants