Oracleless Lending Protocol on Uniswap v4

Oracleless Lending Protocol on Uniswap v4

 Uniswap recently announced v4 which opens DeFi to many new exciting possibilities. Instadapp has been working on a concept of how to make the most advanced borrowing protocol on top of Uniswap v4, Uniswaps introduction of  "inverse range orders" changes the game!

 Uniswap's unique liquidity range model enables a lot of unique characteristics, this is multiplied with the introduction of inverse range order, which is similar to a negative position, by matching a users LPs with an inverse order. The inverse order acts as a sort of ‘reserve’ which in conjunction enables an oracleless position.

 So what does this mean? Well that means we can use Uniswap v4 LPs to build a new kind of lending protocol with some unparalleled features and efficiencies: Here are some of the advances this solution will offer:

Features:

  • Flexible Liquidation Threshold (LT): Users can decide their LT from 50% to 99%. Borrow rate will be proportional to their LT. (Yes, you heard that right up to a 99% LT)
  • Flexible borrow rate: Borrow rate will be proportional to LT. Safer users pay less to borrow than their riskier counterparts.
  • Boosted income to Uniswap’s LPs: Uniswap LPs created will earn additional income from liquidation penalty rate from borrowers.
  • Oracleless protocol: There is no oracle required, therefore removes all the risks related to oracle manipulation. This is also what allows the protocol to provide 99% LT.
  • 0% liquidation penalty: there is no liquidation penalty instead position ‘decay’ losing collateral overtime, this removes any incentives for manipulators.
  • Liquidation penalty rate: Whenever the user's borrowing position gets into liquidation state (aka inverse range order gets in range) the position starts to pay liquidation penalty rate to LPs.
  • Transient Liquidation: If the price of collateral goes down temporarily, but is able to return to its original price, the position's original value is returned i.e minimum losses will occur through liquidation penalty rate for the time being the position was under water.

These kinds of features are the sorts of advancements we’ve only dreamed about. Let's break it down how this all works and why it works so well with Uniswap v4.

Uniswap v4 Hooks

 Uniswap v4 introduces a feature called "hooks," enhancing the functionality of its two-token pools. These hooks allow for the inclusion of code before and after swaps or during liquidity updates. While the core operation of Uniswap v4 remains largely similar to its predecessor, v3, the introduction of hooks significantly amplifies its adaptability and functionality.
 This facilitates the development of innovative use cases and provides easier access to Uniswap's extensive ecosystem. Consequently, liquidity providers (LPs) can more seamlessly integrate with additional protocols or construct more intricate use cases. LPs are alive! LPs are no longer stagnant fodder for the day that the market price falls into its range, LPs can both provide liquidity and participate in other DeFi protocols.

Lenders

 Lenders are similar to participants in any other money market protocol. Their role is to lend their tokens, which can then be borrowed by borrowers. It's important to note that lenders are not LPs (liquidity providers).

Liquidity Providers

 Liquidity Providers generate range orders as they would normally, however will have a higher APR than holding a normal LP through the additional fees generated through liquidation penalty rate from at risk borrowers.

Note: With Uniswap v4. Out of range LP’s liquidity can also be simply lent out to further increase the earnings of LPs but we will keep this use case minimum for this blog post & focus on the borrowing side.

Borrowers

 Borrowers will supply and borrow against any two token Uniswap pair, for example supplying ETH and borrowing USDC (or supplying USDC & borrow ETH). When the user borrows against ETH, an inverse range order of ETH is created on the USDC side of liquidity and vice verse. The borrower will also be able to set the Liquidation Threshold of their position, higher threshold creates more narrow price ranges meaning a drop in price shifts between ETH/USDC faster and incurs higher penalties when the position is in liquidation state.

Note: Borrowers UX remains super simple. They only have to decide borrow rate or liquidation threshold and the protocol decides the range for inverse range order.

Oracleless Lending Market

 As we mentioned before, Uniswap v4 borrowing introduces inverse range order. Whenever a user creates a borrowing position, it creates an inverse range order using borrower’s collateral which acts as a liquidation range for the borrower. As collateral token price falls w.r.t to debt token, the inverse range order starts to shift from collateral to debt token. For example, if ETH goes down and the inverse range order of ETH collateral comes in range, it starts to shift to USDC while for LPs it works as usual their USDC in range starts to convert into ETH. Hence for LPs, their final position remains same as it would be without inverse range order as they get partially filled by inverse range order rather than from external swaps and start to earn a penalty rate on that reserved liquidity.

Inverse range order

 Borrowers can determine their own LT (Liquidation threshold) this also determines the borrow rate. The inverse range order gets created according to the user's liquidation price. Higher LT creates thinner inverse range order while lower LT creates wider inverse range order.

Net Liquidity

 Net liquidity is the liquidity after offsetting LP’s range order (positive liquidity) with borrower’s inverse range order (negative liquidity). This remaining liquidity is used on Uniswap v4 pools for traders to trade on.

Additional Insights

There are a few novel and unique scenarios we can address and provide some analysis for.

 For example what if someone attempts to manipulate the pool by filling the inverse range order, it will briefly push the borrower's position into the liquidation range. However, since there is no liquidation penalty, the manipulator won't receive any incentives. During this short period, borrowers will start paying a penalty rate, while LPs will start earning a penalty rate. Assuming a high penalty rate of around 20% and a liquidation state of 10 blocks (or 120 seconds), the total penalty incurred by the borrower will be 0.000076103%. Therefore, the manipulator will end up paying more fees on trades than the borrower's penalty.

 Market price changes can cause a position to fall into the liquidation state. If a position falls into liquidation due to a price drop, but returns to its previous values the position will incur minimal loss through penalty rate. We call this a ‘Transient liquidation,’ if the collateral price incurs a short ‘flash crash’ condition the loss may be near zero. If a position remains below the liquidation threshold the collateral will continue to pay the liquidation penalty rate.

 When LP's range orders is offsets by borrower's inverse range orders, can LPs still withdraw the liquidity?
Yes and no, LPs can withdraw excess liquidity (liquidity which is not reserved). No, not all LPs can withdraw liquidity at once. If some LPs withdraws the liquidity, the remaining LPs earnings will boost as liquidity will decrease but earnings from penalty rate will remain same, hence attracting more liquidity to be supplied in. Also, all LPs can instant withdraw if borrowers closes the position (removes their inverse range order) or if position decays more than the max limit.

 A borrowing protocol built on Uniswap v4 will bring LPs three different revenue streams: trading fees, penalty rate & lending the out of range liquidity making Uniswap an even more attractive protocol for liquidity providers.

Conclusion

 Uniswap's recent announcement of v4 has brought forth a world of exciting possibilities for the DeFi space. Instadapp has been diligently working on a groundbreaking concept to leverage Uniswap v4's unique liquidity range model.

 The efficiencies brought by Uniswap v4 lay the foundation for a groundbreaking lending protocol directly built on Uniswap LPs. With the potential to unlock higher earnings for liquidity providers and mitigating the risk of oracle manipulation, Uniswap v4 is the medium to develop the next generation of lending protocol.