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

feat: add output quote methods to uniswap #10

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0xdcota
Copy link

@0xdcota 0xdcota commented Mar 3, 2024

This pull request intends to add the following methods as static-view to the UniswapV3StaticQuoter.sol contract.

        /// @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 view 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 amountOut,
		uint160 sqrtPriceLimitX96
	) external view returns (uint256 amountIn);

@halo3mic
Copy link
Member

Hi, thanks for your contribution!

Do you mind please adding tests for this

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 this pull request may close these issues.

2 participants