Leverage
Flash Swap is an advanced AMM (Automated Market Maker) feature that enables a unique transaction flow. It allows the LP (Liquidity Provider) Pool to send assets to a recipient before verifying that sufficient input tokens have been received. This mechanism is made possible by the atomic nature of blockchain transactions. If the required input tokens are not received by the pair contract, the entire transaction will be reverted to its previous state, ensuring the integrity of the exchange.
This feature provides enhanced flexibility for complex DeFi operations, allowing users to temporarily access liquidity without upfront collateral, as long as the borrowed assets are returned (plus any fees) within the same transaction.
INFO
Read more about Flash Swaps here.
How do we allow Leverage?
MethLab use Flash Swaps to allow borrowers to create loans using leverage.
Step | Description |
---|---|
1. Derive Implied LTV of a vault | Implied LTV is calculated using the weighted average of Borrow Price and amount borrowed per Lender according to the current Spot Price. |
2. Using the I-LTV, calculate the maximum leverage possible | Max Leverage = 1 divided by (1 - LTV). Eg. at 80% LTV, 1 / (1-0.8), gives 5x leverage to the borrower. |
3. Borrower selects leverage parameter(optional) | Borrower may choose to not leverage by keep it at 1x. Or Borrower can leverage which reduces Collateral required to open the position. |
4. The transaction is structured with calculated value for Flash Swap | If borrower chooses to leverage, swaps take place that involve a DEX for swapping the Borrowed Asset for Collateral Asset. |
5. The Collateral is escrowed and the Loan contract is created | Loan contract is created per Lender and Borrower's collateral is locked in each Loan contract which can reclaimed when the Borrower repays. |
Let's consider an example.
Strike Price = 1500 USDT (with mETH as collateral)
Spot Price of mETH= 2000 USDT
Implied LTV =
This means that the borrower can create a loan with 4x leverage by borrowing the collateral using the Flash Swap.