> 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/dao-he-yue.md).

# DAO合约

DAO 合约保存成员、提案、投票和执行状态。提案动作的可读名称与参数格式可通过 DAO Metadata 查询。

### 查询提案

| 函数                                    | 用途                  |
| ------------------------------------- | ------------------- |
| `getProposal(proposalId)`             | 查询完整提案、票数、参数、备注和状态  |
| `getProposeByPage(page)`              | 每页 20 条分页查询提案，并返回总数 |
| `state(proposalId)`                   | 查询实时状态              |
| `proposalVoteStatus(proposalId,user)` | 查询用户投票状态            |
| `hasVoted(proposalId,user)`           | 判断用户是否已经投票          |
| `voteSupport(proposalId,user)`        | 查询已投票用户支持还是反对       |

状态枚举：`0=None`、`1=Active`、`2=Succeeded`、`3=Defeated`、`4=Executed`。

### 查询成员

* `isDAOMember(user)`：是否为 DAO 成员。
* `isFoundationMember(user)`：是否为基金会成员。
* `daoMemberCount()` / `foundationMemberCount()`：成员数量。
* `getDAOMembers(offset,limit)`：按从 0 开始的偏移量分页返回 DAO 成员。

### 用户操作

* `applyJoinDAO()`：申请加入 DAO，并创建对应提案。
* `proposeByType(actionType,params,remark)`：按动作类型创建提案。
* `voteYes(proposalId)` / `voteNo(proposalId)`：投赞成或反对票。
* `executeProposal(proposalId)`：执行已经通过的提案。

创建提案可能需要支付 `proposalFee()` 指定的 USDT，提交前应查询费用接收地址并完成授权。投票资格和票数以提案创建时的成员版本快照为准。


---

# 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/dao-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.
