XFai Deep Dive — AMMs

Welcome to XFai Deep Dive !!

XFAI Deep Dive is a series of educational content for all users of XFAI (we will get a name for it in the future). This is to educate users about the background of XFAI and what XFAI will solve and impact the DeFi space.

After these series, you will understand what we are building and how “close” we are to MOON when we launch our product.

What are Automated Market Makers?

Image from: https://www.argent.xyz/learn/what-are-automated-market-makers/ and made by: Edward

AMM can be defined formally as an algorithmic agent that offers liquidity in the market to increase information aggregation and facilitating proper price discovery.

In the decentralized finance space (dubbed DeFi), an AMM is a type of smart contract protocol used to establish asset prices in a decentralized and trustless manner and enables asset exchange.

In 2016, Vitalik (with helpful input from Martin Koppelmann) proposed a simple but elegant solution for building a functional decentralized exchange (DEX) on Ethereum. Constant function market makers (CFMMs), as they are now called, were a groundbreaking concept in that they did not depend on order books to enable an exchange.

CFMMS instead make use of what is known as a constant function, which creates a predefined set of pricing based on the reserves of the smart contract’s assets.

Vitalik’s original post proposed a constant product market, which can be defined as:

(R𝛂- ∆𝛂) (R𝛃-𝜸∆𝛃) = k (constant product market)

where , ∆ = Rate of Change / 𝛂 = Token A / 𝛃= Token B /R=Non-zero reserves/ constant product, K = R𝛂 R𝛃, and a percentage fee (1-𝜸)

“To put it simple, they made an equation that makes any ASSET EXCHANGE TO OTHER ASSET WITH NO NEED FOR INEFFICIENT ORDER BOOKS”.


Two years later, Uniswap was developed with this function in mind, setting the stage for the AMM wave in DeFi.

Since then, many more AMM have emerged developed, each addressing a distinct kind of issue inside CFMMs. Curve (2019) tackled the “slippage problem” facing stablecoins in DEXs.

Why do we need them?

AMMs can provide a variety of advantages, the following are a few examples:

  • Through AMMs, startups and young projects are able to maintain more control. There is no need for projects to sell large quantities of tokens to centralized exchanges.
  • Swaps are faster than in traditional exchanges.
  • AMMs may be thought of as on-chain oracles. Asset prices can be determined in a decentralized and trustless way.
  • DEXs do not need account creation or know-your-customer (KYC). MMs allow everyone, regardless of borders, to engage in crypto.

But, what is the bad side?

Slippage — Slippage may occur depending on the amount of a transaction in comparison to the reserves of an AMM.

As an example, consider the DAI-USDC Uniswap pair. Given that DAI and USDC are both USD-denominated stablecoins, we can anticipate them to have a similar value.

One would assume that exchanging 100 DAI for USDC will result in 100 USDC. This is not always the case, though. For instance, if we have a token pair consisting of 100 DAI and 100 USDC, converting 100 DAI to USDC results in just 50 USDC. The remaining 50 USD would be lost as a result of slippage.

Image taken from blackwholeswap whitepaper.

Capital efficiency — As previously stated, having deeper reserves in a DEX is advantageous since it results in lower slippage per trade. For many reserves however, most of the liquidity will never be used, or not used effectively enough.

This is because some assets (for example, stablecoins) do not trade over the full price interval, but rather inside a restricted band. This also translates into lower fees for liquidity providers, which is undesirable.

Impermanent loss — Impermanent loss happens when liquidity is provided to a liquidity pool (such as a token pair), and the price of the provided liquidity changed compared to when it was provided.

In other words, the more skewed the AMM reserves become in comparison to when the assets were given, the greater the impermanent loss. As we will see in subsequent blog posts, there is an intriguing relationship between impermanent loss and slippage, and we will argue that this property is actually a feature rather than a bug when utilized / implemented properly.

What does it have to do with XFAI?

At XFAI, our primary product is a DEX (name to come) that specifically addresses these problems.

  • Increase capital efficiency
  • Decrease slippage
  • Improve token on-boarding
  • Benefit from impermanent loss.

With this blog series, we want to clarify the ideas and language required to understand what we’re building. Our goal is to bring DEXs to the next level. We’re going to lay down the necessary puzzle pieces in the upcoming blog posts. Stay tuned! :)

About XFai

XFai develops tooling for the DeFi space, graphing it to build game-changing products. The XFai DEX is set to invite mid and small-cap tokens to start earning APY on their token holdings, while the XFai LGE is set to become industry-first in providing a more efficient, transparent, and fair way for everyone to get involved at an early stage. The LGE for XFai’s native token, XFIT, was launched on 16th April 2021. We invite everyone to join the DeFi revolution, spearheaded by XFai.

Reach Xfai

Website | Telegram | Telegram Announcement| Twitter | GitHub

XFai develops tooling for the DeFi space – we graph the DeFi space to build game-changing products. Starting with the DLO: the DEX Liquidity Oracle