-
Notifications
You must be signed in to change notification settings - Fork 18
Auto Leverage & Repay with collateral overview docs #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c4c9d02
Auto Leverage & Repay with collateral overview docs
0xCodeThief 6804a13
Auto leverage & Pay with collateral guide
0xCodeThief a20e5e7
Update Auto-leverage & Repay with collateral.md
0xCodeThief 9ef6528
Update Boost & Repay with Collateral.md
0xCodeThief d22bdc1
feat: link Leveraged Positions to menus
therealemjy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| # **Looping Made Easy on Venus Protocol** | ||
|
|
||
| On Venus Protocol, building leveraged positions — traditionally known as “looping” — used to require users to manually repeat a tedious cycle: borrow → swap on an external DEX → supply as collateral → borrow again, often 5–20 times. Each step cost gas, time, and risk of transaction failures. | ||
|
|
||
| Auto-leverage boost changes that completely. | ||
|
|
||
| With Venus’s one-click Boost feature, the entire looping process is fully automated and executed in a single, atomic transaction using flash loans. | ||
|
|
||
| Here’s what happens behind the scenes when you click “Boost”: | ||
|
|
||
| * Venus instantly calculates the maximum safe leverage based on your current borrowing power and the selected collateral’s loan-to-value (LTV) ratio. | ||
| * A flash loan borrows a large amount (far beyond your normal borrowing power). | ||
| * The borrowed asset is swapped (via the best available route) into your chosen collateral asset. | ||
| * The resulting tokens are supplied as collateral on Venus. | ||
| * The loop repeats internally as many times as needed — all in the same transaction — until your target leverage is reached. | ||
| * The flash loan is repaid at the end, leaving you with a fully leveraged position. | ||
|
|
||
| Result: What once took dozens of manual transactions, high gas costs, and constant monitoring is now instant, and completely safe from liquidation on execution (health factor is always kept \> 1). | ||
|
|
||
| Whether you’re looping 2×, 5×, or pushing close to the maximum LTV of assets like BNB, BTCB, or stablecoins, Venus does all the heavy lifting. | ||
|
|
||
| Looping is no longer reserved for advanced users — on Venus Protocol, it’s literally as easy as clicking Boost. | ||
|
|
||
| --- | ||
|
|
||
| # **Repay Debt with Collateral** | ||
|
|
||
| Closing or reducing a leveraged position on Venus Protocol is just as simple as opening one. The Repay with Collateral feature lets you instantly repay any borrowed asset using the collateral you already have supplied — without needing to hold the borrowed token in your wallet. | ||
|
|
||
| ## **How it works** | ||
|
|
||
| • Select the loan you want to repay (fully or partially). | ||
| • Venus automatically withdraws the required amount from one or more of your supplied assets. | ||
| • It swaps the withdrawn collateral into the exact borrowed asset (using the best available route). | ||
| • The debt is repaid immediately, and any leftover tokens are returned to your wallet. | ||
|
|
||
| ## **Perfect for leveraged positions** | ||
|
|
||
| When you have a looped (Boosted) position, your wallet typically holds little or none of the borrowed asset. Repay with Collateral eliminates the need to manually unwind loops by letting you deleverage or fully close the position in a single transaction — even if you want to exit at maximum leverage. | ||
|
|
||
| ## **Key benefits** | ||
|
|
||
| • No need to source the borrowed token externally | ||
| • One-click full or partial deleveraging | ||
| • Minimal slippage thanks to optimized routing | ||
| • Works seamlessly with Boost positions | ||
| • Saves a lot of time | ||
|
|
||
| Combined with the Boost feature, Repay with Collateral makes entering and exiting leveraged positions on Venus faster, and more user-friendly than ever before. | ||
|
|
||
| --- | ||
|
|
||
| # **Key Use Cases for Users** | ||
|
|
||
| **Yield Farmers – Maximize APY with one click** | ||
| Loop stablecoins or blue-chip assets (e.g., USDT, USDD, BTCB) up to the maximum safe LTV and earn higher lending \+ VAI rewards without manually repeating borrow-\>swap-\>supply dozens of times. | ||
|
|
||
| **Long-term Bulls – Amplify exposure instantly** | ||
| Want 4–8× exposure to an asset with only your existing collateral? Boost turns a modest position into a highly leveraged long in seconds. | ||
|
|
||
| **Bearish Traders – Short an asset instantly** | ||
| Believe an asset is overvalued? Boost lets you instantly borrow and swap into stablecoins, creating a 5–10× leveraged short position in a single click. | ||
|
|
||
| **Quick deleveraging during volatility** | ||
| When prices move against you, repay any borrow instantly using your supplied collateral, no scrambling for tokens or manual unwinding. | ||
|
|
||
| **Closing Boosted positions – cleanly** | ||
| Exit an entire looped position (long or short) in one transaction. Repay with Collateral handles all withdrawals, swaps, and debt repayment automatically. | ||
|
|
||
| **Capital-efficient entry & exit** | ||
| Enter high-leverage long or short strategies with zero upfront capital beyond your initial supply, and exit cleanly without ever holding large amounts of the borrowed asset. | ||
|
|
||
| Boost \+ Repay with Collateral turns advanced leveraged strategies — long or short — into simple, one-click actions on Venus Protocol. | ||
|
|
||
| --- | ||
|
|
||
| # **Risks of Using Boost & Repay with Collateral** | ||
|
|
||
| While the one-click experience makes leveraging incredibly fast and simple, the risks remain the same as any leveraged position on Venus — just easier to enter at higher ratios. | ||
|
|
||
| ## **Key risks you must understand:** | ||
|
|
||
| **Liquidation Risk** | ||
| Boosted positions run very close to the asset’s maximum LTV. A small adverse price move can drop your health factor below 1.1 and trigger liquidation. | ||
|
|
||
| **Amplified Price Exposure** | ||
| 5–10× leverage magnifies gains and losses. A 10 % drop in the collateral asset price can wipe out 50–100 % of your equity. | ||
|
|
||
| **Execution & Slippage Risk** | ||
| In rare cases of extreme market conditions, the internal swaps during Boost may fail or experience high slippage, causing the transaction to revert (you only lose gas). | ||
|
|
||
| **Oracle Risk** | ||
| Venus relies on price oracles. Temporary oracle mispricing can lead to unexpected liquidations or failed Boost attempts. | ||
|
|
||
| **Borrow Interest Erosion** | ||
| High or rising borrow rates on leveraged positions can reduce net yield over time and can turn a profitable strategy negative. | ||
|
|
||
| **Impermanent Loss (LP tokens)** | ||
| Boosting with liquidity-provider tokens adds impermanent loss risk on top of borrowing costs. | ||
|
|
||
| ## **Best practices** | ||
|
|
||
| • Only use funds you can afford to lose | ||
| • Leave a safety margin instead of always maxing leverage | ||
| • Monitor your health factor regularly | ||
| • Know the exact liquidation price before confirming Boost | ||
|
|
||
| Leverage is a double-edged sword — Boost makes it easy to wield, but the responsibility remains yours. | ||
|
|
||
| --- | ||
|
|
||
| # **How Venus Calculates Your Maximum Boost (With Example)** | ||
|
|
||
| Venus automatically determines the highest safe leverage so your health factor stays above 1 after using Boost. | ||
|
|
||
| ## **Internal Formula** | ||
|
|
||
| **Maximum Additional Borrow \= Unused Borrowing Power ÷ (1 − Collateral Factor)** | ||
|
|
||
| ## **Example – Looping USDT (Collateral Factor \= 80%)** | ||
|
|
||
| **Your Current Position:** | ||
| • Supplied: 100 USDT (enabled as collateral) | ||
| • Already borrowed: 20 USDT | ||
|
|
||
| ### **Step-by-Step Calculation (Performed Instantly by the Protocol)** | ||
|
|
||
| 1. **Unused Borrowing Power** | ||
| Unused Borrowing Power \= (Supplied × Collateral Factor) − Existing Borrow | ||
| → (100 × 0.8) − 20 \= 80 − 20 \= 60 USDT | ||
| 2. **Maximum Additional Borrow with Boost** | ||
| → 60 ÷ (1 − 0.8) \= 60 ÷ 0.2 \= 300 USDT | ||
|
|
||
| ### **Result After Clicking Boost** | ||
|
|
||
| • Total supplied: ≈ 400 USDT | ||
| • Total borrowed: ≈ 320 USDT | ||
| • Net equity: still ≈ 80 USDT (your original capital) | ||
| • Effective leverage achieved: ≈ 5× | ||
|
|
||
| With only 60 USDT of unused borrowing power, Boost instantly creates a 5× leveraged position — something that would normally require 8–10 manual loops and multiple transactions. | ||
|
|
||
| The Boost interface shows the exact boost amount, the final leverage multiplier, and the updated health factor before you confirm — no manual calculations needed. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| ### **Leveraged Positions (Boost & Repay with Collateral)** | ||
|
|
||
| The Leveraged Positions feature allows users to significantly amplify their exposure in the protocol using a single-click workflow powered by flash loans. Instead of manually looping borrow → swap → supply multiple times, users can instantly achieve their desired leverage level in one atomic transaction, while maintaining full control and precision. | ||
|
|
||
| The feature consists of two complementary tools: | ||
|
|
||
| #### **1\. Boost** | ||
|
|
||
| The Boost tab enables users to open a leveraged position by fully utilizing their available (unused) borrowing power. | ||
|
|
||
| **How it works** | ||
|
|
||
| * Users must first supply assets to the protocol and enable them as collateral. | ||
| * The interface displays the maximum “available to boost” amount, which is derived from the user’s remaining borrowing power. | ||
| * When a Boost is executed, the protocol uses a flash loan to temporarily borrow a larger amount, swaps it into the chosen collateral asset, and supplies it — all in a single transaction. | ||
| * This results in a leveraged position consisting of a larger supplied (collateral) amount and a corresponding borrowed amount. | ||
| * Safety mechanisms ensure the resulting health factor stays safely above 1, preventing immediate liquidation. | ||
therealemjy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Key benefit** | ||
|
|
||
| With only a modest amount of unused borrowing power, users can open positions that are multiple times larger than what would be possible through ordinary borrowing — achieving high leverage efficiently and effortlessly. | ||
|
|
||
| #### **2\. Repay with Collateral** | ||
|
|
||
| Repaying debt or reducing a leveraged position is equally straightforward. | ||
|
|
||
| Instead of needing to hold the borrowed asset in their wallet to repay debt, users can directly repay any outstanding borrow using their supplied collateral in one click. | ||
|
|
||
| This is particularly convenient for deleveraging or fully closing leveraged positions, as it eliminates the need for additional swaps or external funds. | ||
|
|
||
| Together, Boost and Repay with Collateral provide a seamless, user-friendly way to enter and exit highly leveraged positions while keeping the process safe, fast, and capital-efficient. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.