Programmable Risk Management for AMMs — Turning LPing into a Market-Neutral Yield Primitive
What you're about to see:
- A liquidity position becomes directionally exposed
- The system detects risk on-chain in real-time
- A cross-chain automation system triggers a hedge
- A synthetic derivatives engine neutralizes exposure
End Result → LP earns fees WITHOUT taking market direction risk
Liquidity Providers (LPs) in AMMs like Uniswap are:
Implicitly SHORT volatility
When price moves:
- LP inventory becomes imbalanced
- Value < HODL
- This is Impermanent Loss (IL)
Let:
Portfolio Value = x(P) + y(P)LP payoff:
Convexity < 0 → Short Gamma- LPs lose during volatility expansion
- LPing becomes speculation, not yield
DeltaShield transforms LPing into:
Market-Neutral Yield Strategy
Continuously hedge LP exposure:
LP Delta + Hedge Delta ≈ 0So LP earns:
Yield = Swap Fees – Hedge Cost Ethereum (Sepolia)
┌────────────────────────┐
│ AMMHook (Sensor) │
│ • Tracks LP delta │
│ • Emits risk signal │
└──────────┬─────────────┘
│
▼
Reactive Network (Lasna)
┌────────────────────────┐
│ AutomationController │
│ • Decodes event │
│ • Applies logic │
│ • Dispatches hedge │
└──────────┬─────────────┘
│
▼
Unichain (Sepolia)
┌────────────────────────┐
│ HedgeController │
│ • Executes hedge │
│ • Updates position │
└────────────────────────┘Instead of heavy computation:
Δ ≈ L / 2Where:
L = pool liquidity
This enables:
- Constant-time computation
- Gas-efficient execution inside the hook
Traditional systems:
Bots / Keepers → Fragile + CentralizedDeltaShield:
Event → Reactive VM → Execution✔ No polling ✔ No cron jobs ✔ Fully autonomous
- Ethereum → Expensive, state-heavy
- Unichain → Cheap execution layer
Design Principle:
- Compute risk where the state lives
- Execute a hedge where the cost is lowest
- ETH/USDC pool initialized
- LP provides liquidity
ETH ↑ → LP accumulates ETHExposure:
Δ > 0 (long ETH)AMMHook:
delta ≈ liquidity / 2If:
|Δ| > thresholdEmit:
HedgeRequired(poolId, delta, price, timestamp)AutomationController:
-
Decodes event
-
Checks:
- Threshold
- Cooldown
If valid:
Dispatch hedge instruction
HedgeController:
executeHedge(poolId, delta)Mock Engine:
Open SHORT position of size Δ
LP Delta = +Δ
Hedge Delta = -Δ
----------------------
Net Exposure ≈ 0✔ Impermanent loss neutralized ✔ Fees preserved
AMMHook.sol- Exposure tracking
- Event emission
AutomationController.sol- Trigger engine
- Cross-chain dispatcher
HedgeController.sol- Execution receiver
- Position manager
-
MockPerpsEngine.sol -
Tracks:
- Position size
- Direction
- PnL
- Delta computation
- Threshold logic
- Cooldown enforcement
- Event → Reaction → Dispatch
- Full cross-chain simulation
- Gas efficient
- Not perfectly accurate
- Simpler MVP
- Less optimal in high volatility
- Deterministic demo
- Not real market execution
Adjust the hedge dynamically with curvature
- GMX
- Synthetix
- Hyperliquid
LP + Auto Hedging + Auto CompoundingDeltaShield introduces a new primitive:
"Self-Hedging Liquidity"This enables:
- Institutional LP participation
- Predictable yield strategies
- Reduced systemic risk in AMMs
git clone https://github.com/Meharab/Delta.Shield-Hedged_Liquidity_Primitive.git
cd Delta.Shield-Hedged_Liquidity_Primitive
forge buildforge test- AMMs solved trading liquidity.
- DeltaShield solves liquidity risk.
From Passive LPing → Active Risk-Managed Yield
╭----------------------------------------+------------------+------------------+----------------+-----------------╮
| File | % Lines | % Statements | % Branches | % Funcs |
+=================================================================================================================+
| script/AMMHook.s.sol | 0.00% (0/11) | 0.00% (0/11) | 0.00% (0/2) | 0.00% (0/2) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/AutomationController.s.sol | 0.00% (0/5) | 0.00% (0/4) | 100.00% (0/0) | 0.00% (0/2) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/HedgeController.s.sol | 0.00% (0/14) | 0.00% (0/19) | 100.00% (0/0) | 0.00% (0/2) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/MockPerpsEngine.s.sol | 0.00% (0/5) | 0.00% (0/4) | 100.00% (0/0) | 0.00% (0/2) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/testnet/DeployAll.s.sol | 0.00% (0/28) | 0.00% (0/39) | 100.00% (0/0) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/testnet/EdgeCaseScenarios.s.sol | 0.00% (0/20) | 0.00% (0/22) | 100.00% (0/0) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/testnet/MockTriggerFlow.s.sol | 0.00% (0/13) | 0.00% (0/17) | 100.00% (0/0) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/testnet/SetupSystem.s.sol | 0.00% (0/15) | 0.00% (0/21) | 0.00% (0/2) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/testnet/TriggerHedgeFlow.s.sol | 0.00% (0/21) | 0.00% (0/25) | 100.00% (0/0) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| script/testnet/VerifyEndToEnd.s.sol | 0.00% (0/14) | 0.00% (0/19) | 0.00% (0/6) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| src/AMMHook.sol | 98.08% (51/52) | 96.88% (62/64) | 66.67% (4/6) | 100.00% (8/8) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| src/AggregatorV3.sol | 0.00% (0/9) | 0.00% (0/8) | 100.00% (0/0) | 0.00% (0/3) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| src/AutomationController.sol | 96.67% (29/30) | 96.88% (31/32) | 75.00% (3/4) | 100.00% (6/6) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| src/HedgeController.sol | 80.70% (46/57) | 76.92% (50/65) | 71.43% (10/14) | 81.82% (9/11) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| src/MockEventGenerator.sol | 0.00% (0/2) | 0.00% (0/1) | 100.00% (0/0) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| src/MockPerpsEngine.sol | 98.28% (57/58) | 91.04% (61/67) | 57.14% (8/14) | 100.00% (10/10) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| test/AutomationController.t.sol | 0.00% (0/2) | 0.00% (0/1) | 100.00% (0/0) | 0.00% (0/1) |
|----------------------------------------+------------------+------------------+----------------+-----------------|
| Total | 51.40% (183/356) | 48.69% (204/419) | 52.08% (25/48) | 61.11% (33/54) |
╰----------------------------------------+------------------+------------------+----------------+-----------------╯