An automated market maker is a computer that constantly wants to offer you a price for any two assets. Uniswap, for example, employs a simple equation. Curve, on the other hand, uses more complex algorithms.
You may create a liquidity pool that provides liquidity to the market, allowing you to become the house by trading trustlessly with an AMM. This allows anyone with an exchange account to act as a market maker and get compensated for providing liquidity.
AMMS have carved out a niche in the DeFi market thanks to their simplicity and ease of use. The goal of cryptocurrency is to decentralize markets, so this way of doing it is in keeping with that objective.
Decentralized finance (DeFi) has taken off on Ethereum and other smart contract platforms, including Binance Smart Chain. Yield farming is becoming increasingly common for distributing tokens, with Bitcoin tokenization on Ethereum growing, and flash loan volumes exploding.
Meanwhile, automated market maker algorithms such as Uniswap see increasing volumes, liquidity, and users on a daily basis. But how do these platforms work? Why is it so simple to start trading the latest food coin? Are AMMs viable against conventional order book exchanges? Let’s have a look.
What is an automated market maker?
An automated market maker (AMM) is a decentralized exchange (DEX) protocol that employs a mathematical formula to price assets. Instead of relying on an order book, assets are priced according to a pricing algorithm instead of the usual.
The formula for calculating the amount of one token in a liquidity pool using this technique varies from protocol to protocol. For example, Uniswap utilizes x * y = k, where x is the amount of one token in the liquidity pool and y is the amount of the other.
In this formula, k is a fixed constant that implies that the pool’s total liquidity must always be maintained. Other AMMs may utilize different equations depending on the purposes they are addressing.
The similarities between them, however, are that they are all determined by an algorithm. If this is now making sense, don’t worry; hopefully, everything will fall into place in the end.
Traditional market making is typically used by large corporations with complex plans. Market makers on an order book exchange like Binance help you acquire a good price and narrow bid-ask spread on your purchase. Decentralized automated market makers allow almost anybody to establish a market on a blockchain. What exactly are they able to do? Let’s find out more.
How does automated market maker work?
An AMM, like an order book exchange, features trading pairs such as ETH/DAI. However, you don’t need a counterparty on the other side in order to make a trade (another trader). Instead, you communicate with a smart contract that “creates” the market for you.
Trades on a decentralized exchange such as Binance DEX occur between user wallets directly. If you sell BNB for BUSD on the Binance DEX, there’s someone else on the other side of the transaction who is buying BNB with their own BUSD. This may be described as a peer-to-peer (P2P) trade.
You could think of AMMs as peer-to-contract (P2C). There is no need for counterparties in the usual sense because trades take place between customers and contracts. There are no order types on an AMM because there is no order book. A formula is used to determine the price you get for an asset you wish to buy or sell. Although it’s worth noting that some future AMM designs may be able to address this limitation.
So who creates the market? Someone must still build it, correct? The smart contract’s liquidity has to be supplied by liquidity providers (LPs), as before.
What is LP (liquidity pool)?
Lenders (liquidity providers) contribute funds to liquidity pools. A liquidity pool is a large pile of money that traders may bet against.
LPs get compensated for providing liquidity through the transactions that take place in their pool. Uniswap’s LPs deposit an equal amount of two tokens into the ETH/DAI pool, for example, 50% ETH and 50%.
So, can anyone become a market maker? Yes! It is quite simple to add cash to a liquidity pool. The fee is set by the protocol. For instance, Uniswap v2 charges traders 0.3 percent, which goes straight to LPs. In order to attract more liquidity providers, alternative platforms or forks may charge less.
Why is it necessary to have liquidity? The less slippage large orders experience, the more liquidity there is in the pool. As a result, greater volumes may be attracted to the platform as a consequence of this.
Slippage can occur for a variety of reasons, but it’s something to keep in mind. Remember that pricing is determined by an algorithm. It’s basically about how much the liquidity pool’s tokens ratio changes after a trade. There will be a lot of slippages if the ratio fluctuates by a large amount.
Let’s assume you wanted to purchase all of the ETH in the Uniswap pool with ETH/DAI. You couldn’t do it, though! Each extra ether would have to be paid an exponentially higher and higher premium, but you’d never be able to buy it all from the pool. Why? It’s because of the formula x * y = k. If either x or y is zero, indicating that the pool has no ETH or DAI, the equation becomes meaningless.
However, this isn’t the entire story about AMMs and liquidity pools. When giving liquidity to AMMs, you must also consider something else – temporary loss.
What is impermanent loss?
When the price difference between deposited tokens and those bought back rises after you put them in the pool, irreversible loss occurs. The greater the change is, the larger the impermanent loss.
This is why AMMs perform best with token pairs that have a similar value, such as stablecoins or wrapped tokens. If the price difference between the pair stays within a reasonable range, a temporary loss is also minor.
On the other hand, if the ratio fluctuates a lot, liquidity providers may be better off keeping the coins rather than adding cash to a pool. Even so, Uniswap pools like ETH/DAI that are highly exposed to natural loss have been profitable due to trading fees.
However, the phrase “impermanent loss” is a poor way to refer to this phenomenon. “Impermanence” implies that if the assets return to where they were originally deposited, the losses will be reduced.
However, if you withdraw your funds at a different price ratio than when you deposited them, the losses are nearly permanent. In rare instances, trading costs might be able to offset the losses, but it is still crucial to think about the dangers. When putting money into an AMM, be cautious and double-check the consequences of impermanent loss.
Automated market makers are a standard feature of the DeFi environment. They allow anybody to set up markets seamlessly and swiftly, which is fantastic news for individuals looking to use this technology. While they have some drawbacks vis-a-vis order book exchanges, the overall value they provide to crypto is invaluable.
AMMs are still in their early stages. Uniswap, Curve, and PancakeSwap are elegant in appearance but limited in functionality. There will undoubtedly be many more creative AMM designs in the future. This should result in lower costs, less friction, and enhanced liquidity for every DeFi user as a result of this.