What is the Optimal AMM Protocol for Fungible Tokens?

Pandichef
6 min readDec 9, 2020

--

To answer this question, I first consider two of the most popular AMM protocols in DeFi: Uniswap and Balancer. (I assume you’re familiar with Uniswap. If you’re not, here’s a good reference.)

The Balancer Protocol extends the Uniswap Protocol in the following ways:

  1. Allows unequal currency pair weights e.g., Balancer allows 80/20 liquidity pool splits whereas Uniswap LPs are always 50/50
  2. Allows up to 8 currencies in a single LP
  3. Allows LP creators to set trading fees (all Uniswap LPs charge 0.30% per trade)

The philosophy of Balancer is that users shouldn’t be shoehorned into 50/50 LPs. Rather, they should be able to construct an LP based on their cryptocurrency preferences.

While this flexibility sounds great in theory, the reality is that Uniswap has thrived and Balancer has struggled to gain momentum (see Figure 1). Why?

Monthly Volume (USD), as of December 7, 2020

To be sure, there are some product design and business issues at play. First, Uniswap has the first-mover advantage. (Note that LP size is a key factor in minimizing price slippage). Secondly, Uniswap’s UNI-mining model during Q3 2020 was wildly successful in capturing people’s attention. Finally, Uniswap is just easier to understand conceptually. That said, there are some fundamental reasons for this discrepancy as well. The rest of this article explores those reasons.

Before addressing the architectural choices of Balancer specifically, we should ask a more fundamental question: Should LPs prioritize lower fees/slippage to incent traders or higher fees to incent liquidity providers?

While product design and UX choices are critical in the short term, product/market fit is what counts in the long term. Balancer has two types of users: trader and liquidity providers. Traders are driven by price; liquidity providers are driven by return-on-investment (“ROI”). Let’s consider these separately.

Traders primarily seek the best price (net of fees). There is little more to say about this. Traders generally won’t use a platform that has inferior pricing. (Of course, traders also value transaction speed, good APIs, consistent liquidity, etc. But I’m ignoring these secondary factors for this discussion.)

On the other hand, liquidity providers‘ calculus is a bit more nuanced. In a world without market risk, liquidity providers would always seek the highest ROI investment and every portfolio would have the one investment that has the highest ROI. However, in a world with market risk, liquidity providers seek diversification in accordance with Portfolio Theory. More specifically, the required rate of return for an investment is driven by the following equation:

An Asset’s Required Rate of Return > Rf+ β⋅(Rm-Rf)

where Rm is the cost of equity capital of the “market portfolio”, Rf is the risk-free rate, and β is a factor which is proportional to an asset’s correlation with the market portfolio. If this equation is true for an LP, then it will have some allocation in the market portfolio i.e., its addition to other assets improves the overall risk-reward tradeoff. Moreover, increasing an asset’s ROI only gradually increase that asset’s overall portfolio allocation. In general, there is no return that would compel an investor to put 100% of her portfolio into a single asset.

We can simplify this equation further by noting that the market correlation of a cryptocurrency LP (and hence its β) is probably very close to 0. Hence,

An LP’s Required Rate of Return > Rf

In other words, investors don’t need a huge return to invest in LPs. Rather, an LP’s design should focus on getting the best price for traders that still satisfies the above inequality.

So if trade price is the important variable to optimize for, let’s consider how Balancer weights impact this metric. The Balancer Whitepaper demonstrates how the AMM math works.

Say we have a 2-token LP on Balancer with weights w and 1-w. Let m be the quantity of one token in the pool and n be the quantity of the second token. For example, think of m as USDC and n as WETH.

At t=0,

Intuitively, the size of the LP should also impact the slippage. So let’s assume the LP size (denominated by the first token m) is exogenous i.e.,

or

Now, let’s imagine someone wants to trade using this LP. Per the constant product formula of the Balancer AMM protocol, after the trade (t=1) we have

Let’s also assume that the trade size as a percentage of the LP size (α) is exogenous i.e.,

or

The execution price of a trade is

Therefore,

We can use these equations to plot how slippage is impacted by trade size and LP weights (see figures 1 and 2).

Figure 1
Figure 2

This analysis shows that any weight other than 50/50 adversely affects trade execution. Moreover, we always want LPs to be as large as possible relative to trade size. And here lies the problem with Balancer.

Say we have a $200mm LP on Uniswap that’s 50% WETH and 50% USDC and we want to trade $10mm. According to the above charts, the slippage will be 11%.

On Balancer, however, this $200mm might be split into two different pools. For example, say we have a $100mm LP with 90% WETH and 10% USDC and another with 10% WETH and 90% USDC. The Balancer Smart Order Router will be forced to chose one of these two pools. Whichever pool it chooses, it can be shown that the total slippage jumps to 89%! There is no way this could compete with a traditional order book exchange.

So what’s good about Balancer? Well, an LP with 3 evenly weighted tokens is definitely better than one with just 2 tokens. Why? Say you have 3 pairs, USDC, WETH, WBTC. On Uniswap, this might be

LP1 on Uniswap: $200mm of USDC-WETH

LP2 on Uniswap: $200mm of USDC-WBTC

LP3 on Uniswap: $200mm of WBTC-WETH

Any $10mm trade would be 5% of the total LP size.

On Balancer, this could be a single LP:

LP1 on Balancer: $600 of USDC-WETH-WBTC (in even weights)

Now, the total liquidity size for any pair is $400mm and a $10mm trade would be 2.5% of the total LP size.

We see that the Balancer protocol has some pros and some cons. So what might the optimal AMM design look like? Basically, it’s a platform with one giant LP where all ERC-20 tokens have the same weights.

As a practical matter, you can’t expect users to go out and build a portfolio that’s evenly weighted with dozens or hundreds of tokens. So you’d need some kind of mechanism that allows users to contribute whatever they happen to own into this megapool and another mechanism to incent users to contribute tokens that are in short supply. Structuring this correctly isn’t trivial, but that could be the ultimate Uniswap-killer.

References

https://duneanalytics.com/hagaetc/dex-metrics

--

--

Pandichef
Pandichef

Written by Pandichef

Creative Director at PandiFi

No responses yet