Improvement Proposals (GIPs)GIP-2: Auto-Liquidity

GIP-2: Auto-Liquidity Engine

FieldValue
GIP2
TitleAuto-Liquidity Engine
StatusDraft
CategoryCore
AuthorGX 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

ParameterValue
Default Spread0.3% (15 bps per side)
Quote Update IntervalEvery 3 seconds
Quote Depth5 price levels per side
Max Position10% of market’s insurance fund
Reference PriceVolume-weighted mid-price from oracle + orderbook
Rebalance TriggerNet 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_penalty

Spread Adjustment

The 0.3% default spread adjusts dynamically based on market conditions:

ConditionSpread Adjustment
High volatility (ATR > 2x average)Widen to 0.6%
Low volatility (ATR < 0.5x average)Tighten to 0.15%
Low inventory riskTighten by 0.05%
High inventory riskWiden by 0.1%
Oracle price stale (>30s)Widen to 1.0% or pause

Quote Lifecycle

  1. Every 3 seconds, the engine cancels all existing quotes
  2. Fetches current oracle price and orderbook state
  3. Computes new bid/ask prices with inventory adjustment
  4. Places 5 levels of limit orders on each side
  5. Orders are marked as PostOnly to 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.