← Back to home

Anti-Toxicity Hook

This UniswapV4 hook reduces impermanent loss by rewarding trades that goes against the market

Problem Statement

This UniswapV4 hook protects liquidity providers from impermanent loss by incentivizing balanced trading activity. When traders execute large one-directional trades that move prices significantly, liquidity providers typically lose value compared to simply holding their assets. This hook addresses that problem by encouraging traders to swap in the opposite direction of recent price movements, helping liquidity providers rebalance their positions back to equilibrium. Additionally, LPs can opt into automated position management, allowing the hook to rebalance their positions on their behalf.

Solution

The hook intercepts swap through beforeSwap and afterSwap callbacks to implement a dynamic rebalancing incentive system. The core mechanism tracks and measures cumulative directional trading pressure. When swaps occur, we compute their impact relative to the past trend since rebalancing and depending on this, the fee is adjusted Traders swapping against the current imbalance receive fee discounts, while trades worsening the imbalance pay premium fees. This creates natural economic incentives for arbitrageurs to play against the market, resulting in rebalancing opportunities for market makers. For LPs who opt in, we implemented automated position management that monitors trends and automatically place the right ranges and even, place rebalancing ranges when needed.

Hackathon

ETHGlobal Buenos Aires

2025

Prizes

  • 🏆

    Uniswap v4 Stable - Asset Hooks3rd place

    Uniswap Foundation

Contributors