Adaptive Hook AMM

Uniswap v4 dynamic-fee hook that neutralizes sandwich attacks & LVR via intra-block MEV dampening.

ETHOnline 2026Shipped September 4, 2026 Quiet#defi#infra
Repo
Adaptive Hook AMM banner

About

AdaptiveVol AMM is a Uniswap v4 Hook that protects liquidity providers (LPs) from MEV bots and market volatility.

Normally, dynamic-fee pools only look at old price data. Because of this, MEV bots can easily predict the fees and run sandwich attacks, causing LPs to lose money (known as LVR).

Our hook solves this problem with two features: 1. Volatility Fees: We index swap history with The Graph and calculate market volatility using Chainlink Functions. The hook changes the fee tier (0.10%, 0.30%, or 1.00%) based on how calm or wild the market is. 2. MEV Defense: The hook checks the pool price at the start of each block. If a sudden intra-block price spike is detected during a sandwich attack, the fee immediately jumps to 5%. This makes the attack unprofitable for the bot while keeping regular gas costs very low (~16.7k gas).

We also created an interactive web interface where users can simulate swaps, test volatility changes, and see the MEV protection in action.

How it's made

We built this project using Solidity, Foundry, Uniswap v4, The Graph, and Chainlink Functions. Here is how the different parts work together:

1. Uniswap v4 Hook (Solidity & Foundry): We developed a smart contract called AdaptiveFeeHook. Inside the `beforeSwap` function, the hook checks the swap price. It remembers the pool price at the start of each block. If a swap causes a sudden, abnormal price jump in the same block (which is how sandwich bots attack), the hook immediately increases the fee to 5%. This stops the bot from making any profit and protects regular traders and liquidity providers.

2. Indexing Swaps with The Graph:

We created a custom Subgraph in AssemblyScript. It listens to Uniswap v4 PoolManager events (Initialize and Swap) and stores recent pool prices and swap history in real-time.

3. Volatility Bridge with Chainlink Functions: We wrote a JavaScript script that runs on Chainlink Functions. It fetches the recent swap history from our Subgraph, calculates the price volatility (standard deviation), and sends the result back onchain. The hook then adjusts the pool fee between Low (0.10%), Medium (0.30%), and High (1.00%). If the oracle ever stops responding, the contract safely switches to the High fee tier automatically.

4. Testing & Web Sandbox:

We wrote 32 unit and invariant tests in Foundry. Our tests prove that the hook only adds about 16.7k gas overhead and successfully causes sandwich attackers to lose money. Finally, we built an interactive web dashboard using simple HTML, CSS, and JavaScript so anyone can easily test the swaps and simulate MEV defense in their browser.

From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

QuietLast push 83 days ago

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.

Aven

Uniswap v4 hook pricing every swap from Hyperliquid's in-block oracle, so LPs stop losing to arbs

ETHGlobal MumbaiPrize winnerJudge 7.6 Shipping#defi#gaming

AsymmetricFeesHook

It’s a Uniswap v4 hook inspired by Nezlobin’s Directional Fee, designed to make LPs more profitable by dynamically adjusting the pool fee.