defi/derivatives-stablecoin-patterns

Derivatives & Stablecoin Design Patterns

ethereumdefi-guide👥 Communityconfidence highhealth 100%
v1.0.0·Updated 3/26/2026

Distilled from DeFiLlama data covering derivatives protocols ($2.39B TVL: Jupiter $877M, Hyperliquid HLP $433M, Drift $323M, GMX V2 $261M, dYdX $125M) and stablecoin categories (CDPs $9.2B TVL: Sky/MakerDAO $7.3B, Liquity $166M; Algo stables: Frax $63M; dual-token: MoneyOnChain $40M).


Perpetual Futures Design Patterns

Perpetual futures are the highest-volume DeFi derivatives: no expiry, funded continuously to stay near the underlying index.

1. Funding Rate Mechanism

Funding rates are the core mechanism that keeps perpetual mark price ≈ index price:

fundingRate = (markPrice - indexPrice) / indexPrice * fundingFactor

Payment direction:

  • markPrice > indexPrice (longs paying premium): longs pay shorts
  • markPrice < indexPrice: shorts pay longs

Typical parameters:

  • Funding interval: every 1 or 8 hours
  • Funding factor: 0.01–0.05% per hour (annualizes to 88–438%)
  • Clamped: max(-0.05%, min(0.05%, fundingRate)) to prevent runaway funding

Implementation pitfall: If the funding rate is calculated using an on-chain price (spot AMM) rather than a robust index, it is manipulable. Use aggregated off-chain index prices or a TWAP.

2. AMM-Based Perpetuals (GMX V2 Model)

GMX uses a Global Liquidity Pool (GLP) as the counterparty to all traders:

Position PnL = (currentPrice - entryPrice) * positionSize * leverage
Trader profit = GLP loss; Trader loss = GLP gain

Key components:

  • Oracle-priced: Uses Chainlink + GMX oracle, not pool spot price → no sandwich attacks
  • Borrow fees: Positions pay hourly fees for holding open positions (borrowFactor * openInterest / poolSize)
  • Price impact: Large orders have price impact to prevent GLP from being adversely selected

Design risk — GLP insolvency: If traders are net profitable over a period (e.g., directional market), GLP holders lose. GMX V2 mitigates with asymmetric fees (discount for trades in market-balancing direction).

3. Orderbook-Based Perpetuals (dYdX / Hyperliquid)

Orderbook perps match buyers and sellers directly, with a central risk engine managing margin:

maintenanceMargin = positionSize * maintenanceMarginFraction
if accountEquity < maintenanceMargin: → liquidation

Liquidation mechanics:

  1. Position is liquidated to insurance fund at mark price
  2. If insurance fund insufficient → auto-deleveraging (ADL): profitable counter-positions are force-closed

Design differences from AMM perps:

  • No impermanent loss for liquidity providers (they earn spread, not directional risk)
  • Requires centralized sequencer for order matching (dYdX V4 decentralized this)
  • Capital efficiency higher: cross-margin netting

4. Virtual AMM (vAMM) Perpetuals (Drift / dYdX V1)

vAMMs use the constant product formula to determine prices without holding real assets:

x * y = k (virtual reserves)
markPrice = x / y

Problem with vAMMs: Virtual reserves diverge from real market prices over time, requiring frequent parameter recalibration. Drift migrated to DLOB (Decentralized Limit Order Book) + JIT (Just-In-Time) liquidity to fix this.

Key lesson: vAMMs are a stepping stone design, not a long-term solution for perpetual DEXs.

5. Position Sizing & Risk Parameters

Standard risk tiers across major perp protocols:

AssetMax LeverageInitial MarginMaintenance Margin
BTC/ETH20–50×2–5%1–2.5%
Mid-cap alts10–20×5–10%2.5–5%
Low-liquidity3–5×20–33%10–20%

Options Protocol Design Patterns

6. On-Chain Options Pricing

Traditional Black-Scholes pricing requires continuous-time math that is expensive on-chain. DeFi options use approximations:

Bonding curve pricing (Hegic-style):

premium = impliedVolatility * sqrt(timeToExpiry) * optionSize * priceAdjustmentFactor

Pool-based IV: The AMM's option prices imply a volatility; arbitrageurs enforce that this IV converges to market consensus.

Common pitfall: Options priced purely from a thinly traded on-chain pool will have systematically wrong IV. Protocols that don't recalibrate IV from off-chain market data will be arbitraged continuously.

7. Options Settlement

Cash settlement: Settles in stablecoin based on price difference. No physical token delivery needed.

function exercise(uint256 optionId) external {
    Option storage opt = options[optionId];
    require(block.timestamp >= opt.expiry, "not expired");
    int256 pnl = int256(oracle.getPrice()) - int256(opt.strikePrice);
    if (pnl > 0) token.transfer(opt.owner, uint256(pnl) * opt.size / 1e18);
}

Physical settlement: Transfer the underlying token. More gas-intensive, exposes protocol to delivery risk.


Stablecoin Design Patterns

8. CDP (Collateralized Debt Position) Mechanics

The MakerDAO/DAI model is the reference implementation:

Minting:

maxDebt = collateralValue * (1 / minimumCollateralRatio)
debt = userDefinedAmount <= maxDebt

Typical parameters (DAI ETH vault):

  • Minimum collateral ratio: 150% (borrow $100 DAI → need $150 ETH)
  • Liquidation ratio: 145% (liquidated if ratio drops below)
  • Liquidation penalty: 13% (loses 13% of collateral to liquidators)
  • Stability fee (interest): currently 5–15% APR

CDP design decision: stability fee vs DSR: The Dai Savings Rate (DSR) lets MakerDAO "pay" DAI holders interest to remove supply from circulation when supply exceeds demand. The stability fee must exceed the DSR to be sustainable.

9. Liquidation Auction Mechanisms

MakerDAO uses Dutch auctions for liquidations:

price(t) = startPrice * (1 - declineRate)^t

Price starts high and declines over time. Liquidators participate when price reaches their target discount.

Advantage: Maximizes recovery value vs instant liquidation. Risk: In fast market crashes, Dutch auctions may not complete before price falls further ("price could decline faster than auction").

Liquity's approach (Stability Pool): Pre-deposited DAI-equivalent (LUSD) in stability pool absorbs liquidations immediately at oracle price. No auction required — simple, fast, eliminates auction risk.

10. Death Spiral Prevention

The critical failure mode for CDP stablecoins is a death spiral:

  1. Collateral price drops → some CDPs undercollateralized
  2. Liquidations sell collateral → further price drop
  3. More liquidations → more selling → repeat

MakerDAO mitigations:

  • Emergency Shutdown (nuclear option): freeze all CDPs at current oracle price, allow proportional redemption
  • Multiple collateral types: diversification prevents single-asset cascade
  • Global Debt Ceiling: hard cap on total DAI minted per collateral type

Liquity's design: 110% minimum collateral ratio (lower than MakerDAO's 150%) reduces liquidation impact because the collateral surplus per liquidation is smaller. Recovery Mode activates below system-wide 150% CR.

11. Algorithmic Stablecoins

The spectrum from fully-collateralized to purely algorithmic:

TypeExampleMechanismRisk
100% collateralUSDCEach token backed by $1 fiatCustodian/regulatory risk
CDP overcollateralizedDAI/LUSD150%+ crypto collateralLiquidation cascade
Fractional reserveFraxMixed: ~80% collateral + FRAX governanceBank run risk
AlgorithmicUST (Terra)Algorithmic expansion/contraction via LUNADeath spiral (collapsed 2022)

Key lesson from UST collapse:

  • Pure algorithmic stablecoins rely on continuous confidence in the governance token
  • If the governance token falls in value, the stablecoin loses its backing
  • This creates reflexive instability: fear → governance token sell → stablecoin depeg → more fear
  • No purely algorithmic stablecoin has survived a major bear market

12. Dual-Token Stablecoin (MoneyOnChain / fx Protocol)

Two-token system: stablecoin (stable) + risk-absorbing token (receives upside/downside of collateral):

stablecoinValue = fixed ($1)
riskTokenValue = (totalCollateral - stablecoinsOutstanding) / riskTokenSupply

Stability mechanics: When collateral drops in value, the risk token absorbs losses first. Stablecoin holders are protected until totalCollateral < stablecoinsOutstanding.

Design constraint: If collateral ratio drops too low (e.g., below 110%), emergency mechanisms (forced liquidations, new collateral requirements) must activate before the stablecoin loses its peg.


Cross-Pattern Risks

Derivatives + Stablecoin Interaction

Using a protocol's own stablecoin as collateral for perp positions creates reflexive risk:

  • Perp positions lose → stablecoin collateral sold → stablecoin price drops → more positions liquidated
  • Designed carefully, this can be stable (dYdX uses USDC); designed poorly, it amplifies volatility.

Yield-Bearing Stablecoins (Ethena USDe)

Delta-neutral: hold ETH spot long + short ETH perp. Yield = funding rate on short position.

Risk: When funding rates go negative (bear market), the stablecoin generates negative yield. Ethena mitigates with an insurance fund; other implementations without reserves are at risk.

Design Checklist

  • Perps: Is funding rate calculated from robust index, not manipulable spot price?
  • GMX-style GLP: Is there a price impact mechanism to prevent adverse selection?
  • CDP: Is liquidation ratio above 100% with sufficient buffer for oracle latency?
  • CDP: Is there a global debt ceiling per collateral type?
  • Algorithmic stablecoin: Is there full collateral backing or a credible recovery mechanism?
  • Dual-token: Does the risk token have sufficient supply to absorb realistic collateral drops?
  • Options: Is IV recalibrated from external market data, not solely from on-chain prices?
  • Yield-bearing stablecoin: Is negative yield scenario handled with an insurance reserve?