I initially planned to use Arbitrum Stylus for the FeeCalculator to optimize the volatility math operations. The WASM execution environment would have handled our complex calculations more efficiently than standard EVM opcodes.
Unfortunately, I hit several technical roadblocks:
After spending too much time debugging, I pivoted to a pure Solidity implementation with optimized fixed-point arithmetic. This proved more reliable while maintaining acceptable performance for our fee calculations.
Demo video: https://www.veed.io/view/dd3a0e44-5452-4785-a5cb-e5ef9ada7fb0?panel=share Github: https://github.com/Dhruv-Varshney-developer/VolatiFee Dynamic Fee vs Fixed Fee: https://dhruv-varshney-developer.github.io/VolatiFee/comparison-output.html
Presentation link: https://www.canva.com/design/DAGjKysVuPM/87prTx5Qh8MHcCCHEw2z8Q/edit?utm_content=DAGjKysVuPM&utm_campaign=designshare&utm_medium=link2&utm_source=sharebutton
Posted an X thread summarizing my experience: https://x.com/DhruvVa86396760/status/1906450485428846880
I developed DynamicFeeHook to address a real problem I observed during the Trump Bitcoin reserve announcement. When that news hit, crypto markets experienced significant volatility, and liquidity providers on Uniswap faced substantial impermanent loss while their fee income barely compensated for it. My solution is straightforward: a Uniswap v4 hook that adjusts fees based on market volatility. When price swings increase (like during major announcements), the fees automatically rise to better compensate LPs for the additional risk they're taking on. This creates a more balanced ecosystem where LPs don't have to fear volatility events. Instead of watching their positions deteriorate during market turbulence, they can receive appropriate compensation through higher fees that reflect the actual market conditions. I believe this approach could meaningfully improve LP returns while maintaining liquidity during crucial market moments when it's needed most.
This is actually something useful that genuinely helps the ecosystem. We ran backtests in our MVP using real Uniswap V3 ETH/USDT pool data, and the results were solid:
22.7% increase in LP returns
18.7% reduction in impermanent loss