When you trade digital assets, you do it on the basis of trust with your fellow trader. Do you remember that guy who sold his pizza for 10,000 Bitcoins? Before transferring Bitcoins, he had to ensure that the person he is sending BTC will not run away with his coins.
One way to perform such trading is through Bitcoin forums and IRC channels where you trust the reputation scores of an individual engaged in the trade. Usually, such trading happens in P2P trading platforms. But these platforms also have some risks. There are chances that the individual may cheat after earning trust.
With the invention of exchanges like Coinbase and Mt Gox, the need for trusting reputation scores disappeared. An individual trader can deposit on a centralized account and trade with one another. But, such trading involves custodial risks as it happened with Mt Gox.
When the number of digital assets increased, these centralized exchanges became gate-keepers of liquidity. The digital assets will increase in the form of NFTs, personal tokens, and other representations of value on-chain. In such a case it is quintessential to have an infrastructure that will enable the exchange of one asset with another without the involvement of any third-party. It is where the automated market makers and liquidity pools come into the scenario.
Now, let’s discuss more on automated market makers, it’s working, and much more.
What is an Automated Market Maker (AMM)?
Automated Market Makers are a class of decentralized exchange protocols that rely on mathematical formula to set a price for a token. The formula varies with each protocol. For instance, Balancer 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 constant value, which means the pool’s total liquidity will always remain constant.
Different AMMs use different formulas, but they have one similarity which is that all of them determine the prices algorithmically. AMMs use smart contracts as a maker in an exchange transaction. The concept of AMM is similar to the services of ShapeShift and Changelly. The only difference is that the company’s reserves are replaced with liquidity pools. The first AMM was developed in 2017. It was Bancor and today we have various other market makers like Uniswap, Curve, Kyber, and Balancer.
How does it work?
An automated market maker works similarly to the order book exchange. AMM doesn’t require you to trust your fellow trader because all you have to do is interact with a smart contract that “makes” the market for you.
You can consider an automated market maker as a peer-to-contract transaction. The trade is usually carried out between the user and the contract. The price for an asset is determined by a formula. Although there is no need for any counterparties, there should be someone to create the market.
There are liquidity providers who provide liquidity to the pool. A liquidity pool is a big pile of funds that traders can trade. When LPs provide liquidity to the pool, they earn rewards from the trades that happen in their pool. The protocol will decide the rewards earned by the LPs.
The main reason to provide liquidity to the pool is the slippage that occurs in each trade. The formula used to calculate the price represents a parabola. It means the shape of a parabola depicts that the slippage will be low for small orders and for large orders, the slippage rises exponentially.
The slippage issues will differ for various AMM designs. For example, you want to buy all the ETH in the ETH/DAI pool on Uniswap. In such a case, you should pay a higher premium for each additional ether. The formula used here is x*y=z. If one of the terms (x or y) is zero, the equation will not make sense. It means if there is zero ETH or DAI in the pool the equation will not work and you will not be able to buy it from the pool.
While providing liquidity to the pool, you need to consider the impermanent loss that occurred in the trade as well. Let’s understand more about impermanent losses.
Suppose you deposit some amount of tokens in the pool and its price ratio changes after you deposit them, then Impermanent loss occurs. The amount of loss depends on the size of the change that occurred. It means, if the change in price is large, then the loss will also be greater. But, if the price ratio is small, then the loss will also be negligible. So, Automated Market Makers work better for stablecoins or wrapped coins.
Impermanence presumes that if the assets revert to the same prices as it was during the original deposit, the losses can be restored. Conversely, if you withdraw your funds at a different price ratio than when you deposited them, the losses remain permanent.
Advantages of Automated Market Maker
- AMMs are decentralized as they do not involve gatekeepers excluding projects or users and eliminate the need for any central authority.
- The AMM protocols are permissionless as they do not require users to create specific accounts or perform any KYC checks. The user only requires a wallet address to interact with the protocols.
- The AMM Decentralized Exchanges do not involve any listing fees or admission criteria, as anyone can create a liquidity pool for a token.
- These DEXs have user-friendly interfaces.
Limitations of Automated Market Maker
- AMMs are exposed to hacks and vulnerabilities, where the users may lose their money due to complex smart contract interactions.
- Traders publicize their strategy to the world. It allows the front-runners to get their orders first and use them to advantage the legitimate users.
- Arbitrage traders are quintessential in AMM to correct the pricing of assets, but it results in an impermanent loss on many platforms.
Automated Market Makers (AMM) are the basic requirement of the DeFi space. Anyone can create markets seamlessly and efficiently. AMMs bring a large transformation to the cryptocurrency industry. AMMs are still in their development phase. There are various AMMs like Uniswap, Curve, and PancakeSwap with elegant design, but they have limited features and are working towards the betterment of the platform. In the future, you will have various innovative AMM designs coming to light. Ultimately it will lead to lower transaction fees, less friction, and better liquidity for each DeFi user.