Technical Documentation
How GRID generates yield through automated delta-managed concentrated liquidity on Solana.
For DeFi Natives
This documentation assumes familiarity with CLMMs, impermanent loss, delta hedging, and perpetual futures. If you're new to these concepts, start with our How It Works page.
System Architecture
GRID operates a two-component system that works in tandem:
LP Engine
Rust-based liquidity management
- β’ Orca Whirlpool concentrated liquidity
- β’ Volatility-based range optimization
- β’ Actor-based concurrent position management
- β’ Automatic volatility regime rebalancing
Hedge Engine
TypeScript delta management
- β’ Drift Protocol perpetual futures
- β’ Real-time delta calculation
- β’ MA-adaptive hedge ratios
- β’ Automatic collateral management
LP Engine: Concentrated Liquidity
Volatility Regime Detection
The LP engine continuously monitors market conditions using Pyth oracle data and classifies volatility into three regimes:
| Regime | Daily Vol | Range Strategy | Capital Allocation |
|---|---|---|---|
| Crab | < 3% | Tight ranges (5-7%) | Aggressive |
| Normal | 3-8% | Balanced ranges (7.5-10%) | Standard |
| Blast | > 8% | Wide ranges (10-15%) | Conservative |
When a regime shift is detected (volatility changes significantly), positions are automatically rebalanced to optimal ranges for the new conditions.
Position Lifecycle
Every liquidity position follows a defined state machine:
NotCreated β Pending β Active β [OutOfRange/Rebalancing] β Active β Closed
β
Error/Paused
Active monitoring includes:
- Range Boundary: Detects when price exits the position's tick boundaries
- Fee Accumulation: Tracks collectable trading fees for harvest decisions
Range Calculation
Position ranges are calculated using realized volatility with EWMA smoothing:
- Fetch historical prices from Pyth oracles (24h lookback, hourly intervals)
- Calculate log returns between consecutive prices
- Apply EWMA smoothing (alpha = 0.2) to reduce noise
- Annualize to daily volatility
- Map to range strategy based on configured multiplier
Strategies:
- Tight (multiplier β€ 3.5): ~5-7% range, high fee capture, frequent rebalancing
- Normal (multiplier 3.5-4.5): ~7.5-10% range, research-optimal D7.5
- Wide (multiplier β₯ 4.5): ~10-15% range, conservative
Hedge Engine: Delta Management
Delta Calculation
Delta exposure is calculated from LP positions in real-time:
LP Delta = Ξ£ (SOL amount in position Γ SOL price)
Net Delta = LP Delta + Drift Position Delta
Target = Net Delta β 0
The hedge engine queries the LP engine via REST API and adjusts Drift perpetual positions to offset exposure.
Hedging Modes
Static Mode:
- Threshold-based triggers (net delta exceeds configured %)
- Hysteresis bands prevent oscillation (enter/exit thresholds)
- Fixed hedge ratio with rate limiting
MA-Adaptive Mode:
- Adjusts hedge ratio based on price position relative to moving average
- Uptrend (price > MA + band): Reduced hedging (let profits run)
- Neutral (within band): Standard hedging
- Downtrend (price < MA - band): Increased hedging (protect capital)
Optional tilts for funding rate and volatility conditions.
Execution Controller
A proportional control system refines trade execution:
- Deadband Filter: Ignores small delta errors (< threshold)
- Cooldown Period: Minimum time between trades
- Funding Penalty: Reduces trading when funding rates are expensive
- Spread Penalty: Scales down in poor liquidity conditions
- Size Limits: Enforces min/max trade sizes
Risk Management Systems
Circuit Breakers
Multiple layers protect against cascading failures:
Balance Actor Circuit Breaker
Tracks consecutive RPC failures. Opens after threshold failures, half-opens for test requests, automatically restarts actor on health check failures.
Hedge Engine Rate Limiting
Maximum hedges per hour, minimum interval between trades, daily operation caps on collateral movements.
Transaction Retry Logic
Exponential backoff on failures, incremental slippage tolerance on TokenMinSubceeded errors, Jito bundle fallback for MEV protection.
Position Safety
- Duplicate Prevention: On-chain state checked before position creation
- Crash Recovery: Orphaned positions detected and recovered on startup
- Registry Sync: Local state periodically synchronized with on-chain reality
- Slippage Protection: Incremental tolerance increases prevent failed transactions
Collateral Management
The hedge engine automatically manages USDC collateral on Drift:
- Target Ratio: Maintains optimal collateral as % of total equity
- Auto Deposit: When ratio falls below minimum threshold
- Auto Withdraw: When ratio exceeds maximum threshold
- Safety Limits: Minimum operation sizes, daily caps, interval limits
Key Metrics
What We Monitor
| Metric | Description | Target |
|---|---|---|
| Net Delta | Combined LP + hedge exposure | ~0 (delta-managed) |
| Fee APR | Trading fees earned annualized | Maximize |
| Hedge Costs | Slippage + funding + fees | Minimize |
| VaR | Value at Risk (95th percentile) | Risk budgets |
| Expected Shortfall | Average loss in worst 5% scenarios | Risk budgets |
Protocol Dependencies
| Protocol | Program ID | Purpose |
|---|---|---|
| Orca Whirlpools | whirLbMi...yCc | Concentrated liquidity positions |
| Drift Protocol | dRiftyH...jKE | Perpetual futures hedging |
| Pyth Network | Pyth oracles | Price feeds & volatility data |