By
Dimitar Bogdanov
April 13, 2022
4 Min Read
An automated market maker is a type of decentralized cryptocurrency exchange (DEX) that utilizes crypto asset pools to enable trading without order books. Automated market makers are some of the earliest applications of decentralized finance and remain among the most prominent DeFi products today.
Trading on traditional centralized exchanges is facilitated by order books, which match traders based on their bidding and asking prices. Basically, the exchange operator maintains a list of all open buy and sell orders for an asset, organized by price. Every trading pair (a pair of assets that can be traded for each other) supported by the exchange has its corresponding order book.
This approach is well established and works pretty great, but it does mean that you need to trust a centralized entity and play by its rules. But what if you wanted to trade crypto in a decentralized way?
One option is to use a peer-to-peer DEX that connects users and allows them to trade directly with one another. However, you can also use an automated market maker.
An automated market maker (AMM) is a type of DEX that fully embraces blockchain technology and the decentralization it brings. The platforms that fall into that category utilize smart contracts and clever tokenomics in order to automate cryptocurrency trading and make it truly decentralized. Let’s see how they do that.
The main purpose of an AMM is to ensure that users can always trade crypto even if there are no counterparties with matching offers. That’s why, while AMMs do have trading pairs, they don’t rely on order books. Instead, they make use of smart contracts that control special crypto asset pools that are specifically designed to provide the liquidity needed to facilitate seamless trading.
Typically, a liquidity pool consists of the two crypto assets that make up a particular trading pair, for example ETH and DAI. The value of the assets in the liquidity pool is carefully managed to satisfy a set mathematical formula. Arguably, the most well-known formula is x*y = k - this is the formula used by Uniswap, which is currently the leading automated market maker. In that formula, x is the amount of one asset, y is the amount of the other asset and k is a fixed constant. The formula essentially ensures that the total liquidity in the pool always remains the same and allows the price ratio between the two assets to be controlled algorithmically via smart contracts.
The way this works is rather simple. When a user buys ETH (paying with DAI) from an ETH-DAI liquidity pool, the amount of ETH token in the pool decreases, while the amount of DAI tokens increases. This tells the pool’s algorithm to adjust the price ratio between the two assets accordingly, so that the x*y = k formula is maintained. Some protocols like Curve Finance use more complex formulae, but the underlying principle remains the same and it ensures that, as long as there is sufficient liquidity in the pool, users can count on getting a quote price for their desired trade.
Given what we’ve discussed so far, it’s hardly surprising that liquidity plays a huge role in decentralized finance and is especially crucial for AMMs. So how exactly an automated market maker gains liquidity.
The commonly used approach is for AMM platforms to incentivize users to lend their crypto assets in exchange for the opportunity to earn a passive income. This means that anyone who holds crypto tokens can lend them to an appropriate liquidity pool and earn some lucrative returns for their trouble.
More recently, we’ve seen the emergence of DeFi protocols like Olympus DAO, which seek to create ‘protocol-owned liquidity’ solutions for the DeFi sector. These protocols are part of an emerging movement dubbed DeFi 2.0.
Attracting as much liquidity as possible is very important, because it minimizes the slippage caused by large orders.
So what is slippage? Well, slippage refers to a specific effect that intensifies greatly when there are large trades and not enough liquidity to support them. It’s the change in price of an asset caused by a trade order - if the order is too large compared to the liquidity pool, that change can be quite significant.
Of course, the slippage problem is not unique to automated market makers and it can also affect order book exchanges as well. However, AMMs can be especially susceptible to that effect because its price-adjusting algorithms are based on the ratio between the assets in a liquidity pool. Thus, higher liquidity means smaller price swings.
Another way to mitigate the slippage effect is through the algorithm itself. As we mentioned above, the x*y = k formula was popularized by the industry juggernaut that is Uniswap, but it’s not the only possible approach. For example, Curve Finance, which is an AMM like Uniswap, but for stablecoins, uses a more complicated formula, designed to fit its specific needs.
Another issue stemming from the AMM design is the so called impermanent loss, which affects liquidity providers (LPs). Depositing assets into a liquidity pool is typically incentivized by the prospect of generating passive income in the form of a percentage of the total trading fees accrued by the pool. However, because of the impermanent loss phenomenon, this proposition is sometimes less lucrative than it seems.
Because the price-adjusting algorithms of liquidity pools are only concerned with maintaining a balance between the values of the assets within a pool, the same tokens can have different values within and outside of a liquidity pool. This means that taking your assets out of a liquidity pool could come at a loss. Of course, that loss only materializes if you take the assets out of the pool but a refusal to do so limits your ability to cash in on other lucrative opportunities.
One of the latest trends in AMM development revolves around concentrated liquidity. This feature is designed specifically to make the price-adjusting mechanism more efficient, minimize slippage and allow liquidity providers to earn higher fees.
Concentrated liquidity allows LPs to allocate assets to specific price ranges. By combining multiple concentrated liquidity positions, LPs are able to create individual price curves, customized to their preference.This also allows them to earn trading fees against the liquidity provided at specific price ranges rather than the total pool liquidity.
Concentrated liquidity is one of the highlights of Uniswap’s latest version, Uniswap v3.
The aforementioned drawbacks notwithstanding, automated market makers are already proving to be a success. Uniswap V3, Pancakeswap V2 and others are already generating trading volumes that are comparable to or even greater than some major centralized exchanges. And as concepts like protocol-owned liquidity and concentrated liquidity are further developed, AMM services are set to become more and more sophisticated, while the adoption of Layer 2 solutions will help make trading on AMMs cheaper, faster and more convenient.
If you have an idea for a revolutionary new product in the DeFi space, you've come to the right place! We're helping develop some of the most promising new projects in the space and we're always looking to support new groundbreaking ideas! So don't hesitate go get in touch and tell us how we can help to you realize your vision!