You could think of an automated market maker as a robot that’s always willing to quote you a price between two assets. Some use a simple formula like Uniswap, while Curve, Balancer and others use more complicated ones.
Not only can you trade trustlessly using an AMM, but you can also become the house by providing liquidity to a liquidity pool. This allows essentially anyone to become a market maker on an exchange and earn fees for providing liquidity.
AMMs have really carved out their niche in the DeFi space due to how simple and easy they are to use. Decentralizing market making this way is intrinsic to the vision of crypto.
What is an automated market maker (AMM)?
How does an automated market maker (AMM) work?
An AMM works similarly to an order book exchange in that there are trading pairs – for example, ETH/DAI. However, you don’t need to have a counterparty (another trader) on the other side to make a trade. Instead, you interact with a smart contract that “makes” the market for you.
So there’s no need for counterparties, but someone still has to create the market, right? Correct. The liquidity in the smart contract still has to be provided by users called liquidity providers (LPs).
What is a liquidity pool?
Liquidity providers (LPs) add funds to liquidity pools. You could think of a liquidity pool as a big pile of funds that traders can trade against. In return for providing liquidity to the protocol, LPs earn fees from the trades that happen in their pool. In the case of Uniswap, LPs deposit an equivalent value of two tokens – for example, 50% ETH and 50% DAI to the ETH/DAI pool.
Hang on, so anyone can become a market maker? Indeed! It’s quite easy to add funds to a liquidity pool. The rewards are determined by the protocol. For example, Uniswap v2 charges traders 0.3% that goes directly to LPs. Other platforms or forks may charge less to attract more liquidity providers to their pool.
The slippage issues will vary with different AMM designs, but it’s definitely something to keep in mind. Remember, pricing is determined by an algorithm. In a simplified way, it’s determined by how much the ratio between the tokens in the liquidity pool changes after a trade. If the ratio changes by a wide margin, there’s going to be a large amount of slippage.
But this isn’t the complete story about AMMs and liquidity pools. You’ll need to keep in mind something else when providing liquidity to AMMs – impermanent loss.
What is impermanent loss?
Impermanent loss happens when the price ratio of deposited tokens changes after you deposited them in the pool. The larger the change is, the bigger the impermanent loss. This is why AMMs work best with token pairs that have a similar value, such as stablecoins or wrapped tokens. If the price ratio between the pair remains in a relatively small range, impermanent loss is also negligible.
With that said, impermanent loss isn’t a great way to name this phenomenon. “Impermanence” assumes that if the assets revert to the prices where they were originally deposited, the losses are mitigated. However, if you withdraw your funds at a different price ratio than when you deposited them, the losses are very much permanent. In some cases, the trading fees might mitigate the losses, but it’s still important to consider the risks.
Automated market makers are a staple of the DeFi space. They enable essentially anyone to create markets seamlessly and efficiently. While they do have their limitations compared to order book exchanges, the overall innovation they bring to crypto is invaluable.