World of DeFi: AMMs: Types of AMMs

Learn about AMMs and different AMM Models including CFMMs, CSMMs, CMMMs and various types of Hybrids AMMs with GooseFX - Your Solana DeFi destination!

World of DeFi: AMMs: Types of AMMs
World of DeFi: AMMs | GooseFX

Table of Content

Introduction to AMMs

Previously in this series, we covered what AMMs are, how they differ from traditional MMs, and their pros and cons. In this blog, we shall discuss the different types of AMMs and the new models that AMM protocols have developed over time.

Firstly, we’ll be going over the first generation of AMM Models, how they differed, and their disadvantages.

Market Makers help provide liquidity across various price points on exchanges. In traditional order book exchanges, this is done by setting various limit orders across different price points

Constant Function Market Makers or CFMMs

Constant Function Market Makers, or CFMMs for short, are the first generation AMMs which run on the principle that any proposed trade is accepted only if the value of function before the trade takes place and after it takes place is the same or constant. This simple condition is what gives CFMMs their name. AMM protocols utilizing this model with the function x*y=k are Uniswap, Bancor, and Sushiswap, which states that the product or multiplication of the reserves in the liquidity pool should remain unchanged.

Now that we know what CFMMs are, let’s take a look into the three different types of CFMMs that we currently have:

Constant Product Market Makers or CPMMs

As seen above, CPMMs rely on the principle that the product of the reserves remains unchanged before and after the trade has taken place. It was the first type of CFMM that appeared and was popularized by Bancor.

CPMMs are based on the simplified function x*y=k, thus pricing the asset based on the liquidity present in the pool. When the number of X tokens(x) increases, the number of Y tokens(y) should decrease to keep their product constant and vice-versa. The original equation for CPMM is:

Original Equation for CPMM Models

where R represents the reserves of each asset and γ is the transaction fee.

The AMM curve of this model is a hyperbola that has a tangent parallel to the axis on ends implying that there will always be liquidity as the price approaches zero.

Graph for the equation of the CPMM Model; A Hyperbola (Source: Dmitriy Benezon)

Constant Sum Market Makers or CSMMs

The second model that we will look at is Constant Sum Market Makers or CSMM. As the name suggests, Such models have their function defined as a sum rather than a product and follow the simplified formula x+y=k. The original equation of CSMM is:

Original Equation for CSMM Models

where R represents the reserves of the i-th token in the pool.

It is ideally used for zero-price impact trades; however, it doesn't provide infinite liquidity. If you plot the AMM curve of such a function, it would be a straight line, as shown below:

Graph for the equation of the CSMM Model; A straight line

In real life, any arbitrageur would drain one of the assets or reserves in the pool, given that the ratio of the reference price between the tokens is not 1. A situation like this would destroy the liquidity pool, leaving it with only one asset while completely draining out the second one, leaving no liquidity for the traders.

Thus, it is an unfit strategy for any AMMs and is rarely used by any of them.

An arbitrageur is a type of trader that profits off of the price discrepancies across exchanges, keeping the price differences across various exchanges as close as possible and ideally at 0.

Constant Mean Market Maker or CMMMs

The third and final model under CFMMs is Constant Mean Market Maker or CMMM. It is slightly different from the first two CFMMs we saw as it is a generalization of the Constant Product Market Maker, which can have more than two tokens and doesn’t have a 50/50 weight distribution in the pool.

In this model, the simplified equation is a geometric mean equal to a constant, i.e., for a liquidity pool with three assets, the equation would be (x*y*z)^(⅓) = K. The original equation however is of the form:

Original Equation for CMMM Models

where Ri is the reserves of the i-th token in the pool and w is the weight of each asset in the pool.

The AMM curve for a liquidity pool with three assets would look like such:

Graph for the equation of the CMMM Model; A 3-D curve (Source: Balancer Whitepaper)

It was first formulated and introduced by the AMM protocol Balancer. It allowed for exposure to multiple assets in the pool simultaneously and allowed us to swap between any two assets in the pool.

Cons of the First-Generation models

Now that we've covered the first generation AMMs, it's time to talk about the problems of those models. Many of these models have two significant drawbacks; Impermanent Loss and Capital Efficiency or Slippages.

As we discussed in the last blog, Impermanent Losses or IL is the difference in value between providing liquidity in AMMs relative to just holding those assets in your wallet over time. It happens due to prices diverging in any direction from the prices where you provided the liquidity. If you see below, for the ETH-DAI pair on Uniswap, the AMM curve is "Concave," implying that liquidity providers or LPs make money only in a short range or portion of price movement.

ETH+DAI Uniswap 50/50 pool's returns compared to HODL against ETH prices

In ideal cases, we should see a convex AMM curve, i.e., you have more upside if there are heavy fluctuations or divergence in prices.

Convex shaped graph (Source: Google Images)

The second problem of these traditional Automated Market Makers is capital efficiency and slippage.

Slippage is the price impact or movement of any entity buying or selling its tokens. Traditional AMMs are created such that most of the liquidity is never used as it is available at the extremities of the equation curves. It makes it difficult for people to execute a large trade on DEXs operating on these traditional models.

Another point to note is that the trader depositing assets in an AMM has no control over which price points they can provide liquidity compared to MMs on order-book exchanges, leading to lower capital efficiency.

Hybrid AMMs

The above problems are being tackled by projects building their own AMM models, such as Hybrid CFMMs, dAMMs, vAMMs, PMMs, CLMMs, etc., to name a few. In this section, we shall review the mentioned models and how they differ from the traditional AMMs.

Hybrid CFMMs

Hybrid CFMMs combine multiple traditional AMM functions and specific parameters to evolve into a better AMM model. These AMM Models can help reduce risk exposure to LPs during price divergences or reduce the price impact or slippage of larger trades.

One such AMM protocol utilizing the hybrid CFMM model is Curve which combines the CPMM and CSMM models using a complex formula to help reduce the price impact or the slippage of trades. The resulting AMM curve of this complex formula plots a hyperbola that returns a linear constant for the middle portion of the inner price range and an exponential constant at the extremities or prices outside the range.

Curve AMM Model vs Uniswap AMM Model (Source: Curve Whitepaper)

Initially Curve was only allowing stablecoin swaps hence this was predominantly designed for pairs whose prices have a ratio of 1(Refer the disadvantages of CSMM)

However, Curve has recently launched more volatile pairs using a similar liquidity model.

Virtual Automated Market Makers or vAMMs

Virtual Automated Market Makers, or vAMMs for short created by the AMM protocol Perpetual Protocol, allows for perpetual trading on DEXs.

A perpetual contract is a derivative of an underlying asset similar to any futures contract but without any expiration date and can exist for infinity.

Returning to vAMMs, it uses the same CPMM model of x*y=K, but traders submit their liquidity into a smart contract instead of a liquidity pool. The creator, i.e., the perpetual protocol team creates a vAMM for any pair and sets a constant K for it, which they can change over time manually or algorithmically; however, they can not remove any liquidity from the vault. This allowance of changing the constant K over time helps to help reduce slippage and keep it to a value that is beneficial for the arbitrageurs as well; otherwise, the prices of the perpetual contracts would start diverging from the spot market prices.

You can read the detailed explanation here.

Dynamic Automated Market Makers or dAMMs

dAMMs are those AMMs with multiple dynamic or moving parameters, which helps create a better AMM that adapts to varying market conditions. There are primarily two dynamic AMMs that are discussed. The first one talks about how we can use the price feed from an oracle to modify the mathematical equation used in the model. It helps in reflecting the pool price equal to the market price and eliminates any arbitrage opportunities. For a CPMM model, the new equation would thus be:

Equation for a dynamic AMM based on constant product model (Source: Dynamic Automation Research Paper)

where x and y are the reserves in the liquidity pool and a(t) and w(t) are the parameters needed to be dynamically changed.

However such an approach requires a low-latency and accurate price feed.

The second way of a dynamic AMM is by using data from oracles such as ChainLink to calculate the implied volatility (the market’s forecast of the volatility of a particular asset). dAMMs then use this information to concentrate the liquidity near the market price if the implied volatility is low and extend the liquidity to an enormous price range if the implied volatility is high. An AMM protocol using this dAMM model is Sigmadex.

Learn more about Sigmadex dAMM.

Proactive Market Maker or PMMs

First introduced by the AMM protocol DODO, this AMM type also aims to increase liquidity and protect capital efficiency. This model acts similarly to a MM behavior on centralized exchanges. Like dAMMs, PMMs also change the parameters; however, it does it proactively in anticipation of changes in market conditions. They also rely on oracle price feeds to change their parameters and help increase the liquidity near the current market price, thus minimizing the impermanent losses for liquidity providers.

Concentrated Liquidity Market Making or CLMMs

CLMMs were introduced by Uniswap v3, which allows liquidity providers to set a specific price range within which they provide liquidity, which helps decrease the impermanent losses for any LPs. However, this approach to automated market-making requires users to be active and change their price boundaries when things get more volatile to improve their returns.

A CLMM works by breaking the price range into ticks and distributing the capital equally across every tick.

One tick refers to the smallest unit of price change. For example, ETH-USDT is currently trading at $1296.84, and a tick here would be $0.01 as it’s the lowest decimal value that ETH-USDT can move on either side.

Hence, 10 ticks here would mean $0.01*10 = $0.1

Uniswap v3 Pools in which you can set the price range for providing liquidity (Source: Uniswap Pools)

Such an active approach requires gas fees every time you try to change the price range, which could prove to be costly on Ethereum, which faces high fee issues during heavy usage periods; however, it won’t be an issue on other L1s or L2s, including Solana. Many Solana DEXs, like GooseFX use the CLMM model.

Conclusion

With the breakthrough innovation of Constant Function Market Makers (CFMMs), the financial markets and automated market-making enter a new era of innovation. AMM protocols are constantly innovating and designing new ways to improve capital efficiency and reduce impermanent loss using various methods. An exciting future awaits us, full of new and innovative AMM designs that will shape the future of the financial markets.

Stay Tuned with #GooseAcademy

Website | Twitter | Telegram | Discord | Docs

Disclaimer: The statements, proposals, and details above are informational only, and subject to change. We are in early-stage development and may need to change dates, details, or the project as a whole based on the protocol, team, legal or regulatory needs, or due to developments of Solana/Serum. Nothing above should be construed as financial, legal, or investment advice.