> For the complete documentation index, see [llms.txt](https://docs.kuma.bond/kuma-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kuma.bond/kuma-protocol/developers/smart-contract-architecture/kumaswap/buybond.md).

# 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
