> For the complete documentation index, see [llms.txt](https://barrif-on-berachain.gitbook.io/barrif-on-berachain/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://barrif-on-berachain.gitbook.io/barrif-on-berachain/introduction/publish-your-docs.md).

# Core Mechanics

<figure><img src="https://1188336664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjdOIxMzCZ5u9SGToI8RA%2Fuploads%2FoaXPFwt4Rqw0SKSVtaBX%2Fdoc%20-%20core%20mechanics%20(1).jpg?alt=media&amp;token=57250cef-5cc4-4db0-ac5e-c1c0984a2bf0" alt=""><figcaption></figcaption></figure>

The **Bariff** ecosystem is built around several components that make memeFi happen in a safe, elegant, and dynamic way. At its core, the protocol features two mutually correlated tokens, **CHINA** and **USA**, each with the following characteristics:

## **1. Tuple Token Design: CHINA vs. USA**

* **CHINA**: Communist-oriented, BERA-backed metastable memecoin, **minted with BERA as collateral**.
* **USA**: capitalism-oriented, BERA-backed metastable memecoin, **minted with BERA as collateral**.
* **Both tokens exist in a K-equilibrium**, where their combined value follows:
  * As **CHINA demand increases**, **USA**’s price adjusts to maintain balance.
  * As **USA demand increases**, **CHINA**’s price dynamically compensates.

<figure><img src="https://1188336664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjdOIxMzCZ5u9SGToI8RA%2Fuploads%2FwoR3jUyX3XV9LpPcOqtM%2FBariff%20LPs.jpg?alt=media&amp;token=f99b4376-e15a-4b0b-b5bb-00acf7a546a5" alt=""><figcaption></figcaption></figure>

## **2. Dynamic Minting & Perpetual Leverage**

**2.1 Minting as a Long/Short Mechanism**

* Users **deposit BERA** to mint either **CHINA or USA**, effectively **longing one asset while shorting the other one,** without a fixed period of time.
* Burning **CHINA** allows minting **USA** (and vice versa), enabling **strategic arbitrage**.
* Minting fees dynamically adjust based on price disparities, ensuring metastability.

**2.2 Price-Based Dynamic Minting Fee**

The key for protocol sustainability is implementing **dynamic collateral** in response to excessive price divergence. In that sense, we can introduce a new concept called **dynamic LTV mechanism**, that adjusts based on the relative price difference between Token A (CHINA) and Token B (USA).

The standard **Loan-to-Value** is 80% when the price of A and B are close. As the price divergence increases, the LTV decreases, forcing borrowers to adjust their collateral. This prevents over-leverage in unstable conditions and reduces the systematic risk.

**2.3 Defining Dynamic LTV Function**

Let,

* $$P\_A$$ and $$P\_B$$ be the prices of tokens A and B.
* $$\Delta P = |P\_A-P\_B|$$ be the absolute price difference.
* $$LTV\_b=80%$$ be teh default LTV when $$P\_A=P\_B$$.
* $$LTV\_m$$ be the minimum LTV allowed.
* $$k$$ be a **sensitive factor** controlling how fast LTV drops.
* $$D\_M$$ the divergence threshold, which defines when the LTV reaches its minimum.&#x20;

A simple way to adjust LTV is:

$$
LTV = \max\left(LTV\_m, LTV\_b - k \cdot \left(\frac{\Delta P}{\min(P\_A, P\_B)}\right)\right)
$$

Where:

* If $$\Delta P$$ is **small**, LTV remains at 80%.
* If $$\Delta P$$ exceeds a predefined threshold, LTV approaches 60%.
* **k** determines how aggresively LTV is reduced as price difference grows.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://barrif-on-berachain.gitbook.io/barrif-on-berachain/introduction/publish-your-docs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
