AUTOMATED MARKET MAKER (AMM): THE NEW GENERATION OF MARKET MAKERS
Updated: May 30

Author: Eddy Paoletti
Date of publication: 17/1/2022
«The first difficulty in barter is to find two persons whose disposable possessions mutually suit each other’s wants. There may be many people wanting, and many possessing those things wanted; but to allow of an actual act of barter there must be a double coincidence, which will rarely happen»1.
To understand the Automated Market Makers, we should start from the problem that they want to solve.
INTRODUCTION TO THE ORDER BOOK, THE LEADER SYSTEM IN MARKET MAKER
In the asset trading system, the dominant mechanism that allows supply and demand to meet is the order book. One of the most important types is the Central Limit Order Book (CLOB)2: a peer-to-peer mechanism, where makers represent the subjects that provide liquidity to the market by placing their orders into the order book. Thanks to the work of makers, operators who want to exchange their assets can buy or sell at any time at the price defined by the mechanism of supply and demand of the order book. These are called takers and we can see them as the customers who are going to pay for the maker’s orders3.
WHEN ORDERS BOOKS ARE INEFFICIENT
Although the order book system has enabled the creation of complex financial markets, it presents some critical issues when operating in particular markets. In fact, in all those markets that offer low liquidity, which can be motivated by low volumes, makers have difficulty placing their orders.
To understand: let’s imagine markets with low capitalization, where single operators can create strong price variations thanks to one of their operations. In these markets, makers are disincentivized to place orders involving sallow and expensive transactions.
But which markets have these characteristics and how would AMMs like to face the issue related to the flaws in the order book system?
AUTOMATED MARKET MAKER (AMM)
The development of decentralized finance based on blockchain technology has led to the birth of multiple markets that have the previously mentioned characteristics. This is because many tokens were born that need to be exchanged with other currencies to have a value.
Although there is an order book on-chain systems such as Binance DEX or Project Serum4, AMMs are having a lot of success. The advantages of this system are that it ensures constant liquidity at every price level and allows anyone who owns the required tokens to provide liquidity, creating passive financial intermediation.
HOW DOES AUTOMATED MARKET MAKER (AMM) OPERATE?
The AMMs base their mechanism on liquidity pools5. They can be described as a fund that works following rules defined by a script, which is called a “smart contract” in the blockchain environment.
Liquidity pools are used in other areas beyond AMMs, as yield farming or lending protocols, furthering the development of decentralized finance. In the case of AMMs, by executing the lines of code, the smart contract stands as an automatically and autonomously counterparty to the trades.
But how do these liquidity pools work in practice? Let’s try to describe a liquidity pool containing two tokens, representing a market for that specific pair of tokens on a DEX.
4
PRACTICAL EXAMPLE OF AUTOMATED MARKET MAKER (AMM)
For our example, let’s consider a stablecoin (a token that maintains the constant value of $1), and a token with a variable value:
DAI: stablecoin collateralized by other variable tokens. Unlike other stablecoins that use dollars as a reserve to issue cryptocurrencies that are worth $1, in this case, the value is kept constant at $1 through a reserve maintained in cryptocurrencies6. This reserve is managed by a smart contract called Maker Value and has the power to liquidate the collateral if it falls below its collateralization rate7.
SAND: token related to the metaverse of The Sandbox, a virtual reality where participants can build, own, and monetize through a system very similar to the real-world economic system8.
To add liquidity to the swap pools, you must provide an equal value for the two tokens. In this case, let’s assume that we are adding the two tokens for a counter value of $100.
The SAND token has been given the symbolic value of $5, while the DAI, which maintains a fixed value, is equivalent to $1. To have two quotes with equal value, we should provide the pool 10 SAND and 50 DAI, in order to have two quotes of $50.
Let’s further assume that the entire value of the pool is $500.

Picture (1) - values described in the previous example
Now we consider that an exchange takes place between these two cryptocurrencies in this pool. The transaction generates a commission that will increase the value of the pool, and therefore also of our share. Usually, commissions are paid to the pool as a percentage of the transaction’s value: the more it converts, the more you pay9.
It is important, however, to analyze what happens when a transaction occurs within our quote of the pool. Suppose a transaction occurs from a trader buying 10 SAND, paying them 50 DAI. Let’s see what happens by comparing the transaction with the value of our share. Considering that our share was 1 in 5 of the entire pool, the change will be as follows:

Picture (2) - change the number of tokens in our portion of the pool
The amount of SAND decreases from 10 to 8, while the number of DAI increases from 50 to 60. Considering that the value of the DAI is fixed, this generates a variation of the price of the SAND within the pool. It can be seen in the next picture that the price of SAND increases from $5 to $7.5.

Picture (3) - change in the value of the SAND price within the pool
Let's try to understand now what an arbitrager could do: he can simply buy SAND in an exchange where it has a value of $5 and sells it in the liquidity pool where it is worth $7.5.
CONCLUSION
The example shown above is just one of the many types of swap pools. Some AMMs use pairs of stablecoins or two-variable tokens, others use pools with more than two tokens, and other AMMs use different systems.
Liquidity pools are effective tools to increase the number of markets and also to provide a lot of liquidity to them. At the same time, liquidity pools allow many users to carry out passive financial intermediation.
To conclude, it is important to mention the potential risks of these investments that can arise from the bag of smart contracts or impermanent loss. In fact, assuming the price of SAND goes from $5 to $10, if we liquidate our share, as we have seen from the picture (2), we would be returned 8 SAND and 60 DAI, plus the fees earned from the exchange.
Our portfolio will have a value of $140, given by $80 of SAND and $60 of DAI. But if we had done nothing, we would have had $150, given by $100 from SAND and $50 from DAI. The commissions would not have covered the $10 capital loss.