myco-bonding-curve/docs/03-concentrated-lp.md

2.5 KiB
Raw Permalink Blame History

03: Concentrated Liquidity Pool (2-CLP)

Source

  • Protocol: Gyroscope
  • Files: Gyro2CLPMath.sol, math_implementation.py
  • Repos: gyrostable/concentrated-lps, gyrostable/gyro-pools, balancer/balancer-v3-monorepo

Rationale for MYCO

The 2-CLP introduces virtual reserves — the key concept that enables price bounding. Instead of liquidity spread across all prices (0, ∞), it concentrates within [α, β]. This is the stepping stone to the E-CLP ellipse.

For MYCO:

  1. Concentrating liquidity near target price ratios means less capital required for deep liquidity
  2. Price bounds prevent the bonding curve from pricing reserves at absurd ratios
  3. The quadratic invariant (analytically solvable) is simpler than Uniswap V3's tick-based approach
  4. Forms the conceptual bridge between standard CPMM (weighted product) and the elliptical surface

Invariant

L^2 = (x + L/\sqrt{\beta}) \cdot (y + L \cdot \sqrt{\alpha})

Rearranged as a quadratic in L:

\left(1 - \frac{\sqrt{\alpha}}{\sqrt{\beta}}\right) L^2 - \left(\frac{y}{\sqrt{\beta}} + x \cdot \sqrt{\alpha}\right) L - x \cdot y = 0

Solved via Bhaskara's formula (standard quadratic, always positive discriminant).

Virtual offsets:

  • a = L / \sqrt{\beta} — added to x
  • b = L \cdot \sqrt{\alpha} — added to y

On virtual reserves, it's standard CPMM: (x+a)(y+b) = L^2

Swap Math

Standard constant product on virtual reserves:

\Delta y = \frac{(y + b) \cdot \Delta x}{(x + a) + \Delta x}

Parameters

Parameter Range Effect
\alpha (0, 1) Lower price bound. Pool holds only x below this price
\beta (1, ∞) Upper price bound. Pool holds only y above this price

Concentration is controlled by the width of the range β/α. Narrower = more concentrated = deeper liquidity near the peg, but less range.

Properties

  • Analytically solvable: No iterative solver needed (unlike StableSwap)
  • Price bounded: Spot price always in [α, β]
  • Capital efficient: All liquidity used within the active range
  • Degenerates to CPMM: When α → 0 and β → ∞, virtual offsets vanish

MYCO Application

If MYCO launches with a primary reserve pair (e.g., USDC + ETH), the 2-CLP provides concentrated pricing near the expected ratio. This is simpler than the full elliptical or N-D surface and may be sufficient for early-stage 2-asset reserves.

Implementation

See src/primitives/concentrated_2clp.py