Quote
Function Interface introduction
1. quoteExactInput
Contract Interface
Param Explanation
path(
bytes
): A byte array encoding the token swap path and any additional data needed for the swap. This typically includes the addresses of the tokens in the swap path and may include other data specific to the swap routing.amountIn(
uint256
): This is the amount of the initial token that you are willing to swap. If you set this to 0, the contract will use the balance of the token that it holds at the time of the swap as the input amount, which allows for a pattern where tokens are sent to the contract before the swap is executed.
2. quoteExactInputSingle
Contract Interface
Param Explanation
tokenIn (
address
): This is the contract address of the token that you are sending to the swap. It represents the "input" token in the trade.tokenOut (
address
): This is the contract address of the token that you want to receive from the swap. This is the "output" token in the trade.fee (
uint24
): This is the fee amount that will be paid for the swap, denoted in basis points. The fee is typically a small percentage of the trade amount, and it is paid to the liquidity providers of the pool.amountIn (
uint256
): This is the amount oftokenIn
that you want to swap. If you setamountIn
to 0, the contract will use its own balance oftokenIn
as the amount to be swapped.sqrtPriceLimitX96 (
uint160
): This is a limit on the price to which the swap will occur. It's the square root of the price encoded in a fixed-point format. If the price exceeds this limit, the swap will not execute. This can be used to specify the worst exchange rate you are willing to accept for the swap, providing additional protection against slippage.
3. quoteExactOutput
Contract Interface
Param Explanation
path(
bytes
): A byte array encoding the token swap path and any additional data needed for the swap. This typically includes the addresses of the tokens in the swap path and may include other data specific to the swap routing.amountOut (
uint256
): The exact amount of the final token that you want to receive. This is the target amount that dictates the swap's execution.
4. quoteExactOutputSingle
Contract Interface
Param Explanation
tokenIn (
address
): The contract address of the token you are providing in the swap. This is what you are swapping away.tokenOut (
address
): The contract address of the token you want to receive from the swap. This is what you are swapping for.fee (
uint24
): The fee associated with the pool from which you're swapping your tokens, represented in basis points. This fee is paid to liquidity providers of the pool.amountOut (
uint256
): The exact amount oftokenOut
that you wish to receive from the swap.sqrtPriceLimitX96 (
uint160
): A price limit in the form of the square root of the price, encoded in a fixed-point format. The swap will not occur if the price is worse than this price limit, which means you cannot be forced to accept a swap at an unfavorable rate.
Last updated