Chai Protocol
Chai DEX
Chai DEX is a one-stop shop for decentralized swapping trading, liquidity providing and farming on Aurora.
Furthermore, Chai DEX employs both dynamic and stable AMM, which is optimized for trading pegged value crypto assets with minimal slippage.

Understanding Automated Market Maker (AMM)

Market makers are essential in an exchange to provide liquidity, control spreads, and maintain slippages. Since cryptocurrency exchanges work 24x7, the need for automated market makers rose. AMMs democratized cryptocurrency trading by doing away with order books and institutional market makers. Instead, AMMs execute trade automatically using algorithms and liquidity pools. Let’s understand a few basic concepts first.
Permissionless: Unlike traditional exchanges, permission-less networks require no permission to join and interact with the blockchain network. Permission-less AMMs allow anyone with an internet connection to become a part of the market to trade.
Liquidity Pools: Instead of an order book, AMMs use liquidity pools to facilitate trade. Liquidity pool, a smart contract, is a fund of tokens (or coins). In AMMs, traders interact with the smart contracts, to enable liquidity and price discovery. Because of the permissionless nature, AMMs allow anyone to provide liquidity to the liquidity pool. The liquidity pool smart contract holds two or more tokens and allows anyone to deposit and withdraw funds from them, but only according to specific mathematical rules.
Liquidity Providers: Liquidity providers contribute assets (cryptocurrency tokens and coins) to liquidity pools. In exchange for providing the tokens, the LPs normally earn a fee. Now, when a trade executes on an AMM, the trade executes against the liquidity pool. This eliminates the need for an order book and for the buyer and seller to be present at that moment in time.
Algorithm: AMMs use an algorithm (mathematical formula) for pricing the assets, thus replacing the order book mechanism. There are variations of the pricing formula deployed currently, which we will cover later.
Yield Farming: Yield farming is an incentive mechanism to put an individual’s cryptocurrency assets to work and generate high returns. Liquidity providers, in yield farming protocols, stake or lock up their assets to earn rewards and higher interests.
Impermanent Loss: Though the AMM model offers better stability and returns, there is a risk of impermanent loss – a temporary loss experienced by liquidity providers because of volatility in the liquidity pool assets. In simple terms, if the liquidity provider had held onto the asset, without providing it as a liquidity to the pool, the individuals would have had more money/value. But impermanent loss is a temporary situation as the AMMs regulate the price closer to market, eventually.

AMM Swap Algorithms

Having understood what AMMs are, let’s now deconstruct them. You can think of an AMM as a friendly and obedient market maker bot, always willing to quote a price, no matter the time of the day or day of the week.
To quote you a price, the bot uses a mathematical formula (used interchangeably with pricing algorithm or swap algorithm) and works relentlessly in the background. The algorithm implemented varies from the simplex to the complex.

Introducing Stable AMM

The innovation into AMMs mathematical formula continued to find a solution to the slippage (constant product formula) and fixed liquidity (constant sum formula) problems. Hybrid mathematical models, combining the best of many models, rose to prominence. One such model is the stable AMM algorithm.
Stable AMM is a hybrid algorithm. The hybrid combines both Constant Product and Constant Sum models, and the following chart shows the algorithm in relation to constant product and constant sum invariants.
  • Constant Sum: When the liquidity pool portfolio is balanced, the algorithm functions as a Constant Sum formula; x + y = k. You can observe the Stable AMM red line staying close to the Constant Sum green line, and the price is stable.
  • Constant Product: As the liquidity pool portfolio becomes imbalanced, the Stable AMM algorithm functions as a Constant Product formula; x * y = k. You can observe the Stable AMM red line now resembling the Constant Product purple line, and the price becoming expensive.

Pegged-value assets

Chai liquidity pools implement the Stable AMM mathematical formula to reduce slippage and keep the market liquid. Saddle facilitates trades of stablecoins, where the price is pegged to an underlying asset, bringing in further stability. For example:
USDT: A stablecoin pegged 1:1 to the USD fiat currency as the underlying asset.
DAI: A stablecoin soft pegged to the USD algorithmically.
FRAX: A fractional-algorithmic stablecoin that is partially backed by collateral and partially stabilized algorithmically.
wBTC: An ERC20 token backed 1:1 by the actual Bitcoin.
alETH: An ERC20 token, but backed 4:1 by ETH.

Dynamic Pegs

The Constant Product formula does not update the price of the tokens in the pool with the market movement. The stable AMM formula motivates swaps around price ratio 1.0, well suited for stablecoins. Dynamic pegs are the next evolution of AMMs.
Dynamic pegs will bring the benefits of Stableswaps to cryptocurrency assets which aren’t pegged to another asset. By using an automatic price change mechanism, the algorithm will move the price based on real-time profit margin calculations, to adjust for slippages. Thus, benefiting both the traders and the AMMs.
Copy link
Understanding Automated Market Maker (AMM)
AMM Swap Algorithms
Introducing Stable AMM
Pegged-value assets
Dynamic Pegs