Stable Math

Overview

Stable Math is designed to allow for swaps between any assets that have the same price, or are "pegged" to the same asset. The most common examples are stablecoins that track US Dollars (DAI, USDT, USDC), and assets that track the price of Bitcoin (WBTC, renBTC, sBTC). Prices are determined by the pool balances, the amplification parameter, and amounts of the tokens that are being swapped.

Invariant

Since the Stable Math equation is quite complex, determining the invariant, DD, is typically done iteratively.

Annxi+D=ADnn+Dn+1nnxiA\centerdot n^n \centerdot∑x_i+D=A \centerdot D \centerdot n^n+\cfrac{D^n+1}{n^n\centerdot\prod x_i}

Where:

  • nn is the number of tokens

  • xix_i is balance of token

  • AA is the amplification parameter

Learn more

Last updated