Supporting Functions

Given the potential use cases described on the previous page, there are several key supporting functions that need to be developed and used in conjunction with the borrowing collateralized by Uniswap V3 LP position.

Function 1: Position adjustment

To encourage long-term staking of LP tokens onto our platform, we facilitate the add/subtract liquidity as well as adjust the LP range on the LP position used as collateral on our platform. The adjustment can be done with the following steps through flash loan:

  1. Withdraw the concerned LP token from our protocol’s Uniswap V3 LP pool;

  2. Redeem such LP token from Uniswap;

  3. Compose a new LP position that fulfills the adjustment requirements of the user;

  4. Deposit such LP back to the platform and collateralize.

Note if the loan collateralized by the new LP token triggers instant liquidation of the loan, the transaction is reversed.

Function 2: One-click leverage yield farming + One-click repay

As described in Use Case 2, the user can collateralize his LP position to borrow the two underlying assets and add them to his existing LP position. Without a one-click solution for it, the user has to calculate exactly how much of the two assets he can borrow and in what ratio, then open another LP position with the borrowed assets, stake the LP token back to our platform, then repeat the process. Realistically speaking, this is very gas inefficient not to mention that the user end up with a series of LP positions.

With a one-click leverage yield farming solution thanks to the flash loan, the user can:

  1. Achieve the desired leverage (subject to maximum leverage calculated per the two assets’ collateral factors) with one click, no repetitive transactions are needed; and

  2. All borrowed liquidity is aggregated into one LP position, so it’s easy for the user to manage his positions.

Similarly, one-click repay is developed to expedite the closing of loan positions. Specifically:

  1. The LP position will be withdrawn from Uniswap;

  2. The withdrawn assets will be used to repay loans; and

  3. If the balance of one asset is not enough to repay the desired amount of repayment, the other asset can be swapped to repay.

Last updated