ERC-2767 Contract governance ownership standard (Contract Ownership Governance)
Stagnant · Vaults & DeFi · created 2020-07-04
A standard interface used when a contract managed under ERC-173 hands over administrative control to an ERC-20 vote-based governance contract instead of a private-key wallet.
Why it is needed
Many contracts have entrusted administrative tasks such as fund withdrawals or configuration changes to a single ERC-173-style private-key owner. Users must trust this owner, the project's decentralization is called into question whenever the owner takes remedial action, and there is also the risk that the private key could be stolen. Meanwhile, projects such as Compound, Uniswap, and Sushiswap that already use vote-based governance each use different custom APIs to accomplish the same thing, so general-purpose analytics tools cannot recognize them. This mirrors the situation before the ERC-20 standard existed, when each token needed its own dedicated block explorer, forcing users to visit a project-specific UI just to view governance information.
What to implement
function quorumVotes() external view returns (uint256);: Returns the number of votes required to reach consensus. Must be callable with less than 30000 gas.function token() external view returns (address);: Returns the address of the ERC-20 token contract used for governance. If the ERC-20 functionality resides in the same contract, it may return its own address.function supportsInterface(bytes4 interfaceID) external view returns (bool);: Queries whether the contract supports a specific interface, per the ERC-165 specification. Must operate with less than 30000 gas.
In depth
Core interface: quorumVotes and token
The ERC2767 interface inherits from ERC165 and requires only two functions. quorumVotes() returns the number of votes required to reach consensus and must be callable with less than 30000 gas. token() returns the address of the ERC-20 token contract used for governance; if the ERC-20 functionality is implemented within the same contract, it may return address(this). The original text adds that the Diamond Standard (ERC-2535) can be used here to optimize contract size.
Quorum design that responds to changes in total supply
Depending on the implementation, an ERC-20's totalSupply() can change due to minting or burning. If quorumVotes() returns a fixed number, the consensus ratio relative to totalSupply() will drift over time. To correct for this automatically, the logic of quorumVotes() can be custom-written to, for example, calculate and return 51% of totalSupply() each time.
Identifying governance contracts via ERC-165
An ERC-2767 governance contract must also implement ERC-165. The function supportsInterface(bytes4 interfaceID) allows external parties to query whether this contract supports a specific interface, and the interface ID for ERC-2767 is 0xd8b04e0e. This lets general-purpose tools automatically determine which contracts are ERC-2767 governance contracts.
Transition path for existing ERC-173 contracts
There are two ways a contract that followed ERC-173 can become compatible with ERC-2767. First, a project that ran governance in a multisig-like manner can deploy a new governance contract and transfer ownership to it. Second, a project that already has weighted-voting-like functionality based on ERC-20 but whose API differs from the standard can implement ERC-2767 while building a forwarder contract that passes calls through to the actual non-standard functions, avoiding the burden of redeploying. However, the original text notes that this approach may have limits depending on the existing governance structure, and the detailed specification of the forwarder contract is out of scope for this EIP and may be covered by another EIP.
On-chain/off-chain consensus is out of scope for the spec
Implementers are free to choose between on-chain consensus and off-chain consensus, and the specific consensus mechanism specification is left open to be standardized in another EIP outside the scope of this standard.
This is still a stalled proposal
This ERC's status is Stagnant, meaning it is a proposal that is no longer actively discussed or has stalled. A reference implementation exists in a public repository, but at the time the original text was written, no publicly audited implementation had been included.
Things to watch out for
- Preventing duplicate voting in on-chain votes: In on-chain governance, the community creates transaction proposals and votes via on-chain transactions. Using OpenZeppelin Snapshots can prevent duplicate voting with the same voting power.
- Recommendation for off-chain signature methods: For signatures used in off-chain governance, it is advisable to follow the recommendations of ERC-191 or ERC-712.
- Preventing signature replay attacks: To prevent signature reuse, it is desirable to require the executor to sort signatures in ascending order of address.