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.

In an ideal scenario, it would make sense to simply allow 1-to-1 trades for these assets; this would be a Constant Sum curve. In a worst case scenario where one or more of these assets loses their peg and their value diverges, it would make sense to enforce trade rules for uncorrelated assets; this would be a Constant Product curve, such as the one in Weighted Math.

Invariant

Where:

If you are interested in understanding how the trades affect the pool’s price and slippages, please refer to the study here and here.

Last updated