Over the years, blockchain technology and the world of Decentralized Finance (DeFi) have experienced a remarkable increase in users. This increase is noticeable, especially in the interest in Ethereum and other smart contract platforms. As a result, yield farming has become one of the most popular ways to distribute tokens. As a result, tokenized BTC is increasing on the Ethereum blockchain, and flash loan volumes are booming steadily.
During this growth, many automated market maker protocols such as Uniswap often experience competitive volumes, high liquidity and an increase in the number of users. In this article we will tell you all about what an AMM is and how these exchanges work.
An automated market maker (AMM) is a type of decentralized exchange protocol or DEX. This DEX is based on a mathematical formula by which it determines the price of assets. These exchanges do not use an order book like other traditional exchanges. Instead, the price of assets is determined based on a valuation algorithm.
This formula is not constant, since it may vary for each protocol. An example of such protocols is Uniswap, which, for example, uses the formula x * y = k. In this formula “x” is the amount of one token in the liquidity pool, and “y” is the amount of the other. In this formula, “k” represents a fixed constant. This means that the total liquidity of the pool should always be the same. This is only the formula used by Uniswap. Other WMAs will employ alternative formulas for the specific use cases they address. Although the formulas change, there is one thing these exchanges have in common and that is that prices will be determined algorithmically.
Traditional market making is usually executed by firms with numerous resources and complex strategies. Market makers help us get a good price and a tight bid-ask spread in a traditional exchange with an order book. Automated market makers decentralize this process and basically allow anyone to develop a market on a blockchain.
In general terms, a DEX of the AMM type is similar to a traditional exchange. In other words, both are a space where users can exchange cryptocurrencies. To achieve this goal, exchanges offer a user interface, as well as all the necessary tools to carry out these operations. However, they have clear differences. This is because, despite their main objective, the rest of the operation of both is completely different.
The first thing to know is that WMAs work, for the most part, through a fairly simple formulation that is described mathematically, as follows: x * y = k
To better understand the meaning of the formula it is best to break it down. In this formula the “x“, is the letter indicating the amount of the first token of the pair. For example; token A, in this case found in a liquidity pool.
On the other hand, we find the “y” which is the variable that indicates the amount of the second token of the pair, which in this case would be the token B that are in a liquidity pool.
And finally we find the “k“, which is the variable that serves to indicate the fixed constant in charge of establishing the relationship between both tokens, and which will remain invariable during the whole life of the liquidity pool.
With this formula we see how AMM type DEXs follow the same swap pair presentation model of traditional exchanges. To understand it better let’s put an example; let’s imagine that we put a BTC/USDT exchange pair on a certain DEX of the AMM type. This will be possible because there is a liquidity pool that has related amounts of both BTC and USDT that follow and respect the formulation we have seen above. As we mentioned at the beginning of the article, one of the DEX that employs this formula is Uniswap V2, however, there are many others such as SushiSwap, PancakeSwap and other derivatives.
As we already know, AMM type DEXs are not limited to the formula described above. One of the exchanges that does not employ it is Bancor. Bancor uses a proprietary technique developed to be very similar to the classic formula, but which offers several unique advantages that are able to adapt to the needs of the platform. In other words, DEX AMMs are able to employ different formulations tailored to their needs. Some may be more complex than others.
The operation of these exchanges also depends on another factor. This factor is the liquidity pools. Liquidity pools are important because they allow liquidity providers to aggregate pairs of tokens so that this liquidity can be used in the exchanges and in return they receive rewards for the exchanges carried out. These liquidity pools are spaces controlled by smart contracts that take care of the entire operation.
Let’s imagine that we want to request a USDT/ETH exchange. To do this we would go to one of these exchanges, for example Uniswap, and follow the steps below;
This is how this mechanism works and maintains the balance of the main formula. It should be noted that we will be charged commissions. Of these fees, one part will go to the exchange, which in this case is Uniswap, and another part will go to the liquidity providers.
Once the exchange is done, another user will come and want the USDT we have exchanged and so on. In this way the dynamics of the exchange is maintained.
After all this explanation, it is clear that liquidity pools are the engine of these exchanges and form a vital part of their operation.