Mechanics

How Spline Works

Spline liquidity profile provisioned on an Ekubo pool

Spline builds on top of Ekubo to facilitate low slippage swaps between like-like Bitcoin assets on Starknet.

Similar to Bunni v2, depositors to Spline act as passive LPs in our Ekubo extension. The Spline extension automatically adds liquidity in multiple tick range positions to Ekubo on deposit. The aggregate liquidity profile of these range positions is set such that swapping on our Ekubo pools simulates the slippage one would expect from Curve's StableSwap, but for Bitcoin on Starknet.

Profile

Spline adds and removes liquidity from Ekubo according to a liquidity profile function, specified across the full tick range τ\tau. The liquidity profile function used to facilitate like-like swaps follows a Cauchy distribution, supplemented by a constant base layer of full range liquidity

lγ,ρ(τ)=Lπγ[11+(τ/γ)2+11+(ρ/γ)2]l_{\gamma, \rho}(\tau) = \frac{L}{\pi \gamma} \bigg[ \frac{1}{1 + (\tau/\gamma)^2} + \frac{1}{1 + (\rho/\gamma)^2} \bigg]

Parameter constants γ\gamma, ρ\rho describe

  • γ\gamma - Half width of liquidity profile around tick zero, acting like 1 / leverage for the AMM

  • ρ\rho - How quickly the AMM transitions from constant sum like behavior to constant product

LL increases or decreases as LPs add or remove liquidity to the profile, but is constant for swaps (ignoring possible compounding of fees). Liquidity is fungible with shares issued proportional to LL, and weightings between constant base and Cauchy determined by the location in the tick range and profile params.

Plots of price slippage given a fraction of reserves sold into the pool, Δx/x\Delta x / x, for various γ\gamma, ρ\rho combinations versus Uniswap v2 and Curve's StableSwap are shown below

Slippage for the Spline liquidity profiles compared with Uniswap v2, StableSwap. c=LL, g=γ\gamma, and peg=ρ\rho.

Like Curve, swaps near the center of the liquidity profile resemble constant sum, with significant drop off and high slippage transition to constant product as users attempt to swap in a large fraction of the pool's reserves.

Last updated