1 of 11

powered by

2 of 11

3 of 11

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

4 of 11

Calculating Volatility via. Brevis

get sqrtPricex96 from storage slot

calculate returns using ZipMap

calculate volatility using Sum, Div and Sqrt

5 of 11

Fee Calculation

6 of 11

Code Walk-through

7 of 11

High Volatility

Low Volatility

8 of 11

Thank you!

Improve your pool with

powered by

9 of 11

Improve your pool with

10 of 11

Fee = sqrt(volume)*volatility/constant + min_fee

11 of 11

Top Level ETH/USDC Order Book Data Snapshot