---
eip: 2767
label: ERC-2767
title: Contract Ownership Governance
status: Stagnant
type: Standards Track
category: ERC
created: 2020-07-04
requires: 20, 165, 173
official: https://eips.ethereum.org/EIPS/eip-2767
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2767.md
canonical: https://eips.huatuo.xyz/zh/eip-2767/
lang: zh
tldr: 面向拥有其他合约的治理合约的最小接口，投票权以 ERC-20 代币形式持有，使区块浏览器和工具能以同样的方式读取任何项目的治理设置。
tags: [governance, dao, ownership, erc-20, interface]
---

# ERC-2767: Contract Ownership Governance

> A standard for Governance contracts that holds the administrative ownership of other smart contracts with voting power distributed as ERC-20 tokens.

**TL;DR:** 面向拥有其他合约的治理合约的最小接口，投票权以 ERC-20 代币形式持有，使区块浏览器和工具能以同样的方式读取任何项目的治理设置。

## 它解决什么问题？

许多合约都有 [ERC-173](/eip-173/) 定义的管理员角色：一个单一的 `owner()` 地址，可以提取资金、暂停或升级。这个 owner 往往只是一把私钥，用户必须信任它，而它也可能被盗。

转向基于代币治理的项目（规范举了 Compound、Uniswap 和 SushiSwap 的 GovernorAlpha 合约为例）各自构建了自己的 API。结果是，区块浏览器这样的通用工具如果没有针对每个项目的定制代码，就无法显示"谁在治理这个合约、需要多少票"，这很像 [ERC-20](/eip-20/) 出现之前的代币支持情况。

## 它如何运作

符合 ERC-2767 的治理合约被设置为其所控制合约的 ERC-173 owner，并公开两个读取函数：

| 函数 | 含义 |
| --- | --- |
| `quorumVotes()` | 达成共识所需的票数 |
| `token()` | 代表投票权的 ERC-20 代币地址 |

规范中的细节：

- 投票权就是 ERC-20 余额，所以现有的代币工具已经能显示投票者是谁。
- 如果治理合约本身实现了 ERC-20，`token()` 可以返回治理合约自己的地址。
- 如果代币供应量发生变化，`quorumVotes()` 可以动态计算其值，例如 `totalSupply()` 的 51 %。
- 合约还必须实现 [ERC-165](/eip-165/)；接口 ID 为 `0xd8b04e0e`。
- 提案如何创建和投票（链上投票，或例如使用 [EIP-712](/eip-712/) 的链下签名）被有意排除在范围之外。

## 示例代码

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IERC165 {
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

/// @dev ERC-165 interface ID: 0xd8b04e0e
interface IERC2767 is IERC165 {
    function quorumVotes() external view returns (uint256);
    function token() external view returns (address);
}

interface IERC20Supply {
    function totalSupply() external view returns (uint256);
}

contract SimpleGovernance is IERC2767 {
    address public immutable token;

    constructor(address governanceToken) {
        token = governanceToken;
    }

    /// Quorum is a simple majority of the current supply.
    function quorumVotes() external view returns (uint256) {
        return IERC20Supply(token).totalSupply() / 2 + 1;
    }

    function supportsInterface(bytes4 id) external pure returns (bool) {
        return id == type(IERC2767).interfaceId || id == type(IERC165).interfaceId;
    }

    // Proposal / voting / execution logic goes here (out of scope for ERC-2767).
}
```

## 需要注意

- **状态：Stagnant。** 该标准没有最终确定。实际上，生态系统收敛到了 OpenZeppelin Governor / Compound Governor Bravo 系列合约，它们公开的接口丰富得多（也不同）。
- 该接口对投票期、提案门槛、时间锁或委托只字未提；而这些才是真正让治理安全的东西，必须另行设计。
- 如规范所建议的，现有治理系统可以通过实现这两个函数的转发合约来增加兼容性。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-2767
