quote reads a pool TWAP (or spot when the pool lacks history) and is the slippage reference for Zap, PositionRouter, FeeCollector, and CreatorFeeRouter. It is never a collateral price. An owner sets the default fee tier, a per-pair fee, and the TWAP window, with two-step ownership transfer.
UniswapV3Adapter lets you:
- Quote a multi-hop swap against pool TWAPs
- Execute an exact-input multi-hop swap
- Read the fee tier used for any pair
- Let the owner tune fee tiers and the TWAP window
The source code is
src/periphery/UniswapV3Adapter.sol on GitHub. The ABI is /abis/UniswapV3Adapter.json.
Write methods
setOwner
acceptOwner. Owner only. Reverts with ZeroAddress for the zero address.
Input parameters
acceptOwner
setDefaultFee
setTwapWindow
quote. A window of 0 makes quote use spot. Owner only.
Input parameters
setPairFee
swapExactTokensForTokens
amountIn of the first path token from the caller and swaps it through SwapRouter02 to to. Reverts with the same path errors as quote, ZeroAddress for a zero recipient, and ZeroAmount if the output is 0. SwapRouter02 reverts if the output is below amountOutMin.
Input parameters
Return values
Read methods
quote
amountIn along path using each hop’s TWAP over twapWindow, or spot if the window is 0 or the pool cannot observe that far back. Reverts with InvalidPath for fewer than two hops or repeated tokens, ZeroAddress for a zero hop, ZeroAmount for a zero input or output, and NoPool if a hop has no pool at the configured fee.
Input parameters
Return values
feeOf
defaultFee. Order of the two tokens does not matter.
Input parameters
Return values