In this article we would like to focus on the concept of the automated market makers (AMM). They serve as a building block for decentralized exchanges (DEXes) which have been gaining momentum in DeFi. For instance, DEX all-star Uniswap saw its total value locked (TVL) grow from 150 mln USD at the start of August till over 2 bln USD at the end of the Q3 and currently it is around 1.2 bln USD. Uniswap’s success is built on the parties providing liquidity in exchange for trading fees which are distributed proportionally to the share of the pool’s liquidity. Furthermore, trading fees are also added to liquidity pools which creates a natural loop of more liquidity which generates more trading fees and results in increased liquidity (and so on). Uniswap’s liquidity and popularity have grown to such proportions that on certain days it’s daily turnover/volume exceeded the 8 bln USD traded daily on Coinbase, as is shown below.
What are Automated Market Makers (AMMs)?
The largest innovation of Uniswap, and other DEXes are AMMs. So what are these? Automated market makers are smart contracts based pools of liquidity which are automatically traded by an algorithm rather than an order book. The algorithm which is protocol dependent, balances the supply and demand through pricing on the basis of the two sides of liquidity. For example, Uniswap uses 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, meaning that the pool’s total liquidity always has to remain the same. In other words, pricing is 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 larger amount of slippage than usually. AMMs effectively replace a traditional limit order-book with a system where assets can be automatically swapped against the pool’s latest price on the basis of algorithmic determined pricing.
Liquidity pools (LPs)
Liquidity pool contains two assets in a trading pair. The relative percentage of each token in that pool is what determines the theoretical price of a particular asset. In return for providing liquidity to the protocol, Liquidity Providers (LPs) earn fees from the trades that happen in their pool. The more liquidity there is in the pool, the less slippage large orders may incur. That, in turn, may attract more volume to the platform and generate more compensation (fees) for the LPs.
Providing liquidity is rather easy, after connecting a wallet, users can go to the “liquidity provider” section and select how much they want to commit to the pool. In most protocols, they need to have both types of assets available. For example, if ETH is trading for 400 Dai, the user will need to simultaneously provide 1 ETH and 400 Dai. After confirming the transactions, users receive a token representing their ownership in the liquidity pool. It can then be transferred to anyone or redeemed once again for the underlying tokens plus any fees they might have accumulated.
Potential of AMMs
AMMs are, arguably, solving the biggest obstacle to the widespread adoption of decentralized exchanges today, namely liquidity. Moreover, unlike centralized exchanges, there is no central entity that could exclude projects or users. Current AMM DEX protocols are permissionless and do not require to set up specific accounts or pass Know Your Customer (KYC) checks. A wallet address is all that is necessary to interact with the protocols. Finally, there are no listing fees or admission criteria, as anyone, even an outsider, could set up a liquidity pool for any token. Due to the above mentioned reasons, the number of new users in the AMM space is increasing exponentially.
Risks of AMMs
The main risk of AMMs is so called an impermanent loss, which is a temporary loss of funds that could occur during liquidity provision. It’s very often explained as a difference between holding an asset versus providing liquidity in that asset. Impermanent loss is usually observed in standard liquidity pools where the liquidity provider (LP) has to provide both assets in a correct ratio with one of the assets being volatile in relation to the other. For example, in a Uniswap DAI/ETH 50/50 liquidity pool. If ETH goes up in value, the pool has to rely on arbitrageurs continually ensuring that the pool price reflects the real-world price to maintain the same value of both tokens in the pool. This basically leads to a situation where profit from the token that has appreciated in value is taken away from the liquidity provider. At this point, if the LP decides to withdraw their liquidity, the impermanent loss becomes permanent.
Other known risks are exploits and hacks, whereby inefficiencies are targeted, leaving LPs with potential losses. Year to date multiple exploits have cost LPs in the range of 50-75 mln USD.