Uniswap v4 Hook · Reactive Network · UHI9

Autonomous LP
Delta-Hedging Engine

A Uniswap v4 hook that autonomously hedges impermanent loss for concentrated LPs — self-funded from swap fees, zero manual intervention required.

10%
Default Fee Allocation
5×
Default Leverage
50
Tick Volatility Threshold
0
Manual Steps Required
How It Works

Five steps. Fully autonomous.

From a retail swap to a cross-chain hedge position — all handled without LP intervention.

01
🔄
Retail Swap Occurs
A trader executes a large swap pushing the price tick outside the LP's concentrated range.
02
🪝
afterSwap() Fires
The hook intercepts the lifecycle callback and routes a fee fraction into the on-chain Collateral Vault.
03
⚡
RSC Monitors Ticks
DeltaShieldRSC on Reactive Network calculates tick deviation in real-time against the 50-tick threshold.
04
📉
Hedge Triggered
Threshold exceeded → RSC emits cross-chain Callback → hook opens a leveraged short/long on the perp DEX.
05
♻️
Position Closed & Reinvested
When price stabilises, the RSC triggers closeHedge(). Payout returns to the vault and compounds the LP's shield.
Dashboard

Live Hook Metrics

Connect your wallet to interact with the deployed hook. Metrics below use simulated data for demo — connect to a live deployment for real state.

Connect your wallet to view live data

Use the Connect Wallet button in the top-right corner

Architecture

Multi-layer protocol design

Two contracts across two execution environments, coordinated by Reactive Network's cross-chain messaging layer.

Execution Flow — Reactive Delta-Shield
🧑‍💻
Trader
Executes swap
EOA
→
🏊
Uniswap v4 Pool
Emits Swap events
v4 Core
→
🛡️
Delta-Shield Hook
Fee allocation + hedge
Hook
→
⚡
DeltaShield RSC
Reactive Network oracle
RSC
→
📊
Perp DEX
GMX / Synthetix margin
DeFi
FeeAccumulated(poolId, amount)
Emitted every swap. Tracks running collateral balance per pool.
Callback(chainId, target, gasLimit, payload)
Emitted by RSC on Reactive Network. Carries executeHedge or closeHedge call data.
HedgeOpened(poolId, positionId, isShort, margin)
Confirms leveraged position was opened on the perp DEX.
HedgeClosed(poolId, positionId, payout)
Position closed. Payout returns to hedgeCollateral for reinvestment.
Smart Contracts

Two contracts. One system.

The hook lives on your target chain. The RSC lives on Reactive Network. They coordinate without any trusted relayer.

🛡️
ReactiveDeltaShieldHook
src/ReactiveDeltaShieldHook.sol

The Uniswap v4 Hook contract. Inherits BaseHook and listens to afterSwap. Manages the collateral vault, receives callbacks from the Reactive VM, and interfaces with the perpetual DEX.

fn
_afterSwap()
Allocates hedgeFeeFraction of every swap into the collateral vault. Emits FeeAccumulated.
internal
fn
executeHedge(poolId, asset, isShort)
Called by Reactive VM. Opens a leveraged position on the perp DEX using accumulated collateral.
RSC only
fn
closeHedge(poolId)
Called by Reactive VM when price stabilises. Closes position and returns payout to the vault.
RSC only
fn
setHedgeFeeFraction(fraction)
Owner-only. Adjusts basis-point fee allocation (max 100 000 = 100%).
owner
fn
setLeverage(leverage)
Owner-only. Sets leverage for perp positions. Range: 1×–100×.
owner
fn
setPaused(bool)
Owner-only. Immediately halts fee accumulation and blocks new hedge triggers.
owner
⚡
DeltaShieldRSC
src/DeltaShieldRSC.sol

The Reactive Smart Contract deployed on Reactive Network. Subscribes to Uniswap v4 Swap event logs on the source chain, decodes tick data, and emits Callback events targeting the hook.

fn
react(LogRecord log)
Entry point called by Reactive VM for every subscribed Swap event. Computes tick drift and emits the appropriate callback.
vm only
const
SWAP_EVENT_TOPIC
keccak256('Swap(bytes32,address,int128,int128,uint160,uint128,int24,uint24)') — the v4 Swap signature used as subscription filter.
immutable
const
VOLATILITY_THRESHOLD = 50
Minimum tick deviation to open a hedge. Below this threshold, a closeHedge callback is emitted instead.
immutable
ev
Callback(chainId, target, gasLimit, payload)
Cross-chain message targeting the hook. Payload is ABI-encoded executeHedge or closeHedge calldata.
event