> For the complete documentation index, see [llms.txt](https://docs.hann.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hann.finance/zh/mechanics/deep-dives/cdp-safety.md).

# CDP 抵押条件

计算 Trove 抵押率、LTV、清算价格和还款所需 USDHN

抵押品价格、债务和数量改变 Trove 的抵押率；利息和仓位调整也改变清算价格。债务按 USDHN 数量偿还，购入 USDHN 的市场成本另行计算。

## 计算变量

| 符号            | 含义     | 单位或来源                     |
| ------------- | ------ | ------------------------- |
| `C`           | 当前抵押数量 | 分支记账单位，含待分配抵押品。           |
| `P`           | 抵押价格   | 分支价格源提供的每单位 USD 价格。       |
| `V = C × P`   | 抵押价值   | USD。                      |
| `D`           | 当前债务   | USDHN，含利息、费用和待分配债务。       |
| `MCR`         | 最低抵押率  | 所选分支比率，如 `1.5` 表示 `150%`。 |
| `CR = V / D`  | 抵押率    | 抵押价值除以按每 USDHN $1 计价的债务。  |
| `LTV = D / V` | 贷款价值比  | CR 的倒数。                   |

使用最新总抵押品和债务，计入利息、费用、赎回和再分配。封装资产须先换算为分支抵押记账单位。

## 推导清算价格

对 `C > 0`、`D > 0`：

$$
CR = \frac{CP}{D}, \qquad LTV = \frac{D}{CP} = \frac{1}{CR}
$$

清算边界为 `CR = MCR`，乘以债务再除以抵押数量：

$$
\frac{CP\_{liq}}{D} = MCR
\quad \Longrightarrow \quad
P\_{liq} = \frac{MCR \times D}{C}
$$

数量和债务固定时，`P < P_liq` 对应 `CR < MCR`，满足合约清算条件。等号处为边界，低于边界才可清算。合约用缩放整数比较。

赎回偿清全部债务后 `D = 0`，此时不能除以债务。抵押品留在 Trove，直到所有人关闭领取。

### 同一起点的五种变化

示例取 `MCR = 150% = 1.5`、`C = 10`、`P = $2`、`D = 10 USDHN`。实际借款使用所选分支参数和最低债务。

初始值：

$$
CR = \frac{10 \times 2}{10} = 200%,
\qquad
P\_{liq} = \frac{1.5 \times 10}{10} = $1.50
$$

各行分别从同一起点变化。

| 变化                        | 新 CR                      | 新清算价格                       | 含义                              |
| ------------------------- | ------------------------- | --------------------------- | ------------------------------- |
| 价格从 `$2` 跌至 `$1.60`       | `(10 × 1.60) / 10 = 160%` | `$1.50`                     | CR 下降，边界价格保持原值。                 |
| 债务从 `10` 增至 `15`          | `(10 × 2) / 15 ≈ 133.3%`  | `(1.5 × 15) / 10 = $2.25`   | 债务提高边界，此新增借款无法通过示例 150% MCR 检查。 |
| 债务从 `10` 还至 `8`           | `(10 × 2) / 8 = 250%`     | `(1.5 × 8) / 10 = $1.20`    | 还款提高 CR、降低边界。                   |
| 抵押从 `10` 增至 `12.5`        | `(12.5 × 2) / 10 = 250%`  | `(1.5 × 10) / 12.5 = $1.20` | 追加抵押提高 CR、降低边界。                 |
| USDHN 市价变化，`C`、`P`、`D` 不变 | `200%`                    | `$1.50`                     | 协议按每 USDHN $1 计算债务，购币还款成本随市价变化。 |

利息随时间增加 `D`，即使 `C` 不变也提高 `P_liq`。单独价格变化在当刻保留原 `P_liq`，后续利息仍会影响下一次计算。

## 预言机价格与界面更新

合约在执行时读取分支价格源。现货价和借款页面价格可能因来源或更新时间不同而有差异。界面反映一次读取，交易按执行时可用数值检查。

抵押率缓冲是当前 CR 与 MCR 的距离。价格下跌或债务增长缩小距离，追加抵押或还款扩大距离。仓位还须满足[借款与清算](/zh/protocol/borrowing-and-liquidation.md)中的分支借款和提取规则。

## 当前债务的构成

$$
D = D\_{recorded} + I\_{accrued} + F\_{batch} + D\_{redistributed}
$$

| 构成    | 来源                          |
| ----- | --------------------------- |
| 已记录债务 | 上次操作记录的未偿债务，含已资本化费用及已应用金额。  |
| 累计利息  | 上次记账后对已记录债务计算的利息。           |
| 累计批量费 | 加入管理批量期间分摊的费用，非批量 Trove 为零。 |
| 再分配债务 | 稳定池未抵销清算债务中分给该仓位的待计份额。      |

开立或增加债务将一次性费计入记录债务。新增数量 `x`、分支平均年利率 `r_avg` 下，7 天费用为：

$$
F\_{upfront} = x \times r\_{avg} \times \frac{7}{365}
$$

合约以定点整数计算并向下取整。钱包收到申请借入量，费用另加到债务。7 天冷却期内调息还可能按重新定价的债务收取一次性费。

清算罚金在清算时从抵押品结算，减少剩余返还量。Trove 关闭后停止常规计息。

## USDHN 市价与还款成本

债务为 `1,000 USDHN` 时，需偿还 `1,000 USDHN`。保留借入代币的钱包可直接使用；已经卖出或花掉的则需重新取得。

对 `1,000 USDHN` 债务，排除新增利息、交易费和滑点：

| USDHN 买入价 | 购入还款数量的成本 |
| --------- | --------- |
| `$1.02`   | `$1,020`  |
| `$0.98`   | `$980`    |

购入成本随市价变化，应还 USDHN 数量随债务记账变化。关闭页面使用最新应还量。

部分还款需保留最低债务。全额还款使用关闭交易，结算后返还抵押品和 Gas 押金。USDHN 不足时，关闭确认页提供支持的兑换和抵押品关闭路径，其费用与滑点影响返还资产。

[赎回与风险](/zh/protocol/redemptions-and-risk.md)说明赎回造成的变化。[风险披露](/zh/security/risk-disclosure.md)覆盖预言机、合约、抵押品和市场风险。


---

# 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://docs.hann.finance/zh/mechanics/deep-dives/cdp-safety.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.
