GIP-2: Auto-Liquidity Engine
| Field | Value |
|---|---|
| GIP | 2 |
| Title | Auto-Liquidity Engine |
| Status | Draft |
| Category | Core |
| Author | GX Core Team |
Summary
GIP-2 introduces the Auto-Liquidity Engine, an on-chain market-making system that provides continuous liquidity for all GX-native token markets. The engine maintains a 0.3% bid-ask spread and updates quotes every 3 seconds, ensuring deep orderbook liquidity from day one.
Motivation
New perpetual markets often suffer from thin orderbooks and wide spreads, discouraging traders and creating poor execution quality. The Auto-Liquidity Engine solves this by programmatically providing two-sided liquidity at tight spreads, bootstrapping market depth until organic market makers arrive.
Specification
Core Parameters
| Parameter | Value |
|---|---|
| Default Spread | 0.3% (15 bps per side) |
| Quote Update Interval | Every 3 seconds |
| Quote Depth | 5 price levels per side |
| Max Position | 10% of market’s insurance fund |
| Reference Price | Volume-weighted mid-price from oracle + orderbook |
| Rebalance Trigger | Net exposure exceeds 60% of max position |
Pricing Model
The Auto-Liquidity Engine computes quotes using the following logic:
mid_price = weighted_average(oracle_price * 0.7, orderbook_mid * 0.3)
bid_price = mid_price * (1 - spread / 2)
ask_price = mid_price * (1 + spread / 2)
// Inventory skew adjustment
if net_long > threshold:
bid_price -= skew_penalty
ask_price -= skew_penalty
if net_short > threshold:
bid_price += skew_penalty
ask_price += skew_penaltySpread Adjustment
The 0.3% default spread adjusts dynamically based on market conditions:
| Condition | Spread Adjustment |
|---|---|
| High volatility (ATR > 2x average) | Widen to 0.6% |
| Low volatility (ATR < 0.5x average) | Tighten to 0.15% |
| Low inventory risk | Tighten by 0.05% |
| High inventory risk | Widen by 0.1% |
| Oracle price stale (>30s) | Widen to 1.0% or pause |
Quote Lifecycle
- Every 3 seconds, the engine cancels all existing quotes
- Fetches current oracle price and orderbook state
- Computes new bid/ask prices with inventory adjustment
- Places 5 levels of limit orders on each side
- Orders are marked as
PostOnlyto avoid crossing the book
Revenue and Risk
- The Auto-Liquidity Engine earns the bid-ask spread on every fill
- Net PnL accrues to the protocol treasury
- Losses are backstopped by the market’s insurance fund
- Circuit breaker pauses quoting if cumulative loss exceeds 2% of insurance fund in a 24-hour period
Rationale
A 0.3% spread with 3-second updates represents a balance between execution quality for traders and profitability for the protocol. The spread is competitive with major centralized exchanges for mid-cap perpetual markets. The 3-second update cycle prevents excessive order cancellation load while maintaining price freshness.
Security Considerations
- Oracle manipulation could cause the engine to quote at incorrect prices. Multi-source oracle aggregation and staleness checks mitigate this risk.
- The inventory skew adjustment prevents the engine from accumulating dangerous directional exposure.
- The circuit breaker ensures that sustained adverse conditions do not drain the insurance fund.