An Introduction To Automated Market Makers
Or how formulas are helping create new markets
|Joel John||Jun 27, 2020||13||3|
I wanted to explore the token economics of ZRX and Kyber for this issue of the newsletter but given the rising interest in “yield”, I just thought it would be good to summarise how non-lending platforms are beginning to leverage idle capital to offer a return. In particular, we will explore Curve, Balancer and Uniswap for this piece. The three holds one thing in common - they are critical infrastructure to exchange one digital asset to another without requiring a centralised custodian. To understand their role, we will need to know why they matter first.
Note : This piece is written with people may not have historical context to DeFi or why any of this matters in mind. You may skip to the parts starting with Uniswap if you don’t need all that context building.
The Why And What
The trade of digital assets from one to another has been heavily reliant on trust. Remember the guy who sold his pizza for 10,000 Bitcoins? He had to ensure the person he was transferring Bitcoins to would not vanish with his coins. One way this used to happen in Bitcoin forums and IRC channels was by trusting the reputation scores of an individual engaging in a trade. This is common in all P2P trading. Factors like the age of the account and frequency of transactions are a core part of platforms like Craiglist and LocalBitcoins. It came with the risk of individuals scamming once the trust was earned. With the arrival of exchanges like Coinbase and Mt Gox, the need for trusting reputation scores vanished. Individuals could deposit on a centralised account and trade with one another. However, custodial risk came along with it. As we saw with Mt Gox, the custodial risk of depositing with a central party is quite high.
As the number of digital assets in the ecosystem rose with developers increasingly issuing their tokens, centralised exchanges became gate-keepers of liquidity. It used to be common for exchanges to demand over a million dollars to list a token. “Value-added-services” like market-making for the asset or sending e-mails to their user-base used to be sold. The challenge with this is that it put teams with lesser resources at a disadvantageous position. While centralised exchanges have played their role, it became impractical over time to rely on them for go-to-market. As the number of digital assets in our ecosystem increases in the form of NFTs, personal tokens and other representations of value on-chain, it will become necessary to have infrastructure that enables the exchange of one asset to another without a central party. This is where automated market makers and liquidity pools play a role. It is about replacing the gate-keepers with lines of code.
An automated market-maker makes it possible to list and exchange digital assets without the help of an order-book. Unlike decentralised exchanges - there is nobody putting in ask and bid orders for an asset. A formulaic approach is used to determine the price of an asset. What this means is the price of the assets in an automated market-maker product moves only when a trade occurs and as such may be less susceptible to external manipulation. For assets such as Ethereum that are also listed on centralised exchanges, occasionally the prices may diverge from what it is on an exchange. In these instances, it becomes profitable to arbitrage and bring the price on the AMM to parity. Automated market-makers are crucial as one could bootstrap liquidity with fewer resources at play and as the name suggests - without a market-maker. Products like 0x and Kyber work as there are incentives for people to make trades on them. Automated market-makers on the other hand incentivise those that commit to providing liquidity (as idle assets) with yield that comes as a result of trading fees and token rewards.
In the context of exchange-related yield solutions, there are three primary projects to know about - Uniswap, Curve.fi and Balancer. Each of them has its incentive mechanisms as we will see shortly. But before we dive into that, there are two concepts to be aware of.
1. Liquidity Pool - Consider this the total of assets that have been provided to a platform like Uniswap to enable users to trade one asset to another. It is the combined balance of user-deposits from individuals looking to create yield. The larger the size of a liquidity pool, the more likely that it can absorb large trades in short periods. This matters as one of the key criticisms of decentralised finance today is the inability to exchange over $100,000 worth of a digital asset to another without what is referred to as slippage. Slippage can be described as the difference in the price you were hoping to receive and the one you actually paid for an asset while trading it.
2. Impermanent Loss - In providing digital assets to platforms like Uniswap, there is the risk that your asset is unable to trade back to its initial value and that means you take a loss by partaking in the liquidity pool. The reason for this is explained further below in the context of each platform. But here’s what you need to know for now. Impermanent loss emerges from a situation where traders have no incentive to take a trade - leading to those that provided an asset to a liquidity pool in hopes of generating a yield losing money. They are primarily the result of a situation where an asset trades at a discount on a decentralised platform in comparison to what it is being traded at on a centralised exchange. For more on the concept of liquidity pools, I suggest reading this article by Pintail.
3. Liquidity Mining - The act of providing assets to a market to receive rewards that may be denominated in the platform’s tokens. The individual providing the liquidity takes on the risk of the assets provided fluctuating in price but has the benefit of selling reward tokens for dollars and maximising yield. This was common in certain Asian exchanges in 2018. Sadly, since the immediate response of anyone receiving these reward tokens is to sell, the price trends downwards over time.
With those three in context - let’s look at how the prominent automated market-makers of the industry work and what incentives users have.
Uniswap runs on a simple equation that follows the model of x*y=k. Where K is a constant. In a hypothetical situation, consider a pool that has been seeded with 50 Ethereum and 10,000 USD and K to be constant at 10,000. Y here will be the price of the asset.
Assuming x is the supply of Ethereum (50), Y will be the price at which ETH is traded.
In this case that will be 10,0000/50 = 200 as we have k=10,000 as a constant. If someone comes and buys Ethereum, they will remove Ethereum (x) and add to the dollar amount in the pool.
Assume they purchased two Ethereum at 200. This will make the x value 48, and change the value of y. Since the value K here is a constant, the price of Ethereum will need to change for it to be the same. To calculate this - we consider 10,000 / 48 = $208 to be the new price.
Similarly, in the next trade, if someone decides on selling a huge amount of Ethereum, the supply of Ethereum in the pool will increase. Assume someone wishes to sell 7 Ethereum after a while. Total ETH on the pool will be 48 (from previous balance) + 7 = 55 ETH. Since x here is now 55, there will need to be a change in the value of y (price) to reflect the new supply and demand.
Since k is 10,000 , we divide it by 55 to receive the new price. In this case that would come to $181. The supply of dollars in the pool now would be 10,400- (7*181) = $9133
As you can see, an algorithmic approach to price discovery has its advantage in the sense that it can discover price without an order-book in the way a centralised exchange does. It also makes manipulation less likely as you cannot see the orders of other traders in these instances. The challenge here is that price swings wildly if the amount of ETH or dollars in a liquidity pool is not high enough. The high volatility is part of what makes Uniswap risky. More importantly, those providing liquidity to a pool can stand to lose their yield in a pool if a large order moves the price in one direction and new trades don’t replenish the pool. I suggest exploring this paper for more on arbitrage opportunities on Uniswap. The critical difference between Uniswap and Curve is that in the former, liquidity is split across a wide variety of assets which can often lead to pricing inefficiency. On Curve in contract, it is concentrated on a handful of assets that are primarily stablecoins at price-points that are within a few percentage points of $1. Tokens like UMA protocol have begun issuing directly on Uniswap as it allows the market to determine the price of an asset without the centralised exchanges getting involved for hefty fees.
Incentive Mechanisms in Uniswap: Uniswap charges a 0.3% fee on all trades that occur through the platform. When an individual redeems their pool tokens, they receive a part of the fees generated in proportion to the amount of the pool they seeded liquidity with. The challenge here is fees generated are entirely reliant on the number and size of trades that occur through the automated market-maker. If there is a shortage of trades occurring on the platform, there may be no incentive for individuals to provide liquidity to the platform itself.
If you could remove the high volatility of assets on Uniswap and exchange solely between stable currencies, then you could stand to benefit from the fees while reducing the probability of impermanent losses. Curve.fi focuses specifically on this philosophy. Individuals can add liquidity in stable dollars, enable the trade of different pairs of USD (eg: DAI, USDT, USDC) and swap between them. Since they all trade more or less around $1, the losses that occur are lower due to impermanent losses are lower due to lower volatility. The ‘brilliance” here is on focusing on the stability of the asset and volume. Curve is routinely able to absorb volumes in the hundreds of thousands of dollars with relatively low slippages due to the large liquidity pools it has. More importantly, since the platform primarily focuses on stablecoins, it needs to give liquidity only around a few percentage points of $1 and concentrate much of its liquidity on dollar-denominated assets. As you can see, the bulk of the volume has come from stablecoins and more recently between different variants of wrapped Bitcoin.
Chart Source : Curve.fi
Incentive Mechanism in Curve: Curve has a 0.04% fees associated with each trade on it. This is distributed to those that provide tokens to offer liquidity on the platform. Unused tokens in Curve are also converted to cTokens (compound tokens) to receive yield from providing loans on the platform. This ensures users receive a base interest fee (from Compound) and an additional return from market-making that occurs on Curve itself. There have been mentions of a token launching, but the specifics are not released yet.
Balancer is more interesting as it allows individuals to have a mix of tokens allocated to a pool. They describe themselves as an ETF turned on its head. Instead of paying traders a fee to manage a pool, Balancer makes it possible for individuals to earn on providing liquidity to a pool. In other words - they determine the amount and mix of assets they would like to hold and receive a fee for providing it to a pool. While the formula behind Balancer is slightly complicated to summarise in this piece, here’s how it differs fundamentally.
Instead of just two assets, Balancer is able to take on a mix of assets. This means a portfolio that has been constructed by someone looking to hold can be absorbed by the system. According to their FAQ, the maximum of the mix is at eight as of now.
Balancer allows custom pool balances. What this means is someone with a substantial amount of token “x” looking to provide liquidity in ETH, can make a pool that is balanced 80% in token x and 20% in ETH. Making it easier for altcoins to offer a liquidity mechanism without requiring a centralised exchange.
Fees on Balancer can be set as per the liquidity provider’s provisioning. It ranges from 0.0001% to 10%.
The incentive mechanism that is at play in Balancer is the yield that comes from the trading pool. All of the fees that is set by the pool goes back to the liquidity providers on Balancer as of now. This means individuals inherently have a predisposition towards having higher fees since it is a variable that can be set by the pool. If a pool has a very high fee individuals have no incentive to trade on Balancer as centralised exchanges will have a better fee offering. Therefore lower fees are incentivised in terms of token rewards given. The entire specification of their liquidity mining can be read here.
The traders on Balancer jumped over 20 times (~70 to 1400+) due to the token based incentives that kicked in. Balancer has over $40 million in volume so far. Source : Link
Why is Balancer all over the news? : Apart from the fact that Balancer is one of the projects that have shown traction and gradually tokenised themselves, there is the fact that the first tranch of balancer rewards have just gone out. Of the 100 million Balancer tokens that will be in existence, 25 million are allocated to founders and investors. Balancer has raised $3 million at an initial price of $0.6 per token. As of writing this, it trades at $13. Roughly 7.5 million Balancer tokens will be released over a year. In the past week ~435k tokens were issued to those providing liquidity over the past 3 weeks. High token price for Balancer means individuals can benefit from the tokens they resceive as a reward (sold on the market) and the yield on the underlying assets they provide. As we saw with Compound, this will be interesting as long as the price of the reward assets stays high.
What could be the future of AMMs?
Automated market-makers have been perfected slowly over multiple years and the recent push to decentralise governance through tokens has pushed for new levels of interest in them. A common theme we are seeing is the gradual push to releasing a token and allowing the community to have governance of the project itself. This works as long as the returns of governance (eg: fees) themselves are worth more than the opportunity cost of not doing so. What does this mean? Currently being a LP on Balancer would make sense considering the risks involved because of the high price of the token today ($13). However, as it goes lower - if the volume on the platform itself does not surge high enough to create sufficient revenue from the fees, it won’t be long before liquidity providers lose interest. As of writing this, cumulative revenue on Balancer is at $140k on a total volume of $40 million so far. If that figure does not grow over time, incentivised liquidity providers may leave the platform. The counter-argument to this is that since incentivised reward on AMMs like Balancer is proportional to the share of the pool an individual is providing liquidity to, the rewards one receives increases as other liquidity providers leave. The higher amount in Balancer token rewards will justify LPs to stay.
For now, it is safe to say that the interest in the underlying token itself is what is driving interest. For more established platforms like Uniswap, the volume has reached a large enough number to justify continued interest. For context Uniswap alone had $169 million in volume over the last seven days. That is over $570,000 a week to be distributed in fees. Since the figure is relatively high, individuals will be interested in how the governance of the platform will function. In other words - decentralised projects like AMMs will need high amounts in revenue to be able to justify premiums for their governance tokens. I would argue that this is a better model than traditional venture capital as it ensures dead projects with no revenue to show don’t last around as zombies on private money infusion for years. The fluidity of capital in DeFi would mean large liquidity providers move capital around to platforms with the highest yield at all times.
I am excited for the innovation this space could bring. The idea that you can mix in a bunch of assets and have a market running for it with just code and formula could be used in a mix of ways. For one, personal tokens are already being traded on Balancer. In the future, I won’t be surprised to see tokenised intellectual property rights and income share agreements being listed on platforms like Balancer. They are fundamentally kicking out the middlemen that historically connected issuers to markets. Almost like how Wordpress made a publication as easy as a few clicks and took power away from newspapers. Will this be abused? Yes. People stand to lose money. However, as with most innovations that disrupt the middle-men, this may do more good than evil over time. I wait observing patiently for proof of the same.
I will see you guys on Monday with more.
Have a pleasant weekend
1. Matteo Leibowitz has curated a brilliant dashboard for Balancer on Dune Analytics
Chart shared with his permission.
2. Daryl Lau from Coingecko was kind enough to clarify some of my queries
3. Kerman Kohli is the man behind the video explaining Curve
Highly suggest following all of them.
1. My previous post said $4.5 million in Compound rewards go out each week. Gaurav Dahake pointed in a comment that the figure is $450k. I have corrected the figure on the Substack to reflect the same. (I love it when my readers do that!)
2. This is a brief explanation of the primary automated market-makers in the industry today. Each of them have complexities and nuances that may have not been captured here due to the nature of this piece. If you have any queries or corrections, just drop me an e-mail.
Avichal Garg from Electric Capital is looking for a designer to work on a privacy-centric app focused on freedom of speech. They may even be open to remote work. If that is something of interest to you - slide into his DMs here.
Consider sharing this with a friend if it helped you understand what all the noise around automated markets are. I would deeply appreciate it.
Subscribe to this newsletter so I can notify you each time I write something new. I do one push-up each time someone signs up.
Have I written something ridiculously wrong? Know a new field AMMs can break into? Let me know in the comments. Or just say hi.. I guess.