# User flow examples

In order to fully understand how different parameters impact the system, and what can happen to a position over time, let's look at a specific example.

## Open a vault

A vault is the basic building block within BOB CDP. Start using the protocol by opening an empty vault.

Opening a new vault is straightforward from the UI and requires a single on-chain transaction.

<figure><img src="/files/ygN51TB46DSnX87bX4Ra" alt=""><figcaption><p>Empty newly opened vault</p></figcaption></figure>

## Depositing collateral

{% hint style="info" %}
In the example LP positions are used which may not be currently supported. Check [Collaterals](/bob-cdp/system-actors.md) for up-to-date positions which can be used with BOB CDP.
{% endhint %}

The borrower should already have a Uniswap V3 position. In this example, the borrower has a position for WETH/USDC, valued at 10,000$ with the current price for ETH at 1750$

<figure><img src="/files/4e6wdTwKjmijm2BHxARF" alt=""><figcaption><p>Collateral deposit pop-up</p></figcaption></figure>

The borrower can easily deposit their Uniswap V3 position into the newly created vault by authorizing an on-chain transaction through their wallet.&#x20;

Once the collateral is deposited, the borrower can see their vault status, the amount of locked collateral, and their max available borrow amount.

<figure><img src="/files/4W6F8rmIFMLSylApeaQD" alt=""><figcaption><p>Empty vault with locked collateral</p></figcaption></figure>

The user's position has a current value of 10,000$, while the borrow threshold for the chosen collateral is set to 60%, which means that the maximum available borrow amount is 10,000$ \* 60% = 6,000 BOB.

## Borrow BOB

Once the vault has some locked collateral, a borrower can freely mint collateralized BOB tokens, up to the maximum configured borrow limit of 6,000 BOB.

<figure><img src="/files/HE3ByQbIKDCVzCIgViHt" alt=""><figcaption><p>Borrow 5,000 BOB</p></figcaption></figure>

Minting debt decreases the borrower's vault health factor.  By minting 5,000 BOB, the borrower ends up with a vault health factor of 140%.

<figure><img src="/files/Ldkm6Cfn27EJxIzqI7OK" alt=""><figcaption><p>Vault health after successfull debt mint</p></figcaption></figure>

## Repay BOB

Once the borrower is ready to repay their loan, they can do so at any time, either by repaying the full amount, or a fraction of both loan principal and accumulated interest.

Here the borrower repays half the loan - 2,501 BOB.

<figure><img src="/files/HCNVXStQYDKJAMPXoUP2" alt=""><figcaption><p>Repaying half of the active loan</p></figcaption></figure>

As a result of a successful repayment, the vault health factor has doubled to 280%.

<figure><img src="/files/WAi4DECSMDVAvm5iDDDR" alt=""><figcaption><p>Vault health after successfull repayment</p></figcaption></figure>

## Withdraw collateral

Once the loan has been fully repaid, the borrower is able to claim back the deposited collateral.

<figure><img src="/files/lh8YfyqW2GjR5XBDDgy9" alt=""><figcaption><p>Withdraw locked collateral after full-repayment</p></figcaption></figure>

## Observe liquidation

In the unfortunate event of vault liquidation, the borrower's debt would be fully repaid by an external party, with the vault's collateral seized in favor of liquidator. The owner of the liquidated vault will see the corresponding message in the UI:

<figure><img src="/files/ij58I7jIZtSfKKFzCyq7" alt=""><figcaption><p>Post-liquidation message</p></figcaption></figure>

Depending on the price of the collateral at the time of the liquidation, the borrower may be eligible to claim the remaining BOB after a successful liquidation.&#x20;


---

# 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://bob-docs.zkbob.com/bob-cdp/user-flow-examples.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.
