How to Preview the Output Amount on Uniswap at a Smart Contract Level?

Make a call to the Quoter contract on UniSwap V3.

How to Preview the Output Amount on Uniswap at a Smart Contract Level?

Question:


Hey! quick and simple question. With uniswap v3, at a smart contract level, how can I know or preview from before the output amount of a swap given a certain input amount?

Answer:


Here's how to do it:

  • Join UniSwap discord.
  • In #general channel of UniSwap discord, ask to admin that you want to have access to Channels & Roles channel.
  • Go up to Channels & Roles channel.
  • Grab the dev role, by selecting developer community.
  • Now, with UniSwap V3 you can make a call to the Quoter contract which is designed to give a V3 quote of expected output / input.

👉🏻
Are you interested in becoming a Shots contributor or do you have any questions for our current contributors? Join our Discord community.