Jun 07, 2021 | Dan Robinson
Contents
Uniswap v3 (paper) allows liquidity providers to provide custom amounts of liquidity in selected price ranges. This unlocks tremendous capital efficiency gains for liquidity providers who can manually adjust their exposure.
But this feature also greatly expands the design space for automated liquidity provision. Any static AMM can be approximated by a custom liquidity provision strategy involving multiple positions on Uniswap v3.
We can visualize the liquidity provided by any AMM as a curve in "tick space." Applying this method to existing AMMs like Curve, Balancer, and the logarithmic market scoring rule (LMSR) shows how those AMMs concentrate their liquidity across different prices, revealing the unique "liquidity fingerprint" corresponding to each of those AMMs.
Follow-up work will explore how strategies like this can be efficiently and accurately approximated in practice on Uniswap v3.
This paper assumes you are familiar with automated market makers between two assets
For ease of comparison, let's define the constants in each of these formulas in terms of
We will use
In Uniswap v3, anyone can create a position to provide some amount of liquidity—
As shown in the Uniswap v3 whitepaper, this is the trading function that describes the relationship between the reserves of a single Uniswap v3 position while its liquidity is in range:
If a strategy involves providing liquidity in multiple positions, these definitions defined in terms of total reserves will no longer apply.
It would therefore be helpful to find a local definition for liquidity, that describes liquidity in its conventional sense: the pool's resistance to price impact when someone is trading with it.
As shown in Appendix A, it turns out that
How can liquidity providers use Uniswap v3 to simulate a custom curve? One intuitive way to do so is to create many different positions, with a custom amount of liquidity in each:
The more narrow these "slices" are, the more accurately this will simulate the target curve. For this post, we will treat tick space as infinitely divisible, and imagine that a liquidity provider is allowed to provide any arbitrary function
Graphing the
The behavior of the reserves in Uniswap v2 can be described with the following equation:
The liquidity fingerprint of this reserves curve is a flat line:
To simulate this curve in Uniswap v3, we can simply create a single position with liquidity
The formula used by Curve is described in the StableSwap whitepaper. That paper first describes its invariant in terms of a constant amplification factor,
This reserves curve (with Uniswap v2 shown for comparison) looks like:
It turns out that with a constant
Curve in fact uses a non-constant
The reserves in a two-asset Balancer pool can be described by this invariant, where
In liquidity space, this corresponds to an exponential function:
Intuitively, when asset
The logarithmic market scoring rule (LMSR) is one of the first and most widely studied automated market makers. The two-asset case is best known for its application to a binary prediction market (i.e., between YES and NO shares), where the price of the two assets (in cash) adds up to 1.
Typically, LMSR is described in terms of the rule for market-making between each asset (YES and NO) and cash. We could instead describe it in terms of the rule for market-making between one asset and the other. If we do that, then as explained here, the reserves can be described by this invariant:
The reserves curve for this formula looks like:
When transformed into tick space, the liquidity fingerprint of this curve is shaped like—you guessed it—the hyperbolic secant function:
As you can see, LMSR concentrates more of its liquidity closer to tick 0 (the price of 1). In prediction markets, when YES and NO shares are equal, that implies a probability of 50%. So LMSR concentrates more liquidity to support probabilities around 50% than to support more extreme probabilities.
Appendix B shows how this liquidity fingerprint can be computed.
This paper showed how several popular AMMs could be simulated using Uniswap v3, and showed how graphing curves in liquidity space provides insight into their unique ``liquidity fingerprints". However, there are several limitations that need to be overcome before Uniswap v3 can be used to simulate most of these AMMs:
Future work will demonstrate some techniques for getting around these problems using numerical approximation, as well as some smart contract tricks to make custom liquidity provision much more gas-efficient.
We can show that in Uniswap v3, the derivative
We start with the trading function (while the position is in range):
Solving for
Solving for
Finding
Solving for
Substituting for
Solving for
Taking the derivative:
This appendix shows how to go from an AMM formula defined as a trading function to a liquidity curve in tick space. We'll use LMSR as an example.
As shown in Appendix A, liquidity can be defined as the rate of change of
We start with the AMM defined as an invariant:
Solving for
Taking the derivative and negating it to get the price (of asset
We then need to find the formula for that same price, but as a function of
Next, we invert this to find
Then we take the derivative with respect to
Finally, we convert to tick space by rewriting this as a function of tick index
Disclaimer: This post is for general information purposes only. It does not constitute investment advice or a recommendation or solicitation to buy or sell any investment and should not be used in the evaluation of the merits of making any investment decision. It should not be relied upon for accounting, legal or tax advice or investment recommendations. This post reflects the current opinions of the authors and is not made on behalf of Paradigm or its affiliates and does not necessarily reflect the opinions of Paradigm, its affiliates or individuals associated with Paradigm. The opinions reflected herein are subject to change without being updated.