# System Design

*ButtonZero* is a *composition* of the [Tranche](/buttonwood/learn/tranche.md) protocol and an automated market maker (AMM). The ButtonZero "router" smart-contract takes a user's collateral and carries out the transactions necessary to create a loan--it will mint tranches, swap them in the AMM, and return the loan and collateral claim back to the user. &#x20;

![](/files/Fwjue6cyv1oEOL9uzwVE)

### **Prerequisite knowledge from** [**Tranche**](/buttonwood/learn/tranche.md)

A- and B-Tranche tokens represent [senior future claims](/buttonwood/learn/glossary.md#senior-tranche-claim) on $1 worth of the collateral token.&#x20;

Due to this, A- and B-Tranche tokens should generally trade for $1 or less on an exchange. If less, the difference accounts for some risk that the value of the collateral drops so far as to dig into the redeemable value of the tranche tokens. B-Tranche tokens lose value before A-Tranche tokens, and thus generally are expected to trade at a steeper discount.&#x20;

Z-Tranche tokens represent [junior future claims](/buttonwood/learn/glossary.md#junior-tranche-claim) on the collateral token. They receive all of the upside exposure.

### **How are loans created?**

Borrowers can initiate a loan by tranching their collateral, and then selling their safe tranches to lenders for cash. The result of this operation is as follows:

* Borrowers hold Z-Tranche (equity) tokens. These represent all of the price upside of their original collateral.
* Borrowers hold cash (or stablecoins) in return for the safe part of their collateral.
* Lenders hold A- and B-Tranche tokens. These are safe and likely to be worth $1 each.
* Lenders gave away some cash (or stablecoins) for a likely return on the safe tranche tokens

This emulates a traditional loan where lenders hold [senior debt](/buttonwood/learn/glossary.md#junior-tranche-claim), and borrowers hold [junior debt](/buttonwood/learn/glossary.md#junior-tranche-claim).&#x20;

**Learn more about the lender flow here**

{% content-ref url="/pages/gi9vSeDHPZKmBYvlnmqZ" %}
[Lending](/buttonwood/learn/buttonzero/lending.md)
{% endcontent-ref %}

**Learn more about the borrower flow here**

{% content-ref url="/pages/W5dSvX21sm63XG5UGDLR" %}
[Borrowing](/buttonwood/learn/buttonzero/borrowing.md)
{% endcontent-ref %}


---

# 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.prl.one/buttonwood/learn/buttonzero/system-design.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.
