# Barista User Guide

**Barista integrates seamlessly with the Liquid Loans protocol to automate the rebalancing of users’ positions within the Stability Pool during liquidations.**

When a Liquid Loans Vault is liquidated, its collateralized PLS is seized and exchanged for USDL from the Stability Pool. Barista’s Backstop AMM (B.AMM) automatically converts the discounted PLS back into USDL, optimizing yield and maintaining stability.

Barista features a user interface closely aligned with Liquid Loans, ensuring a familiar and intuitive user experience. This step-by-step guide will walk you through the key actions required to use the integration, especially if it's your first time interacting with Liquid Loans. Complete [explainer videos](/dapp-documents/barista/barista-deeper-dive/liquid-loans-explainer-videos.md) are also available for additional guidance.

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

**Step 1: Connect Wallet**\
Begin by connecting your wallet to the Liquid Loans integration on Barista.\
Ensure you're using the same wallet that holds your USDL.

 

<figure><img src="/files/RkGmubm0hji2qRShrbAf" alt=""><figcaption><p>BARISTA STABILITY POOL</p></figcaption></figure>

**Step 2: Deposit USDL into the Barista Pool**\
Once your wallet is connected, you can deposit USDL into the Barista Pool. Your USDL will automatically be staked in the Liquid Loans Stability Pool. Barista pools user funds, allowing you to track how much of the Liquid Loans pool is managed by Barista.

**Important Note about Staking USDL in the Barista Stability Pool**\
When a new deposit is made, the system calculates your share and assigns corresponding PLS and Loan gains. The formula to check your claim is as follows:

**(PLS \* priceOfPlsGain) + (USDL \* $1) + (Loan \* LoanGains) = Initial USDL Deposit**\
For example, if you deposit 100 USDL, your total deposit might be represented as 82.95 USDL + 10.91 PLS, calculated accordingly to the current market rates.

**Staking Conditions:**

* In the absence of visible liquidation gains ($PLS), your total USDL amount will be staked directly in the Stability Pool.
* You can track the current Loan APR (reward token) distributed by Liquid Loans when staking USDL in the Stability Pool.
* Barista does not take any cuts from the Loan rewards, so users receive the full 100% kickback rate on their deposits.

**Manual Claims:**\
If you wish to claim $PLS liquidation gains, you can unstake USDL from the Stability Pool at any time. On the mainnet, arbiters will keep the USDL price close to $1, meaning auto-rebalancing will occur frequently, keeping liquidation gains near zero.

<div><figure><img src="/files/TdKyyRmetmJYpIk31XUI" alt=""><figcaption><p><em>You would need to confirm the transaction on MetaMask</em></p></figcaption></figure> <figure><img src="/files/FnNl39S7gLw29ut5Sozx" alt=""><figcaption></figcaption></figure></div>

**Step 3: Unlock USDL on your wallet**\
Before you can deposit USDL into the Barista Stability Pool, you will need to approve it in your wallet. This process is similar to granting token allowances on other platforms like Compound or Uniswap. Once your USDL is approved, you can proceed with the deposit.\
To deposit your entire USDL balance, simply click the “MAX” button.

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

**Step 4: Withdrawing USDL from the Stability Pool**\
To withdraw USDL from the Barista Stability Pool, you must first unstake the desired amount. For example, if you select 75%, the tooltip at the bottom of the box will display the amount you are withdrawing and how it impacts your share in the pool.\
Withdrawing will also automatically claim a proportionate amount of your LOAN rewards.

For more information, you can read about the [Liquid Loans Stability Pool](https://docs.liquidloans.io/stability-pool-and-liquidations)&#x20;

<figure><img src="/files/wCWscUL2TnOzveSlqKY3" alt=""><figcaption><p><em>Stake your LOAN for more rewards</em></p></figcaption></figure>

**Staking LOAN Tokens**\
Users can stake their LOAN tokens through Barista to receive their share of the Liquid Loans protocol fees and rewards. The staking process for LOAN is the same as in any other Liquity frontend, with no additional Barista wrapper (unlike the USDL deposits).

For more details, read the [Liquid Loans Staking Pool documentation](https://docs.liquidloans.io/loan-staking)


---

# 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.mcr369.io/dapp-documents/barista/barista-user-guide.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.
