Overview

StableSwap is tailored for stable assets and similarly valued assets, deviating from the traditional AMM model by using an improved low-curvature function. This allows users to exchange assets with minimal slippage, greatly enhancing capital efficiency and trading speed, and maintaining stable exchange rates even under high trading volumes.

Improved Math Model:

  • Adjustment to Traditional AMM Formula: Unlike traditional AMM models, StableSwap utilizes an adjusted constant formula that modifies the typical x*y=k curve. This modification makes the curve flatter when the asset values are close and steeper when the asset values differ significantly. This helps maintain transaction stability and efficient use of funds under various market conditions.

  • Dynamic Balance of Constant D: The algorithm maintains a dynamically balanced constant D, which represents the total value of all assets in the pool. This ensures that transaction prices remain relatively stable, even under high trading demand.

Dynamic Slippage Control:

  • Focus on Reducing Slippage: StableSwap emphasizes minimizing slippage by dynamically adjusting the proportions of the asset pool in response to market fluctuations and large transactions, thereby protecting the interests of both parties involved in the trade.

  • State Calculation of Asset Pool: The algorithm calculates the state of the asset pool before and after each transaction to ensure that transactions are executed at prices close to market rates. In high volatility environments, the algorithm adjusts the D value and asset ratios to mitigate market shocks and maintain relative price stability.

Fundamental Formula

Calculation of Invariant D

where xi represents the quantity of the ith asset in the pool. This formula is used to calculate and maintain the total value D before and after transactions, ensuring that the total value of funds does not change due to trading.

Non-linear Price Function

A non-linear price function is used to adjust asset prices based on the differences in asset values. The shape of the curve is smoothed when asset values are close and made steeper when they differ significantly:

Here, x represents the quantity of an asset involved in a transaction, and D is the aforementioned constant. This function helps reduce price volatility when asset values are close, maintaining the stability of transactions.

Slippage Calculation

Minimizing Slippage: The StableSwap algorithm finely adjusts the proportions of assets within the pool to minimize slippage, especially during large transactions.

Last updated