DepegSentinel
DepegSentinel: Dynamically adjusts fees to punish depegs and reward peg-stabilizing trades.
Problem Statement
DepegSentinel – Dynamic Fee & Depeg Resolver Hook for DEXsOverviewDepegSentinel is a Uniswap V4 hook designed to automatically safeguard pegged and liquid token pools from depegging events. Whether it’s stablecoins like USDC/USDT, liquid staking tokens like stETH/WETH, or protocol-native assets like kHYPE/HYPE, DepegSentinel ensures pools maintain a healthy peg by dynamically adjusting fees based on real-time market data.Unlike static fee models, DepegSentinel actively monitors price feeds and modifies trading costs to penalize behaviors that worsen a depeg and incentivize trades that help restore the peg.Problem It SolvesPegged assets can diverge from their intended value due to large trades, liquidity shocks, or market stress.Current DEX pools rely on static fees, which don’t account for real-time risk during depeg events.Traders that worsen the peg unintentionally or intentionally can cause cascading liquidity issues and losses for LPs.Protocols need a way to automatically penalize destabilizing trades and reward stabilizing trades without manual intervention.ExampleUSDC depeg eventsin the past have caused temporary losses for LPs.A recentHyperliquid pool (kHYPE/HYPE)lost ~80% of its peg in one event.Manual intervention or reactive mechanisms are too slow to protect liquidity.Core FunctionalityDepegSentinel operates as a hook attached to Uniswap V4 pools, performing the following:Real-Time Price MonitoringIntegrates withPyth Networkto fetch live market prices for pegged assets.Tracks deviations from the ideal 1:1 peg or expected ratio for liquid staking tokens.Dynamic Fee AdjustmentIf a trade worsens the peg:Fees for the trader increase dynamically, discouraging destabilizing trades.If a trade helps restore the peg:Fees are reduced, incentivizing stabilizing behavior.Automatic LP ProtectionReducesimpermanent lossfor liquidity providers during volatile depeg events.Ensures pool prices remain closer to the target peg without requiring manual intervention.Seamless DEX IntegrationFully compatible withUniswap V4 hooks, leveragingBEFORE_SWAPandAFTER_SWAPtriggers.Supports multi-asset pools, including stablecoin-stablecoin, liquid staking token pools, and protocol-native token pairs.CustomizableThresholds for depeg sensitivity can be configured.Supports multiple price sources, dynamic fee caps, and hook-specific logic per pool.BenefitsAutomatic Depeg Resolution:Reduces the risk of LP losses due to sudden peg divergence.Trader Incentives Aligned:Encourages actions that stabilize the pool.Seamless Integration:Works natively with Uniswap V4 without major contract rewrites.Dynamic Risk Management:Pool fees adapt in real-time to market conditions.Cross-Asset Compatibility:Works for stablecoins, liquid staking derivatives, and protocol-specific tokens.Use CasesStablecoin Pools:USDC/USDT, DAI/USDC, USDT/DAILiquid Staking Pools:stETH/WETH, rETH/ETHProtocol Asset Pools:kHYPE/HYPE, other project-specific tokensDepeg Protection for Multi-Asset AMMs:Pools vulnerable to market shocks or liquidity withdrawalsWhy It’s InnovativeTraditional AMMs rely on fixed fees or manual risk management.DepegSentinel introduces afeedback loopthat automatically penalizes destabilizing trades and rewards stabilizing trades.It’s thefirst hookthat directly ties trader behavior to peg stability, using reliable on-chain price oracles.
Solution
How It Works (Technical Flow)Trade InitiationTrader submits a swap on the pool.Before Swap Hook (BEFORE_SWAP)DepegSentinel reads the current pool price and market peg fromPyth.Calculates the expected deviation if the trade executes.Fee Computation (_getFee)If trade worsens the peg, fee increases proportionally to deviation.If trade improves the peg, fee is reduced, rewarding stabilizing behavior.Why It’s InnovativeTraditional AMMs rely on fixed fees or manual risk management.DepegSentinel introduces afeedback loopthat automatically penalizes destabilizing trades and rewards stabilizing trades.It’s thefirst hookthat directly ties trader behavior to peg stability, using reliable on-chain price oracles.
Hackathon
ETHGlobal New Delhi
2025
Prizes
- 🏆
Build with Uniswap v4 Hooks3rd place
Uniswap Foundation
Contributors
- 0xNilesh
9 contributions
- sumithprabhu
1 contributions