Published on

Uniswap v3 LP positions as collateral


One of the great aspects of permissionless smart contract platforms is undoubtedly composability. This essentially makes financial engineering like open source software development: it's possible to use already deployed protocols as building blocks to experiment and create new products. In this post, I'll go over such a combination, namely discuss some of the implications of using Uniswap v3 Liquidity Provider positions as collateral in on-chain lending protocols.

Uniswap v3: reminder

First, let's recall how Uniswap v3 works at a high level. Someone who wishes to provide liquidity on a certain market, say ETH-USDC, or in other words be a market maker for that market, can do so by specifying two things:

  • A price range in which they want their liquidity to be active.
  • A fee tier, currently limited to either 0.05%, 0.3% or 1%.

Once they have done so, and their position is aggregated with the capital of other market makers, the total liquidity will behave in each price range similarly to a truncated constant product market maker as illustrated in Figure 1 below. For more detailed information, I encourage readers to read the relevant whitepaper by Uniswap Labs. If you're not familiar at all with automated market makers, this blog post covers the basics pretty effectively.


Figure 1. Shape of the trading function in a certain price range for the Uniswap v3 market maker.

All this is to say that there is an interesting side effect: every position from a liquidity provider (LP) is unique. When they add liquidity to a Uniswap pool, a non-fungible token representing their share of the liquidity is minted. At a glance this could be somewhat of an issue if our goal is to use this in lending protocols: how can we standardize the use of such LP shares as collateral?

This sounds a bit scary because we're used to NFTs associated with artworks or representing property rights, and the challenge is to value them so that the protocol remains solvent. In the case of Uniswap v3 LP shares though, this is not a problem because at any point in time, every single share has an unambiguous, definite value.

Uni v3 LP tokens as collateral: high level architecture

At any point in time, LP shares are composed of a set amount of each underlying asset of the pool. That is, if the LP were to withdraw their liquidity from e.g. the USDC/ETH pool, they would get a specific amount of USDC and ETH.

If we take a look at the Uniswap periphery contract managing liquidity providers position, we can see that each position is represented by a struct as follows:

    struct Position {
        // the nonce for permits
        uint96 nonce;
        // the address that is approved for spending this token
        address operator;
        // the ID of the pool with which this token is connected
        uint80 poolId;
        // the tick range of the position
        int24 tickLower;
        int24 tickUpper;
        // the liquidity of the position
        uint128 liquidity;
        // the fee growth of the aggregate position as of the last action on the individual position
        uint256 feeGrowthInside0LastX128;
        uint256 feeGrowthInside1LastX128;
        // how many uncollected tokens are owed to the position, as of the last computation
        uint128 tokensOwed0;
        uint128 tokensOwed1;

So for each unique position, we can at any time query its price range in the form of tickLower and tickUpper, and the total amount of liquidity provided between these ticks. To get the actual amounts of tokens, the Uniswap contracts already contain functions, namely getAmount0Delta() and getAmount1Delta, which return what we're looking for if given the current price, the total liquidity of the position, and the range of the position.

Now we have every information we need to get the actual value of that LP position at a given point in time. For example if we are looking at a position in a USDC-ETH pool composed of tokens0 and tokens1 USDC and ETH respectively, the value of that position denominated in USDC is simply token0 + price*token1. We then add the value of the fees the user hasn't collected. We don't even need an external oracle for the price, as we can simply use the integrated TWAP from the Uniswap contracts (and not just the current price for security reasons).

Once we have a function that does this for us, it can be used to estimate both the borrowing power of a user using that LP share as collateral, and monitor the health factor of their position. If the position becomes liquidatable, the liquidation logic needs to be changed slightly compared to protocols like Compound or Aave to accomodate the collection of accrued fees. After the liquidator calls liquidate(), the following needs to happen in that order:

  • Burn an amount of liquidity and/or collect the amount of uncollected fees needed to cover the liquidation penalty.
  • Transfer the tokens obtained from the burn to the liquidator.
  • The user is left with a position that has the same price range, but lower liquidity, and the remaining fees if any.

Payoff of liquidity providers

Some implications of borrowing against LP shares are discussed in a paper from Chitra et al. from the perspective of the safety of the concept and the capital efficiency for the borrower. In general, borrowing against LP shares also allows liquidity providers to boost their market making ability and thus earn more fees with the same initial capital, naturally in exchange of increased risk. This is what we will discuss below.

In the case of Uniswap v3 LP shares, the situation is a bit special compared to some other automated market makers because of the uniqueness of each position and the fact that it only covers a certain price range. This seems to give rise to a completely new financial tool. If we think about it, LP shares covering a definite price range can be thought of as a finite collections of limit orders in a traditional orderbook, which is made apparent when putting an actual orderbook with the representation of liquidity distributions in Uniswap v3 as in Figure 2. To my knowledge, it is currently not possible to use such orders as collateral in any exchange, even centralized.


Figure 2. Example of Uniswap liquidity distribution from the Uniswap paper vs. the Binance ETHUSDT orderbook. We can see why Uniswap v3 is very similar to an orderbook.

When a LP adds liquidity to Uniswap in a certain price range, they are essentially betting that the price will remain within a certain price range for the duration of the liquidity provision. For example when providing to the USDC/ETH pool, if the price of ETH goes down too much, the liquidity provider is eventually left with ETH only and exposed to downside risk without any fee compensation. If the price of ETH goes up, they don't make any loss denominated in USD, but they give up part or all of the upside. In a way, that payoff is very similar to that of writing a put option where the strike price is the lower bound of the price range and the premium is related to the the accumulated fees while the price is in the range, but there are two important differences:

  • There is no expiry: the LP position can remain open for an indeterminate amount of time.
  • The maximum profit is not bounded: the price could theoretically stay in the range forever and fees would keep accruing to the LP. The profit of writing a put option can never exceed the premium.

So the owner of a LP share with a certain price range is making a bet that the price will move back and forth a lot within that range, with high volume, and they get paid fees for as long as it does. This is a more customizable version of writing a put independent of the options market, with potentially much higher upside.

Borrowing against an LP share creates an intriguing result, because if we have the ability to borrow, we have the ability to leverage: we can use an LP share to borrow some amount of an asset, and use that asset to provide more liquidity in the same pool (neglecting implementation details). So we have created a trading strategy that allows to make a leveraged bet on the price staying range bound!

Leveraged LP position

To get a sense of the kind of returns one could get with such a leveraged strategy and the associated risk, we can walk through a specific example of a leveraged LP position.

Let's assume that the price of 1 ETH is currently 2600 USD. Alice has an initial capital of 100K USD that she would like to put to work by providing liquidity in a +/- 10% range, corresponding to a lower and upper bound of 2340 and 2860 respectivey. In other words, she believes that the price of ETH will stay within that range for a while and wants to generate an income from this. In order boost her income, she leverages that capital 2x by using the LP shares as collateral to acquire more LP shares, and rinse and repeat until she has 200K USD worth of capital being used to LP. This corresponds to a collateralization of 200% (the ratio corresponding to a given leverage LL is such that RR1=L\frac{R}{R-1} = L (for more on this, see this article on the maximum leverage one can obtain with Maker).

Estimating the fees based on data from the past 5 days at the time of writing this article and using the Flipside Crypto calculator as shown in Figure 3, providing liquidity with her initial capital only would have yielded ~ 683 USD of fees per day, compared to ~ 1366 USD with this leveraged strategy. Note that the collected fees are simply multiplied by the leverage factor, as long as the total amount of liqudity provided is small compared to the total liquidity in that range. If we turn this into an APR to be more friendly to crypto apes, that rounds up to 500% APR!


Figure 3. Cropped view from the Flipside Crypto simulator output for the previous assumptions.

An interesting side effect is also that thanks to the leverage taken by Alice, the available liquidity on Uniswap is higher than if she would have added liquidity with just her initial capital, resulting in better prices for users because of lower slippage.

The elegance of that design is that any user would be free to choose their own range and leverage ratio, tuning whether they would like to have an incredibly high income in exchange of higher risk, or conversely.

At this point, you are probably interested in knowing what the risk exactly is considering the kind of magnificent returns I exemplified. As with any leveraged strategy, there are two components to that risk: magnified losses if the value of the LP shares goes down, and liquidation risk. In the no leverage case, providing liquidity in a range limits the downside compared to just holding ETH. Indeed, because Alice's position is composed of a mix of ETH and USDC in this example, if the price starts within the range and moves down by X% while staying in that range, the value of the LP shares go down by strictly less than X%. However because we are leveraged in the above example, the value of our balance might go down by a higher percentage. The liquidation risk on the other hand is directly proportional to the variation in value of the LP share. Since we started with 200% collateralization, and assuming a minimum collateralization of 150% on lending protocol being used, the value of the LP share collateral would need to go down by 25% to cause a liquidation, so the price of ETH would have to go down by a bit more than this. All in all, when using this strategy, one has to be very confident that the price will stay range bound, or at least go back in the range eventually without hitting the liquidation threshold. An example of a good price action for this strategy is shown in Figure 4.


Figure 4. This kind of price action is great for Alice in our example above.

Even if the user is extremely confident that the price will not go down, this income doesn't come for free: because we're providing liquidity, we're exposed to what has been called "impermanent loss" within our range, meaning we're making less than what we would by just holding ETH with the same leverage, and we're giving up any upside above the high end of our range. Because we're only providing liquidity to a narrow range compared to Uniswap v2 for example, this effect is significantly magnified.

Finally we note that the above reasoning can be mirrored if the user borrows ETH instead of USDC to leverage their LP tokens, in which case the risk of liquidation would come from the price of ETH going up instead of going down.


Leveraged liquidity providing allows users to elect to receive a significant revenue from their capital in exchange for giving up on the upside as well as being exposed to magnified downside risk, though the risk is still lower than by holding only the risky asset of the pool (ETH in our case). It is a passive income generating strategy for people who believe that the price of the asset will stay in a certain range for some duration.

As a side effect, the Uniswap pools for which this strategy is available may get deeper liquidity around the current price, improving the UX for traders.

Although it might be possible to replicate this strategy's payoff using a complex portfolio of options, this would likely incur high rollover costs, and assumptions on the liquidity and choice in options market would probably be high (choice in expiry dates, choice in strike prices). Thus, it seems that this is a novel financial product emerging from the composability of permissionless decentralized finance.

Thanks to Killari for feedback on the first versions of this article.