IMixedRouteQuoterV1

Supports quoting the calculated amounts for exact input swaps. Is specialized for routes containing a mix of V1 and V2 liquidity.

For each pool also tells you the number of initialized ticks crossed and the sqrt price of the pool after the swap.

These functions are not marked view because they rely on calling non-view functions and reverting to compute the result. They are also not gas efficient and should not be called on-chain.

Functions

quoteExactInput

Returns the amount out received for a given exact input swap without executing the swap

function quoteExactInput(bytes memory path, uint256 amountIn)
    external
    returns (
        uint256 amountOut,
        uint160[] memory v2SqrtPriceX96AfterList,
        uint32[] memory v2InitializedTicksCrossedList,
        uint256 v2SwapGasEstimate
    );

Parameters

NameTypeDescription

path

bytes

The path of the swap, i.e. each token pair and the pool fee

amountIn

uint256

The amount of the first token to swap

Returns

NameTypeDescription

amountOut

uint256

The amount of the last token that would be received

v2SqrtPriceX96AfterList

uint160[]

List of the sqrt price after the swap for each v2 pool in the path, 0 for v1 pools

v2InitializedTicksCrossedList

uint32[]

List of the initialized ticks that the swap crossed for each v2 pool in the path, 0 for v1 pools

v2SwapGasEstimate

uint256

The estimate of the gas that the v2 swaps in the path consume

quoteExactInputSingleV2

Returns the amount out received for a given exact input but for a swap of a single pool

function quoteExactInputSingleV2(QuoteExactInputSingleV2Params memory params)
    external
    returns (uint256 amountOut, uint160 sqrtPriceX96After, uint32 initializedTicksCrossed, uint256 gasEstimate);

Parameters

NameTypeDescription

params

QuoteExactInputSingleV2Params

The params for the quote, encoded as QuoteExactInputSingleParams tokenIn The token being swapped in tokenOut The token being swapped out fee The fee of the token pool to consider for the pair amountIn The desired input amount sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap

Returns

NameTypeDescription

amountOut

uint256

The amount of tokenOut that would be received

sqrtPriceX96After

uint160

The sqrt price of the pool after the swap

initializedTicksCrossed

uint32

The number of initialized ticks that the swap crossed

gasEstimate

uint256

The estimate of the gas that the swap consumes

quoteExactInputSingleV1

Returns the amount out received for a given exact input but for a swap of a single V1 pool

function quoteExactInputSingleV1(QuoteExactInputSingleV1Params memory params) external returns (uint256 amountOut);

Parameters

NameTypeDescription

params

QuoteExactInputSingleV1Params

The params for the quote, encoded as QuoteExactInputSingleV1Params tokenIn The token being swapped in tokenOut The token being swapped out amountIn The desired input amount

Returns

NameTypeDescription

amountOut

uint256

The amount of tokenOut that would be received

Structs

QuoteExactInputSingleV2Params

struct QuoteExactInputSingleV2Params {
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
    uint24 fee;
    uint160 sqrtPriceLimitX96;
}

QuoteExactInputSingleV1Params

struct QuoteExactInputSingleV1Params {
    address tokenIn;
    address tokenOut;
    uint256 amountIn;
}

Last updated