> For the complete documentation index, see [llms.txt](https://document.sunprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://document.sunprotocol.io/en/smart-contracts/bondinfo-contract.md).

# Bondinfo Contract

BondInfo reads the Stake and Bond contract and calculates live pending rewards, claimable rewards, and claimable principal. It neither holds user assets nor executes claims.

### Query user orders

```
getuserBondBypage(user, page)
getuserStakeBypage(user, page)
```

Pages start at `1`, with up to `20` orders per page. `getOrder(orderId)` returns one order.

### Important OrderView fields

| Field                                            | Meaning                                           |
| ------------------------------------------------ | ------------------------------------------------- |
| `id`                                             | Global order ID                                   |
| `user` / `holder`                                | Original creator / current holder                 |
| `kind`                                           | `1` Bond, `2` single stake                        |
| `status`                                         | `1` normal, `2` collateralized                    |
| `typeId`                                         | Product type                                      |
| `startTime` / `endTime`                          | Start / principal-release end timestamps          |
| `managementFeePaidUntil` / `managementFeeActive` | Fee coverage and current validity                 |
| `principal` / `remainingPrincipal`               | Initial / unclaimed principal                     |
| `releasedPrincipal` / `claimablePrincipal`       | Released / currently claimable principal          |
| `settledReward` / `pendingReward`                | Settled / estimated pending personal reward       |
| `claimableReward`                                | Total personal reward currently claimable         |
| `pendingDynamicReward`                           | Dynamic-source reward accrued but not distributed |
| `compoundAmount`                                 | Current personal compounding base                 |

Time fields are Unix seconds. Amounts use SUN or USDT smallest units.

### Product and quote reads

| Function                                        | Purpose                                              |
| ----------------------------------------------- | ---------------------------------------------------- |
| `getAllBondType()` / `getAllStakeType()`        | All products with type IDs                           |
| `bondType(typeId)` / `stakeType(typeId)`        | One product                                          |
| `quoteBondPurchase(typeId,usdtAmount)`          | Expected SUN principal, initial fee, and total USDT  |
| `quoteInitialManagementFee(kind,typeId,amount)` | Initial management fee                               |
| `quoteManagementFee(orderId,periods)`           | Renewal fee                                          |
| `quoteSunToUSDT` / `quoteUSDTToSUN`             | Spot reserve-based conversion                        |
| `rebaseInfo()`                                  | Rebase number, interval, current time, and next time |


---

# 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://document.sunprotocol.io/en/smart-contracts/bondinfo-contract.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.
