-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de5df3f
commit f02f8a1
Showing
1 changed file
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,50 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity 0.8.21; | ||
|
||
/// @title Quoter Interface | ||
/// @notice Supports quoting the calculated amounts from exact input or exact output swaps | ||
/// @dev 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. | ||
interface IQuoter { | ||
function quoteExactOutputSingle( | ||
/// @notice Returns the amount out received for a given exact input swap without executing the swap | ||
/// @param path The path of the swap, i.e. each token pair and the pool fee | ||
/// @param amountIn The amount of the first token to swap | ||
/// @return amountOut The amount of the last token that would be received | ||
function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut); | ||
|
||
/// @notice Returns the amount out received for a given exact input but for a swap of a single pool | ||
/// @param tokenIn The token being swapped in | ||
/// @param tokenOut The token being swapped out | ||
/// @param fee The fee of the token pool to consider for the pair | ||
/// @param amountIn The desired input amount | ||
/// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap | ||
/// @return amountOut The amount of `tokenOut` that would be received | ||
function quoteExactInputSingle( | ||
address tokenIn, | ||
address tokenOut, | ||
uint24 fee, | ||
uint256 amountOut, | ||
uint256 amountIn, | ||
uint160 sqrtPriceLimitX96 | ||
) external payable returns(uint256); | ||
) external returns (uint256 amountOut); | ||
|
||
function quoteExactInputSingle( | ||
/// @notice Returns the amount in required for a given exact output swap without executing the swap | ||
/// @param path The path of the swap, i.e. each token pair and the pool fee | ||
/// @param amountOut The amount of the last token to receive | ||
/// @return amountIn The amount of first token required to be paid | ||
function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn); | ||
|
||
/// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool | ||
/// @param tokenIn The token being swapped in | ||
/// @param tokenOut The token being swapped out | ||
/// @param fee The fee of the token pool to consider for the pair | ||
/// @param amountOut The desired output amount | ||
/// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap | ||
/// @return amountIn The amount required as the input for the swap in order to receive `amountOut` | ||
function quoteExactOutputSingle( | ||
address tokenIn, | ||
address tokenOut, | ||
uint24 fee, | ||
uint256 amountIn, | ||
uint256 amountOut, | ||
uint160 sqrtPriceLimitX96 | ||
) external payable returns(uint256); | ||
) external returns (uint256 amountIn); | ||
} |