# 5. 合约模版及版本控制

1. **智能合约克隆与代理调用机制**

<mark style="color:blue;">**ComBoox**</mark>系统在其智能合约架构中广泛采用了代理和克隆技术。具体而言，它利用实现模版合约中定义的数据结构、函数和算法，通过委托调机制操作代理合约或克隆合约的状态变量。代理技术使得代理合约能够升级其底层逻辑，而无需改变其地址或已存储的状态变量。与独立部署合约相比，克隆技术显著降低了合约部署的字节码容量和燃料开销。<mark style="color:blue;">**总管理人合约**</mark>及<mark style="color:blue;">**登记簿合约**</mark>均通过代理各自实现模版的方式进行部署，而<mark style="color:blue;">**股东协议合约**</mark>及<mark style="color:blue;">**投资协议合约**</mark>则采用克隆技术进行部署。&#x20;

另外，<mark style="color:blue;">**合约模版**</mark>设计中也大量使用了<mark style="color:blue;">**代理调用**</mark>机制，将大量数据结构定义及其函数和算法都写在了<mark style="color:blue;">**公共库函数合约**</mark>中，从而进一步降低合约模版的字节码容量和部署成&#x672C;**。**

2. **注册中心合约的文档注册表**

<mark style="color:blue;">**注册中心合约**</mark>的另外一项重要功能就是注册并管理<mark style="color:blue;">**合约模版**</mark>及其<mark style="color:blue;">**克隆合约**</mark>，可以方便的用合约地址来检索其文件类别、版本编号、模版作者、文件创建者、创建日期等信息，也可以通过文件编号方便的检索到合约地址。

3. **模板合约类别**

目前在<mark style="color:blue;">**注册中心合约**</mark>中注册的合约模版共有 37 个，每当创设一个新的公司簿记系统，或者起草一份新的<mark style="color:blue;">**股东协议**</mark>、<mark style="color:blue;">**投资协议**</mark>，其实就是在前述合约模版的基础上，在新的合约地址部署了一份或多份<mark style="color:blue;">**代理或克隆合约**</mark>。

**模版合约表**

| ROCKeeper     | RegisterOfConstitution | FundROCKeeper  |
| ------------- | ---------------------- | -------------- |
| RODKeeper     | RegisterOfDirectors    | —              |
| BMMKeeper     | MeetingMinutes         | —              |
| ROMKeeper     | RegisterOfMembers      | —              |
| GMMKeeper     | RegisterOfShares       | FundGMMKeeper  |
| ROAKeeper     | RegisterOfAgreements   | Alongs         |
| ROOKeeper     | RegisterOfOptions      | Options        |
| ROPKeeper     | RegisterOfPledge       | LockUp         |
| SHAKeeper     | InvestmentAgreement    | —              |
| LOOKeeper     | ListOfOrders           | FundLOOKeeper  |
| ROIKeeper     | RegisterOfInvestors    | FundROIKeeper  |
| Accountant    | Cashier                | FundAccountant |
| FundRORKeeper | RegisterOfRedemptions  | AntiDilution   |
| GeneralKeeper | ShareholdersAgreement  |                |

<mark style="color:blue;">**ComBoox**</mark>系统对于公司治理规则的模型设计非常灵活。变更<mark style="color:blue;">**规则解析库合约**</mark>中“规则”的结构体定义和解析函数，就可以变更某一项“规则”的静态参数；变更<mark style="color:blue;">**管理人合约**</mark>某个API的函数算法，就可以改变某一项法律行为的行权条件、行权步骤或者行权结果。而这些改变具体公司治理规则的方法，其实都可以通过起草新的<mark style="color:blue;">**合约模版**</mark>，并将新模版的<mark style="color:blue;">**代理或克隆合约**</mark>纳入到公司簿记系统中来实现。

任何开发者都可以开发<mark style="color:blue;">**合约模版**</mark>，经平台审核后即可纳入到<mark style="color:blue;">**合约模版**</mark>库，成为<mark style="color:blue;">**代理或克隆合约**</mark>的基础。<mark style="color:blue;">**用户**</mark>调用克隆合约行权时，<mark style="color:blue;">**注册中心合约**</mark>将扣减一定金额的<mark style="color:blue;">**CBP**</mark>作为许可费支付给模版作者，而具体的许可费率、优惠政策则由作者本人设定及调整。

关于<mark style="color:blue;">**合约模版**</mark>著作权及许可费的详细安排，以及系统代币<mark style="color:blue;">**CBP**</mark>的经济模型，请见下文。

## 相关源代码

#### &#x20;[DocsRepo](https://github.com/paul-lee-attorney/comboox/blob/master/contracts/lib/DocsRepo.sol)&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://comboox.gitbook.io/whitepaper-cn/xi-tong-zong-shu/5.-he-yue-mo-ban-ji-ban-ben-kong-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
