# World of DeFi: AMMs: Types of AMMs

Learn about CFMMs, Types of CFMMs, First gen AMM Models, Hybrid AMMs, Types of Hybrids AMMs and much more with GooseFX

## Table of Content

- Introduction
- Constant Function Market Makers - CFMMs
- Different types of first-generation CFMMs
- Disadvantages of first-generation AMM Models
- What are Hybrid AMMs
- Types of Hybrid AMMs
- Conclusion

## Introduction

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 developed over time.

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

## Constant Function Market Makers

Constant Function Market Makers, or CFMMs for short, are the first generation of 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. An example of this would be the function x*y=k used by 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, the first DEX to use AMMs.

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:*

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

The graph of such an equation 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__.

### Constant Sum Market Makers or CSMMs

The second type of AMMs is 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:*

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 graph of such a function, it would be a straight line, as shown below:

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 type under CFMMs is 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:*

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 graph for a liquidity pool with three assets would look like such:

It was first formulated and introduced by 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 AMM Models

Now that we've covered the first generation of AMMs, it's time to talk about the problems of those models. __Many of these AMMs 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 graph is "Concave," implying that liquidity providers or LPs make money only in a short range or portion of price movement.

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

The second problem of these traditional AMMs is __capital efficiency and slippage__.

Slippage is __the price impact or movement of any entity buying or selling its tokens__. CFMMs or Traditional AMMs are created so 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 AMMs.

Another point to note is that the trader depositing his money in an AMM has __no control over which price points they can provide liquidity__ compared to MMs on order-book exchanges, leading to low 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 example of the hybrid CFMM model is the Curve AMM which combines the CPMM and CSMM models using a complex formula to help reduce the price impact or the slippage of trades. The resulting equation 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.

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 such as the one created by Perpetual Protocol, allowed 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:__

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 example of such a dAMM is Sigmadex, and you can learn more about their dAMM here.

### Proactive Market Maker or PMMs

First introduced by 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*

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. AMMs 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.*

## Comments ()