# buyBond

### Requirements

The following conditions must be met to buy a KUMA NFT from the contract:

* The contract must be unpaused
* The bought bond must be in reserve

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

### Burned MIBT Calculation

The `KUMASwap` contract will burn `KIBT` from the user's balance before sending the Bonds NFT. A `KBCToken` is issued during `buyBond` if the bond's value (i.e. the value of the bond given its coupon) is greater than that of the bond's realized value (i.e. how much `KIBT` accrual the bond has backed).

$$
bondValue = bond.principal \* (bond.coupon^{elapsedTime})
$$

$$
bondRealizedValue = \frac{bond.principal}{R\_0}\* R\_1
$$

$$
BurnedAmount = bondRealizedValue
$$

Where is the $$R\_0$$is the `KIBT` `cumulativeRate` at the time of depositing the bond to the `KUMASwap` contract and $$R\_1$$ is the `KIBT` `cumulativeRate` at the time of buying the bond


---

# 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.kuma.bond/kuma-protocol/developers/smart-contract-architecture/kumaswap/buybond.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.
