The DEXPriceAggregatorUniswapV3 module is a DEX-based price oracle aggregating spot and TWAP rates from Uniswap V3 that selects the worst rate between spot and TWAP.
The module is able to handle queries for asset prices across an intermediate liquidity pool (e.g. WBTC -> WETH -> USDC).
It’s useful for all price queries:
- Reverts if no pool route is found for the given
tokenInandtokenOut - Reverts if
twapPeriodis0 - Reverts if the
twapPeriodis too large for the underlying pool’s history. In this case, you will have to increase the history stored by the pool by callingUniswapV3Pool#increaseObservationCardinalityNext()(see v3 whitepaper section 5.1).
You can access this Module and the code here: https://bit.ly/3zhVDqZ
How to Use
- Deploy smart contract via
Bunzz. - When deploy, specify UniswapV3Factory address, wrapped native token address (for example, for Ethereum, WETH address), and default pool fee (for example 3000).
- Users can set pool for the route using
setPoolForRoutefunction. - Users can query prices using
assetToAsset,assetToEth,ethToAssetfunctions.
Functions
#WRITE
- setPoolForRoute
- transferOwnership
- renounceOwnership
#READ
- assetToAsset
- assetToEth
- defaultPoolFee
- ethToAsset
- fetchCurrentTicks
- getQuoteAtTick
- getQuoteCrossingTicksThroughWeth
- overriddenPoolForRoute
- owner
- uniswapV3Factory
- weth
- getPoolForRoute
You can access this Module and the code here: https://bit.ly/3zhVDqZ
If you still haven’t signed up to Bunzz, what are you waiting for?
Sign up here https://app.bunzz.dev/signup and get your smart contracts deployed in 5 minutes through our great GUI.







