Résumé

You can see the automated market maker as a robot always ready to offer you a price between two assets. Some use a simple formula like Uniswap, while others such as Curve or Balancer use more complicated ones.

Not only can you trade with confidence with an AMM, but you can also help the AMM by providing liquidity to a liquidity pool. This allows everyone to become a market maker and receive fees from trades in return.

AMMs have really set up their nest in DeFi. This is explained by their ease of use. The decentralization of markets is intrinsically linked to the original vision of cryptocurrencies.


Introduction

Decentralized finance (DeFi) has seen an explosion in interest thanks to Ethereum and other smart contract platforms such as the Binance Smart Chain. Yield farming has become a widely used method of token distribution, tokenized BTCs are becoming more popular on Ethereum and the volumes of fast loans are exploding.

Meanwhile, automated market-maker protocols like Uniswap are seeing increased volume, liquidity, and user numbers.

But how do these exchanges work? Why is it so easy and quick to set up a market for the latest food token? Can AMMs really compete with exchange order books? Let's see it together.


What is an automated market maker?

An automated market maker is a type of decentralized exchange protocol (DEX), which relies on mathematical formulas to evaluate the price of assets. Instead of using an order book as is the case on a centralized exchange (CEX), assets are priced based on an algorithm.

The formula behind this algorithm depends on each protocol. Uniswap for example uses x * y = k, where x is the number of one token in the liquidity pool and y is the number of the other token. In this formula, k is a fixed constant, which means that the total liquidity of the pool remains constant. Other AMMs use different formulas depending on the use case they are targeting. The common point among all is that the price of assets is determined algorithmically. Is it still a little unclear for you? Don't be afraid, at the end of this article, everything will make sense!

Traditional markets function normally thanks to firms having vast resources and very specific strategies. Market makers allow you to get a good price thanks to a very low buy/sell spread, on exchange order books such as Binance. Automated market makers decentralize this process and allow anyone to create a market on the blockchain. How does it work? This question is answered in the next paragraph.


How does an automated market maker work?

An AMM works in the same way as an exchange's order book, since it contains trading pairs such as ETH/DAI. However, you do not need a third party (another trader) to place a trade. Instead, you interact with a smart contract that “performs” the trade for you.

On a decentralized exchange such as Binance DEX, trades are done directly from wallet to wallet. If you sell BNB for BUSD on Binance DEX, that means someone else is buying BNB for BUSD. This is what we call a peer-to-peer (P2P) transaction.

AMMs, for their part, can be considered peer-to-contract (P2C). There is no third party in the traditional sense, with transactions taking place between users or contracts. Since there is no order book, an AMM does not offer order types (Stop-loss for example). The price of the asset you want to buy or sell is therefore determined mathematically. However, some AMMs are trying to innovate in this direction.

Wait, there's no third party, but there's still someone creating the market, right? Yes indeed. Liquidity in smart contracts must be provided by users. These are called “liquidity providers” (LP).


What is a liquidity pool?

Qu'est-ce qu'une pool de liquidités ?


Liquidity providers deposit funds into a liquidity pool. You can think of a liquidity pool as a gigantic pot of money, used for trades. To thank LPs for providing liquidity to the protocol, they receive a share of the trade fees from the pools in which they hold funds. In the case of Uniswap, LPs must deposit two tokens – for example, 50% ETH and 50% DAI into the ETH/DAI pool.

Wait, does that mean anyone can become a market-maker? Yes absolutely! It is also relatively simple to add funds to a liquidity pool. Rewards are then determined by the protocol. For example, Uniswap charges 0.3% fees, which are then distributed to liquidity providers. Other platforms or forks can change this rate to attract more or less liquidity into their pool.

Why is it important to attract liquidity? Due to the way AMMs work, a pool with a lot of liquidity will experience less slippage. Which in turn will attract more volume to the platform, thus triggering a virtuous loop.

Slippage issues depend on the design of each AMM, so do your research. Always remember that price is determined algorithmically. In simplified terms, the price is determined by the evolution of the ratio after a trade between the tokens in the liquidity pool. If the ratio changes too significantly, slippage will be high.

To take this a step further, let's say you want to buy all the ETH in Uniswap's ETH/DAI pool. Well you couldn't! You would indeed have to pay an exponentially large price to attempt to purchase these. For what ? Because of the formula x * y = k. If x or y = 0, which would mean there is no longer any ETH or DAI in the pool, the equation would no longer make sense.

There is much more to learn when it comes to AMMs and liquidity pools. Always keep in mind that when you provide liquidity to an AMM, you expose yourself to non-permanent losses.


What is an impermanent loss?

Non-permanent loss occurs when the price ratio between the tokens you deposited changes. The bigger the gap, the bigger the loss. This is why AMMs work best with token pairs, where the two assets constituting them are stablecoins or wrapped tokens. If the price ratio of the pair can only change slightly, the non-permanent loss becomes negligible.

Conversely, if the ratio changes significantly, liquidity providers will be more profitable by holding their tokens than by providing liquidity. Despite this, Uniswap pools such as ETH/DAI, which are nevertheless highly exposed to non-permanent losses, are profitable thanks to the fees generated by trades.

That said, “non-permanent loss” is not the best way to name this phenomenon. The term "non-permanent" implies that if the assets returned to their price that was in effect at the time of your deposit, losses would be reduced. However, if you withdraw your funds at a different price ratio than the deposit, the loss will be completely permanent. Although in some cases trading fees mitigate losses, you should always keep in mind the risk of non-permanent loss.

Be careful when depositing funds into an AMM and make sure you fully understand the concept of non-permanent loss. If you want a more technical explanation, check out Pintail's article on this topic.


➟Do you want to get started with cryptocurrencies? Buy bitcoins on Binance!


Conclusion

Automated market makers are an essential part of DeFi. They allow anyone to quickly and easily create a market. Although these have limitations such as no order book, the innovation these bring to the crypto sphere is immense.

AMMs are only just beginning. The AMMs we know and use such as Uniswap, Curve and PancakeSwap are elegant and easy to use, but do not have many features... More sophisticated AMMs will surely emerge in the future. These innovations will reduce fees and friction and ultimately attract more liquidity into DeFi.

Want to learn more about DeFi and automated market makers? Check out our Q&A platform, Ask the Academy, where the Binance community will be happy to answer your questions.