# Uniswap V3 LP Leverage Yield Farming (ERC20)

Leverage yield farming is identified as one of the main use cases for users to deposit their Uniswap V3 LP tokens as collateral to borrow more ERC20 tokens on Para Space and add to their yield farming position. Without credit expansion, a leverage yield farmer would borrow the one or both assets (depending on whether the spot price is outside or within the selected liquidity provision range), deposit the borrowing into an Uniswap L3 LP position, deposit the LP token back to Para Space and collateralize it, then repeat the process a number of times to reach maximum leverage.
In such case, we calculate the credit limit, as the sum of all borrowing power the user can achieve through the aforementioned recursion of the series of transactions. Specifically, with the currently available borrow credit denoted by
$CR$
and the targeted Uniswap V3 LP token’s collateral factor denoted by
$CF$
, the amount of deposit and borrow for each repetition is projected in the table below:
Repetition
Deposit
Borrow
1
Supplied Collateral
$CR$
2
$CR$
$CR*CF$
3
$CR*CF$
$CR*CF^2$
$n$
$CR*CF^{n-2}$
$CR*CF^{n-1}$
Therefore, the credit limit (i.e. maximum amount of borrowing) can be calculated as the sum of all borrow amounts as projected in the table above when
$n\to\infty.$
\begin{equation} \begin{aligned} CR_{\max}&=\lim_{n\to\infty}\sum CR+CR*CF+CR*CF^2+...+CR*CF^{n} \\ &=\frac{CR}{1-CF} \end{aligned} \end{equation}
This means, for a user with currently available borrow credit of
$CR$
and
$CF$
determined given the Uniswap V3 LP token he chooses to provide liquidity to with the borrowed assets from Para Space, rather than leaving the user perform the series of transactions repetitively, we develop a solution for the user such that he can achieve desired leverage with one click.
Specifically, The user can choose to borrow any amount up to
$\frac{CR}{1-CF}$
of value. Such value will then be allocated proportionally to the two underlying assets of the LP position as calculated per eq. (3) and (4) on Uniswap V3 LP Token Analyzer page, such that all borrowing will be put into the user-defined Uniswap V3 LP position which is, in turn, deposited back to Para Space as the user’s collateral. Note the series of transactions are done through flashloan within one block.