Leveraged Liquidity Providing

Liquidity Providers who are familiar with the risks and complexity of LP positions may be interested in extracting larger returns through leverage. By accessing borrowable funds, they are able to boost their return with the same amount of initial capital.
Let's consider that a Liquidity Provider owns 100 LP Token A/B, representing his initial deposit of 50 Tokens A and 50 Tokens B in a DEX Liquidity Pool. By locking his LP Tokens in the Collateral Pool, he is now able to borrow 40 Tokens A and 40 Tokens B. His Collateral Factor is:
CF=10080=125%CF = \frac{100}{80} = 125\%
If he deposits the borrowed tokens in the DEX Liquidity Pool, he will receive additional LP Token A/B. He can then increase his collateral position and borrow additional Tokens A and Tokens B while maintaining is CF at 125%. By iterating this operation, he will be able to multiply his initial position by a leverage of 5. In general, Leverage can be computed as follows :
Leverage=CFCF1Leverage = \frac{CF}{CF-1}
CF
110%
115%
120%
125%
130%
135%
140%
145%
150%
Leverage
11.0x
7.7x
6.0x
5.0x
4.3x
3.9x
3.5x
3.2x
3.0x
​However, these iterations require a lot of manual transactions and are not efficient in terms of gas fees. Securd circumvents this by implementing an Automatic Leverage function.
By selecting a leverage of 5, our Liquidity Provider will, in a single transaction, increase his LP token position to 500 while contracting 2 loans of 200 Tokens A and 200 Tokens B. If the Liquidity Providing APY is 20% and the borrow rate is 5%, the Leveraged Liquidity Providing position is:
Initial Position
Leveraged Position
LP Token
100
500
Token A
0
-200
Token B
0
-200
CF
125%
Leverage
1.0x
5.0x
APY
20%
80%