How Do Automated Market Makers (AMMs) Work?

How Do Automated Market Makers (AMMs) Work?
How Do Automated Market Makers (AMMs) Work?
CROWD Staking

TVL

APY

Daily

Table of Contents

On a chilly, snowy night in 2021, Stacy was sitting in the comfort of her house browsing through the internet when suddenly a pop-up appeared on her screen. It was an advertisement about a limited 40% discount for pre-ordering a brand new TV she had been hoping to buy for a long time. It was a great offer, but Stacy had no credit left because she had spent all her money a week before on Black Friday. So she decided to sell her old TV on a P2P platform to raise the deposit amount she needed to book her order. Unfortunately, it took four days for Stacy to sell her old TV at a reasonable price, and she missed the offer. But what if there was an entity that could facilitate the process so that Stacy wouldn’t have to wait that long? That’s what Automated Market Makers (AMMs) do; they help conduct a transaction with the liquidity they have.

The recent boom in decentralized finance (DeFi) has been made possible by two types of service: lending services on the one hand and exchange services on the other. Indeed, it is essential for an ecosystem that wants to be decentralized to allow exchanges that are also decentralized. The objective is simple: to enable users to exchange cryptocurrencies on a peer-to-peer basis without a trusted intermediary.

Within the family of decentralized exchanges, AMMs can implement several mechanisms. The most widespread in recent times is the automated market maker used by Uniswap, Balancer, or Curve. Let’s see how they work. 

What Is a Market Maker?

For several years, projects have tried to replicate the operation of traditional exchange platforms, aka centralized exchanges (CEXes), on the blockchain. Thus, we have seen the emergence of several decentralized trading platforms based on order books. Indeed, market makers are market players, ensuring that each order is completed by providing their liquidity, hoping to take advantage of the difference between the selling and buying price on a given market. It is these market makers who ensure the liquidity and usability of an exchange. 

In simpler terms, a market maker is an entity that takes buy and sell orders to provide liquidity and facilitates transactions in DeFi. With the help of market makers, buyers and sellers can conduct transactions without waiting for a counterparty to appear. However, these players were only sometimes present in the case of decentralized exchanges based on order books. This is where automated market makers come into play.

What Is an Automated Market Maker (AMM)?

As the name suggests, automated market makers are computer programs that replace the work of market makers. In practice, AMMs allow users to exchange (or swap if you will) cryptocurrencies on a peer-to-peer basis. However, in this case, the usual order book is replaced by liquidity pools deposited on smart contracts. The concept of liquidity pool is central to understanding what an AMM is and how it works.

What Is a Liquidity Pool?

Liquidity pools are formed from tokens provided by liquidity providers (LPs), locked in a smart contract to facilitate transactions in a DeFi protocol. The importance of liquidity to decentralized exchanges is that it determines how the price of a crypto asset changes. In markets with no or less liquidity, the open buy and sell orders are relatively limited. 

When the market is illiquid, a single trade can drastically change the price of assets. This can negatively impact the market, making it unpredictable and reducing its attractiveness. To tackle this issue, liquidity pools are essential, as they facilitate the exchange of a large number of assets.

Read more about liquidity pools .

How Do AMMs Work?

AMMs are based on mathematical formulas, making it possible to estimate the exchange rate between two assets. They also take into account the liquidities present in the protocol. Several formulas exist in AMMs, each having their advantages and disadvantages.

Constant Function Market Makers

Constant function market makers are the most common in the AMM family. Uniswap and the V1 of Bancor notably use these. These are based on a function x*y=k that sets the price for a pair of tokens based on available liquidity.

Thus, when the quantity of token x increases, that of y must decrease to keep the value of k constant. As the curve below shows, the advantage of this model is that it ensures that there will always be liquidity. However, as this decreases, prices increase exponentially. This phenomenon is called slippage.

Constant Function Market Makers

Mean Constant Maker Makers

Constant-mean market makers introduced another type of formula. These allow the addition of one or more other assets in addition to the two assets typically found on trading platforms.

In this case, the formula for three assets will be (x*y*z)^(1/3)=k, which allows exposure to several different assets and exchanges between these assets.

Hybrid Constant Function Market Makers

A third family of AMM, called hybrid, combines several functions to respond to particular problems. This is notably the case of the Curve formula, which combines two types of procedures: constant-function market makers and constant-sum market makers.

The function reduces slippage over a range of trades while heightening it in the case of significant transactions. Thus, most trades will have a linear exchange rate, and only larger quantities will be subject to slippage.

Conclusion

You can think of an automated market maker as a robot always willing to quote you between two assets. Using AMMs, you can trade with confidence and earn rewards by supplying liquidity to a liquidity pool. The rewards are calculated through various formulas and have different APYs and APRs. This allows anyone to become a market maker on an exchange and earn fees for providing liquidity. 

AMMs have genuinely carved out their niche in the DeFi space because they are simple and easy to use. Decentralized market making in this way is at the core of the crypto vision.

Table of Contents

Stay tuned with CrowdSwap Newsletter

No worries, we will never spam you. Join now and stay up to date on defi

Enter your email address

Ready to Supercharge Your Financial Knowledge?

Drop your email, and we'll deliver the Ultimate DeFi Guide straight to your inbox! 🚀