powered by
Uniswap V4�PoolManager
FlexFee�Hook
ETH/USDC�Pool
Uniswap V4�SwapRouter
FlexFee�App Service
Node/�Indexer
Brevis Service
Brevis Contract
Historical slot0s
Price data proof�Vol calc proof
Fulfill with proof
Store vol
Swap
beforeSwap()
override fee
On-chain
Off-chain
Calculating Volatility via. Brevis
get sqrtPricex96 from storage slot
calculate returns using ZipMap
calculate volatility using Sum, Div and Sqrt
Fee Calculation
Code Walk-through
GitHub repo:
https://github.com/Decentralisedme/uhi_flexfee
High Volatility
Low Volatility
Thank you!
Improve your pool with
Fee = sqrt(volume)*volatility/constant + min_fee
Top Level ETH/USDC Order Book Data Snapshot