Primex Finance will provide Uniswap Liquidity providers the possibility to amplify their profits using borrowed lender funds and create hedged strategies by combining leveraged LP with spot trading margin positions. This will introduce new use cases and financial strategies for the Uniswap protocol, consequently enabling more flexibility and attracting more liquidity to Uniswap.

**Grant scope**

The following feature will be developed in the scope of this grant:

- Leveraged Liquidity providing
- Combining leveraged LP positions with spot margin positions to build hedged strategies

**Leveraged Liquidity providing**

A new liquidity use case that is set to be developed centers on leveraged liquidity providing. Here, a trader borrows liquidity from a Bucket, optionally swaps a portion of it for another token, and subsequently places the token(s) into a Uniswap v3 pool as a liquidity provider. 

The trader can configure the LP parameters in the same manner as on the Uniswap interface. As a form of collateral for the debt, the Uniswap LP NFT remains in the Primex contracts. When the trader opts to close the position, the liquidity is pulled out from the pool, swapped for the borrowed asset, and the debt with the associated interest is repaid. The trader is then given the remainder of the tokens. If the value of the position falls to a critical level relative to the debt, the position is liquidated. 

This feature enables traders to maximize their profits by managing larger liquidity pools, thereby boosting the liquidity of the Uniswap ecosystem.

Example 1

1) Trader uses 1000 USDC as deposit and borrows 4000 USDC from the Credit Bucket
2) 2500 USDC are swapped to 1.1 WETH
3) 2500 USDC and 1.1 WETH are provided to a Uniswap v3 WETH/USDC pool with a small interval around the current price
4) The price changes inside the interval set by the Trader, the fee is accumulated
5) The trader closes the position, withdrawing USDC and WETH from the pool, in the current proportion, together with the accumulated interest
6) WETH is swapped to USDC
7) The debt of 4000 USDC (plus interest) is returned to the Bucket
8) The Trader gets the rest of USDC

Example 2

1) Trader uses 1000 USDC as deposit and borrows 4000 USDC from the Credit Bucket
2) 5000 USDC are provided to a Uniswap v3 WETH/USDC pool with a corresponding interval
3) The price reaches the interval, starts changing the proportion, the fee is accumulated
4) The trader closes the position, withdrawing USDC and WETH from the pool, in the current proportion, together with the accumulated interest
5) WETH is swapped to USDC
6) The debt of 4000 USDC (plus interest) is returned to the Bucket
7) The Trader gets the rest of USDC

If the overall value of an LP position approaches the debt size, the position will be liquidated by the decentralized Keeper infrastructure, which is already live on mainnets and executes various automated actions for Primex users.

**Hedging leveraged LP positions with spot margin positions to build hedged strategies**

Traders will be able to merge their leveraged LP positions with spot margin trading positions already available on Primex, hedging all their risks within a single protocol, and eliminating the need to rebalance positions across various protocols.

For example, a trader can provide liquidity to the WETH/USDC pool and open an opposing WETH/USDC spot margin position. The direction of the Primex position depends on the price intervals set in the LP position.

Traders will be able to create and manage both positions using a unified interface, borrowing funds from the same protocol.

Apart from opening these two positions independently with isolated margin, traders will also be able to combine them with cross-margin. This way, the profit from one position can cover the losses from the other, thereby reducing the risk of liquidation.
