> 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/zhi-neng-he-yue/bondinfo-he-yue.md).

# Bondinfo合约

BondInfo 从 Bond 质押合约读取数据，并计算实时的待结算收益、可领取收益与可领取本金。它不保管用户资产，也不执行领取。

### 查询用户订单

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

* `page` 从 `1` 开始。
* 每页最多 `20` 条，可通过 `MAX_ORDER_VIEW_LIMIT()` 核对。
* 返回顺序按合约内部的用户订单链表排列；空数组表示该页没有记录。

查询单个订单使用 `getOrder(orderId)`。

### OrderView 字段

| 字段                       | 含义                |
| ------------------------ | ----------------- |
| `id`                     | 全局订单 ID           |
| `user` / `holder`        | 原始创建人 / 当前持有人     |
| `kind`                   | `1`=Bond，`2`=单币质押 |
| `status`                 | `1`=正常，`2`=已抵押    |
| `typeId`                 | 产品类型 ID           |
| `startTime` / `endTime`  | 开始时间 / 本金释放结束时间   |
| `managementFeePaidUntil` | 管理费有效截止时间         |
| `managementFeeActive`    | 当前管理费是否有效         |
| `principal`              | 初始本金 SUN          |
| `remainingPrincipal`     | 尚未领取的本金           |
| `releasedPrincipal`      | 截至当前时间已释放的本金      |
| `claimablePrincipal`     | 当前可领取本金           |
| `settledReward`          | 已结算未领取的个人收益       |
| `pendingReward`          | 按当前指数预估的待结算收益     |
| `claimableReward`        | 当前可领取个人收益总额       |
| `pendingDynamicReward`   | 已计提但尚未发放的动态源收益    |
| `compoundAmount`         | 当前复利计算基数          |

### 债券和质押查询查询

| 函数                                              | 用途                       |
| ----------------------------------------------- | ------------------------ |
| `getAllBondType()`                              | 返回全部 Bond 产品和 `typeId`   |
| `getAllStakeType()`                             | 返回全部质押产品和 `typeId`       |
| `bondType(typeId)` / `stakeType(typeId)`        | 查询单个产品                   |
| `quoteBondPurchase(typeId,usdtAmount)`          | 返回预计 SUN 本金、初始管理费、总 USDT |
| `quoteInitialManagementFee(kind,typeId,amount)` | 查询初始管理费                  |
| `quoteManagementFee(orderId,periods)`           | 查询订单续费金额                 |
| `quoteSunToUSDT(sunAmount)`                     | 按池子现货储备估算 SUN 价值         |
| `quoteUSDTToSUN(usdtAmount)`                    | 按池子现货储备估算 USDT 可换 SUN    |
| `rebaseInfo()`                                  | 查询当前 rebase 编号、间隔和下次时间   |


---

# 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/zhi-neng-he-yue/bondinfo-he-yue.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.
