Enabling leveraged LPing on UniswapV2-like DEXes with the help of the Gearbox protocol.
This project enables leverage LPing on UniswapV2-like DEXes to the users. It is built on the top of the Gearbox protocol where users can leverage up their assets. In our application USDC is borrowed from the Gearbox protocol and deposited into a credit account along with the user's principal USDC amount. This is the base mechanism of the Gearbox protocol. We then wrote an adapter contract through wich users can use the USDC to enter in a WETH-USDC Sushiswap or Uniswap pool. This means users are now providing liquidity with leverage and are receiving up to 10x the amount of trading fees (depending on their leverage factor). We believe this is a useful and lucrative product as the interest rate fees from borrowing USDC has been significantly lower than the APY liquidity providers receive from trading fees. Our product also supports borrowing WETH instead of USDC, or even any arbitrary ERC20 token. It can also be expanded to also stake LP positions in the Sushiswap Masterchef contract to acheive a higher APY, or bundled together with a short WETH position to acheive a delta neutral strategy.
How it's made
We build our solution from the Gearbox contracts-v2 repository, using their existing AbstractAdapter contracts and extending UniswapV2Adapter to enable more features such as adding liquidity to the protocol. Our adapter supports adding liquidity starting with just one token in a single transaction. A key part was also writing a fool proof oracle for the LP pair, as a native LP oracle implemntation is vunerable to a flashloan attack. We refactored our solution from cream finance. As for our front end, we started by forking a version of the Uniswap V2 interface. Our UI assumes a user already has an opened credit account in the Gearbox protocol. Then, the users can simply execute a function "addLpWithSingleToken" which transforms their USDC position to a USDC-WETH LP position. Then the users can monitor their position value from the UI.