mrgnloop: A User Guide to Trading with Leverage
Use mrgnloop to arbitrage interest rates across a diverse range of assets and open leveraged long positions with marginfi flashloans.
How Does mrgnloop Work?
mrgnloop uses marginfi flashloans to make accessing leverage more user friendly than ever. This is because marginfi-v2 flashloans allow Looper to bundle multiple borrow and lend instructions within a single transaction. Flashloans allow marginfi accounts to borrow and outsized position relative to their lend position by circumventing the health checks that are typically performed when a user withdraws liquidity from marginfi.
For example, if a user wanted to open a long position on SOL relative to USDC, marginfi flashloans would handle the process in the follwing order:
- The flashloan first borrows all the USDC the user needs.
- The flaslohloan swaps the USDC for SOL.
- The flashloan deposit the SOL from the swap and the principal lent amount into the user's marginfi account. At this point, the flashloan has ended.
- The health check is performed once the flashloan has completed.
Flashloans allow the user to be in bad health during the borrow-lend process without throwing an error, as long as the user is in good health at the end of the transaction.
When you have a starting amount to deposit, like 10 SOL, and decide which tokens you want to borrow against and their respective weights, this will determine your Loan-to-Value (LTV) ratio and maximum leverage. LTV is the ratio of your loan amount to the value of your deposited assets. With this information, you can calculate how much you can increase your investment through leverage.
By using flashloans, mrgnloop ensures that users can access liquidity without the typical constraints of traditional borrowing and lending processes. With mrgnloop, you can maximize your capital efficiency by leveraging their assets, meaning you can control larger positions with a smaller initial investment.
mrgnloop uses flashloans to create a secure and flexible method for optimizing capital and enabling long strategies, all within a secure and user-friendly platform.
Gettting Started with mrgnloop
Step 1. Go to the marginfi app and connect your Solana wallet:
Step 2. Navigate to the mrgnloop page in the navigation menu:
Step 3. Open a long position on a token of your choice by clicking the "Select token" dropdown under "You deposit" in the Action Box:
Step 4. Before specifying how much you want to deposit, click the "Select token" dropdown under "You borrow" in the Action Box:
Step 5. Proceed to enter the amount you want to deposit:
Step 5. Finally, dial in how much leverage you want to take on your position using the slider:
As you dial in how much leverage you want to take on, your account health and other relevant metrics will adjust in real-time. Note that the flashloan will transaction will only execute if your account health is in good standing by the end of the transaction.
Welcome to the Arena
This user guide has outlined the fundamental aspects of leveraged borrowing and lending with mrgnloop. By understanding and utilizing the features of mrgnloop, you can effectively optimize and leverage your capital, while also mitigating risks through overcollateralization and robust risk management strategies. Embrace the future of DeFi with mrgnloop and explore the endless possibilities that decentralized borrowing and lending have to offer.
Stay in touch with marginfi’s latest news by following us on X, and get in touch with the team via our Discord. See you in the arena!