> For the complete documentation index, see [llms.txt](https://docs.rome.builders/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rome.builders/zh/canton-zk-evm/deposits-withdrawals-payments.md).

# 存款、提款和支付

了解网关如何将 EVM 存款、提现和支付与其 Canton 对应流程关联起来。

网关是链创世中包含的一个 EVM 合约。它记录区块需要 Canton 执行的内容。每个请求称为一条 leg。区块的证明会承诺网关状态，包括按记录顺序排列的 legs 的哈希。

本页介绍 commit `a84e84e439a5cc669c0ae61facf7c8c995d9d564`. 请阅读完整的 [网关 README](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/gateway/README.md) 和 [Daml 接口](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/daml/README.md).

| 记录项 | 网关调用                             | EVM 操作               | Canton 中的操作 `推进`         |
| --- | -------------------------------- | -------------------- | ------------------------ |
| 存入  | `claim(id, token, amount)`       | 向调用者铸造包装代币。          | 将存款人的分配执行到网关。            |
| 提现  | `withdraw(token, amount, party)` | 销毁调用者的包装代币。          | 将由网关托管的 Canton 代币支付给指定方。 |
| 支付  | `pay(id, token, to, amount)`     | 将 ERC-20 从付款方转移给收款方。 | 执行由约定支付条款指定的分配。          |

## 存入 Canton 代币

存款人将一枚 Canton 代币分配给网关，并由运营方作为执行者。存款人签署一个 `DepositRequest` ，其中指定存款 ID、允许领取的 EVM 地址以及分配内容。

该 EVM 地址调用 `claim`。网关向其调用者铸造代币并记录该存款 leg。接收方需要 tROME 作为 gas。构建器将该 leg 与请求、已注册代币和分配内容进行匹配。

`推进` 将该分配执行到网关托管中，并提交铸造包装代币的区块。包装代币有 10 位小数，与 Canton 金额一致。两种金额之间的换算是精确的，不进行四舍五入。

## 提取至 Canton 方

持有人调用 `withdraw` 使用包装代币、金额以及完整的 Canton 方 ID。网关销毁包装代币，并在该 leg 中记录接收方。

接收方必须已签署 `WithdrawalAcceptance`。它会保持有效，直到被归档。构建器还需要已注册工具的足够未锁定网关持仓。如果这些条件不满足，它会将该交易排除在外。

`推进` 通过代币注册表的转移工厂向接收方付款。Canton 转账与包含销毁操作的区块一起提交。构建器每个区块最多包含一种资产的一笔提现，详见 [构建器 README](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/builder/README.md).

## 将一笔支付与一个分配绑定

U 将一枚 Canton 代币分配给 V。U 和 V 签署 `DvpTerms` ，其中指定分配、支付 ID、EVM 代币、EVM 收款方和金额。支付 ID 是 UTF-8 文本的 SHA-256 值 `<U 的方 ID>,<V 的方 ID>,<label>`，以小写十六进制表示。该条款拒绝任何其他 ID。

V 批准网关并调用 `pay` 使用该 ID。网关将 ERC-20 从 V 转给收款方，并记录该支付 leg。 `推进` 使用已签署的条款，将分配从 U 执行到 V。

普通的 ERC-20 转账不会记录任何 leg。即使在同一个区块中将相同代币转给同一收款方，也不能替代 `pay`. 该 [设计中的支付流程](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/docs/DESIGN.md#the-flows) 解释了这种绑定关系。

## 证明固定了什么

每条 leg 记录其类型、ID、代币、账户、金额以及适用时的 Canton 方。网关按顺序对这些 legs 进行哈希。 `推进` 检查其附带的 legs 是否生成了已证明的网关状态中的哈希。缺失、额外、重新排序或被更改的 leg 都会导致交易失败。该检查也涵盖没有 legs 的区块。

证明该区块并不会保留其 Canton 分配。发送方仍可在结算前取回该分配。如果这发生在证明之后，Canton 会拒绝 `推进` 并且 reth 会回退到最后提交的区块。相同的已证明区块不能在移除其 leg 后重新提交。下一次构建会省略该支付，如……所示 [运行 4](https://github.com/rome-protocol/canton-zk-evm/blob/a84e84e439a5cc669c0ae61facf7c8c995d9d564/demo/README.md#results).

## 代币与托管限制

Canton 代币由运营方参与者上的网关方持有。运行该参与者的人可以移动这些代币。注册代币也意味着信任其注册表的 Daml 代码，因为它以网关的权限运行。

直接发送到网关 EVM 地址的代币无法找回。如果代币收取转账费用，或以其他方式转出的金额不同，支付 leg 仍会记录请求金额，而不是实际转账金额。阅读 [信任模型与限制](/zh/canton-zk-evm/trust-model.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.rome.builders/zh/canton-zk-evm/deposits-withdrawals-payments.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.
