One of the features of using Cauldrons Technology as our lending engine is that it allows users to leverage their interest-bearing tokens positions. Here at Abracadabra, we have developed a one-click UI that allows you to do so automatically. Let's dive into this!
To open a leveraged position, users need to deposit the interest-bearing token they want to leverage. Cauldrons allow withdrawing more MIMs than it should be possible, as long as the collateral required is supplied to the position eventually, within the same transaction. To better explain this, let's use the example of a user that wants to leverage his yvUSDT position:
- Step 1 and 2 - The user selects the desired leverage, obtains the yvUSDT, and deposits them as collateral.
- Step 3 - Given the selected leverage, the protocol borrows the respective amount of MIMs.
- Step 4 - These MIMs are swapped into USDT (current price peg and slippage play an important role here).
- Step 5 - These USDT are deposited into a Yearn Vault to receive yvUSDT.
- Step 6 - These yvUSDT tokens are deposited back into the Abracadababra to collateralize the user's position.
This process can be visualized using the following infographic:
Notice that all of these steps happen in one single transaction, and therefore only one gas fee will be required. If one of these steps fails, the whole transaction fails. Note that if the token is not an Interest Bearing Token, STEP 4 and STEP 5 are substituted by a simple market buy of the token the user is leveraging.
First head to the Leverage page, then select on the collateral you want to use to leverage, in the same way as it happens for Borrow.
Our UI automatically computes the optimal LTV and the number of loops for your leveraged positions. Moving the slider towards the right will increase those parameters, making your position riskier and therefore the liquidation price higher. Make sure to check the amount of MIM leveraged in the box underneath, as well as your actual leverage.
The Liquidation Price changes dynamical with your slides, always make sure to double-check it before opening the leveraged position.
Note that a Borrow Fee will be charged on the leveraged MIM amount that the user is borrowing.
Clicking on the small cogwheel above the positions health, will allow you to change the swap tolerance.
Swap Tolerance is the amount of change in value a user is comfortable with. Factors that affect the change in value when MIM are swapped for other tokens are, the initial price peg difference at the market, and the slippage of trade from price changes during execution.
If the swap tolerance is not high enough, the transaction will fail and an error will pop up.
The box on the right will show you the following dynamic data:
- MIM Borrowed: This number will tell the wizard approximately how many MIM will be borrowed and used to create leveraged components.
- Expected Liquidation price: Price of collateral at which you can expect this leveraged position to be liquidated. This will depend on what percentage of collaterals the user selects as well as the leverage chosen.
- Collateral Deposited: the leverage amount of collateral you will deposit.
- Collateral Value: The leveraged value of collateral deposited.
If you have an already open position, and you are interested in seeing it before opening a new one, you can click on the small "i" icon.
Please note that every position you open on Abracadabra using the same collateral will be combined into a single position, no matter if it is leveraged or not. Therefore be sure to check your combined liquidation parameters after each adjustment using the data in the My Open Positions box, as they are likely to be different from the ones above.
After all the parameters are set, click on the two buttons underneath and open your leverage position!
Note: The user will not end up with any MIM in their wallet from this transaction, and will be farming yield at the leverage they have selected.
⚠This is extremely important⚠
Different from what happens in unleveraged positions, if the leveraged position gets liquidated, users will not have any assets in their possession.
It should be noted that 1st-time users will be met with several transactions in the following order.
- 1.Users will have to approve the spending of their collateral token to Bentobox.
- 2.Then, users will need to approve the spending of their collateral token to the contract specific to the position they are entering.
- 3.Next, they will have to approve the spending of the MIM they are borrowing to the contract specific to the position they are entering.
- 4.Finally, they will need to send the entire transaction to open up the position.
This is important to note, as each transaction will come with an individual gas cost.
Please note that as Abracadabra cannot distinguish between leveraged and not leveraged positions this function can be used to repay any kind of debt, but it will cost more with gas than a usual repay transaction. Use this function accordingly.
Bear in mind that leveraged positions can be closed by simply repaying the amount of MIM owed to the protocol, it is not compulsory to use this function. This function allows users to close their position even if they do not have the required MIMs in their wallets.
Cauldrons allow withdrawing collaterals even without repaying MIMs, as long as the MIMs required are supplied to the position eventually, within the same transaction. The process works the exact opposite as the "Leverage Yielding Transaction".
To better explain this, let's use the example of a user that wants to close his yvUSDT leveraged position. This user does not have enough MIMs in his wallet to repay his debt, therefore he needs to use the "Deleverage" function.
- Step 1 - The user selects the desired amount of collaterals he wants to withdraw and the amount of MIMs he wants to repay.
- Step 2 - The protocol releases the user's collateral, in this case, yvUSDT.
- Step 3 - These yvUSDT tokens are then unstaked from the yearn vault and turn into USDT.
- Step 4 - These USDT are swapped for MIMs. (current price peg and slippage play an important role here).
- Step 5 - These MIMs tokens are deposited back into the Abracadababra to repay for the user's released collaterals.
- Step 6 - The user receives whatever collaterals are left after these transactions, in this case, the value will be equal to the profit that the leveraged position has produced.
This process can be visualized using the following infographic:
Notice that all of these steps happen in one single transaction, and therefore only one gas fee will be required. If one of these steps fails, the whole transaction fails.
You can access the deleverage UI from the "Positions" page, by clicking on the Deleverage Icon next to your open position.
Here users will be able to select the number of MIM they want to repay as well as the amount of collaterals they want to remove. If you wish to close your position entirely, slide both sliders to the right.
Please note that the amount of collaterals a user wants to remove changes dynamically with Swap tolerance and the amount of MIMs the user wants to repay, and will be reset every time one of these two parameters changes. Users will also be able to select the Swap Tolerance they are willing to accept by toggling the cogwheel icon. If the swap tolerance is not high enough, the transaction will fail and an error will pop up.
After all the parameters are set to the user's desire, they can click on REPAY and start the transaction. Please note that gas fees are usually higher than the usual repay action, therefore we recommend using this function only if the user's willing to accept the cost. Attention! Note that, as of right now, after the full unwind process, some dust (in both MIM and/or Collateral) still remains in the position. This small issue will soon be addressed! In the meantime, if you wish to clear the remaining dust, process an additional, normal transaction. Stay tuned!