Search projects, hackathons, sponsors and tech

    ← All projects

    LVR Shielded LP

    Uniswap v4 Hook+Vault that auto-adjusts LP ranges to cut LVR — Unichain Sepolia demo.

    Demo

    About

    LVR Shielded LP is a Uniswap v4 Hook + Vault that reacts to market conditions and protects LPs against loss-versus-rebalancing (LVR). The Hook maintains a simple, explainable mode machine: NORMAL – concentrate around the current price WIDENED – spread liquidity when volatility rises RISK_OFF – pull to a wide, defensive placement during shocks Guards enforce freshness, hysteresis (lower exit than entry), a dwell window with confirmations, and a min flip interval to avoid thrash. Placement snaps to tick spacing and records “home” placements for quick recentering. The demo is fully judge-reproducible on Unichain Sepolia with Windows-friendly scripts and a local subgraph that indexes on-chain telemetry (ModeApplied, Signal). You can trigger mode flips, then verify both on-chain logs and GraphQL results in minutes. Live demo refs (Unichain Sepolia): Vault: 0x84a4871295867f587B15EAFF82e80eA2EbA79a6C Hook: 0x20c519Cca0360468C0eCd7A74bEc12b9895C44c0 PoolId (USDC/WETH demo): 0x…457f Quickstart: repo README

    How it's made

    Solidity 0.8.26 with Foundry (forge/cast). Uniswap v4 BaseHook pattern with address-encoded permission bits; explicit overrides for v4 hook points; tick math via official libs; immutable caching for gas. Mode machine + guards: freshness/stale, hysteresis, dwell+confirmations, minFlipInterval; placement engine computes centerTick/halfWidthTicks and snaps to tickSpacing. Events for end-to-end observability: Signal, ModeChanged (optional), HomeRecorded, and Vault-level ModeApplied. E2E scripts (Git Bash safe) use cast with ≤500-block chunking (Alchemy limit), pending nonce + small gas bump to avoid “already known/nonce too low”. Local subgraph (Docker Compose): indexes Hook & Vault events; one-click build/deploy; GraphQL queries included in the README. Built to be extensible: parameters (widenBps, riskOffBps, exitThresholdBps, dwellSec, confirmations, minFlipInterval, etc.) are admin-tunable with tests for revert-on-non-admin.