# Leverage Collateral

You've mastered the griddle. Now it's time to start stacking assets like a pro, building your burger as high as possible if you want any shot of "making it." But be careful, *leverage is risky and you might get liquidated*. While we all joke about it, no one is actually having fun staying poor.

Stack offers the option to leverage re.al native RWA tokens like Tangible Baskets and USTB or your favorite crypto asset bridged over to re.al.&#x20;

## Leverage Operations

Stack's leverage slider is a one-click tool you can use to borrow against your assets, increasing your exposure to the borrowed asset and increasing the yield, in the case of yield-bearing tokens.  Here's a conceptual overview of how it works:

1. The user selects the token and amount of leverage they want to take on that asset
2. The asset is deposited as collateral and `$MORE` is minted based on the Maximum Collateral Ratio
3. The `$MORE` is swapped for more of the leveraged token on a DEX
4. That same token is deposited as collateral, the LTV (loan-to-value ratio) increases, `$MORE` is minted and the process repeats

This process "repeats" until the desired number of "loops" have been completed (leverage factor is met) or the borrowing amount is maxed out.&#x20;

With each "loop," the amount that can be borrowed decreases as the collateral ratio allows a smaller and smaller amount to be borrowed until there's nothing left.&#x20;

{% hint style="info" %}
The "looping" concept is used to describe the leverage process to make it easier to understand. However, under the hood, nothing actually loops and leverage is completed in one set of transactions.&#x20;
{% endhint %}

This diagram visualizes the process:

<figure><img src="/files/0A7HJcKIHSeviHCYjoT4" alt=""><figcaption></figcaption></figure>

### **What actually happens...**

Let's say you provide **X** `$USTB`  tokens and you want to lever up 3x.&#x20;

Leverage is called with 3 arguments:

* **X**: Collateral token amount
* **Y**: Borrow token amount
* Swap function (includes swap amount)

The contract will then:

* Flash-mint **Y** `$MORE`
* Swap `$MORE` for collateral (we should now have \~3x)
* Deposit collateral
* Borrow **Y** $`MORE` against it
* Use borrowed `$MORE` to repay the initial flash loan

## Leveraging a position on Stack

Visit the Leverage page and select the collateral you want to get leverage on. Follow the same process you used in Borrow.

Moving the slider towards the right will increase your loops (leverage factor) moving your position closer to the maximum collateral ratio, making your position riskier and therefore the liquidation price closer to live price. Make sure to check the amount of `$MORE` borrowed as well as your actual leverage.

<figure><img src="/files/U6JQY6Sr4V1OoMbP4ipC" alt=""><figcaption></figcaption></figure>

Note that a Borrow Fee will be charged on the leveraged `$MORE` amount that the user is borrowing. This fee is a total on all the `$MORE` minted to complete all leverage "loops" in the process.

{% hint style="danger" %}
The Liquidation Price changes dynamical as you move the slider. Make sure you understand the Liquidation Price before opening the leveraged position. If the price of the leveraged asset trades below the liquidation price, *you may be liquidated.*

***\*\*Leveraged USTB positions*** [***cannot be liquidated on price***](#user-content-fn-1)[^1]***, however an accumulation of interest fees can put a position in bad standing\*\****
{% endhint %}

As you adjust your transaction parameters, the data below will update allowing you refine the transaction to your desired outcomes:

* **Collateral Deposit**: The amount of collateral you will deposit for leverage.
* **`$MORE` Borrowed:** This is the amount of `$MORE` the crew member is borrowing to make the completed leverage stack.
* **Leverage Factor:** The multiple applied to the collateral deposit, increasing the amount of `$MORE` borrowed.
* **Position Size**: The total value of your collateral position after it's been leveraged.&#x20;
* **Effective APR:** APR based on leveraged returns from initial collateral deposit.&#x20;
* **Collateral Utilization:** If your collateral utilization exceeds the Maximum Collateral Ratio, either through price movement or accumulation of interest, your position will be liquidated
* **Liquidation Price:** If the trading price of your collateral is [at or below this number](#user-content-fn-2)[^2], your position will be liquidated.

After all the parameters are set, click the yellow button at the bottom to initiate the transaction.

**Note:** The borrower will not end up with any `$MORE` in their wallet after the transaction, it will have all been spent on new collateral to increase the farming yield with leverage.

{% hint style="danger" %}
Please be aware that all open positions utilizing the same collateral will be consolidated into a single position on Stack, regardless of whether they are leveraged or not. It's crucial for users to review their combined liquidation parameters after making any adjustments, as these parameters are likely to differ from the figures displayed during the transaction flow above.&#x20;

Users should refer to the data in the Dashboard to ensure they have an accurate understanding of their overall liquidation risk.
{% endhint %}

### Deleverage

To deleverage your position, visit the Dashboard.&#x20;

Full deleverage instructions can be found in the [Dashboard](/using-stack/stack-dashboard-deleverage.md) section of these docs.

### Swap Tolerance

As shown in the diagram above, leveraged positions execute a swap as `$MORE` is minted and traded for leveraged assets.

Like when trading tokens on a DEX, you'll have the option to set your swap tolerance, or slippage, the amount of change in value when the trade is executed that the user is comfortable with.

If the swap tolerance is not high enough, the transaction will fail and an error will pop up.

Clicking on the small cogwheel above the position's health, will allow you to change the swap tolerance.

<figure><img src="/files/LsQBUhfwQLgY592WnuS1" alt="" width="320"><figcaption></figcaption></figure>

🍔

Congratulations, you've mastered the art of leverage and those delicious stacks now have you on the path from McDonalds to McMansion.

<figure><img src="/files/kPGfBM5dgQHNh344EMKD" alt="" width="375"><figcaption></figcaption></figure>

[^1]: Yet, they can be liquidated. Users may get a wrong impressions here, thinking that USTB is safe to leverage. While it is safer than other assets, it's not a get-rich-guarantee. We also need to be careful on the "on price" statement. If you lever up when the price of MORE is $0.90 and then $MORE recovers, you'll get liquidated (assuming close to max leverage). Note, that the leverage transaction itself can decrease the price of MORE significantly, depends how much liquidity is available and how much you're leveraging.&#x20;

[^2]: and the price of MORE is constant


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stackmore.xyz/using-stack/leverage-collateral.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
