I am trying to build a smart contract which performs a multihop swap using Uniswap V3 but wherever I have seen the tutorial, amountOutMinimum is set to 0.

In Uniswap V2 there are several ways to estimate amountOutMinimum, but I am not finding any way to find it using Uniswap V3. Even in single hop swaps it can be done but how can we do it in multi hop swaps?

2 Answers 2


Getting a quote within a transaction is a good way to lose money, and best to not do as a bot can frontrun the transaction by manipulating the prices...

you would really want to build this of chain and pass it to your contract


You are looking for the function quoteExactInput from uniswap's quoter contract. It allows getting the expected amount out for a given swap without executing the swap. For a single swap, use quoteExactInputSingle

Find the deployed Quoter contract address here

Note, however, that unlike Uniswap V2, where the equivalent function getAmountsOut is a view function, the function in v3 is a non-view function and will incur the gas cost.

Also, do note that, the function is not meant to be called on-chain for the purpose of slippage control because performing a swap in the same transaction that this function is called in would provide no slippage protection. You may use this function off-chain to supply the estimates to a smart contract function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.