EIP-2767: Contract Ownership Governance
Author | Soham Zemse, Nick Mudge |
---|---|
Discussions-To | https://github.com/ethereum/EIPs/issues/2766 |
Status | Stagnant |
Type | Standards Track |
Category | ERC |
Created | 2020-07-04 |
Requires | 20, 165, 173 |
Table of Contents
Simple Summary
A standard for Governance contracts that holds the administrative ownership of other smart contracts with voting power distributed as ERC-20
tokens.
Abstract
The following standard defines the implementation of a standard API for a Governance smart contract based on ERC-20
. Existing ERC-173
compatible contracts can upgrade from private key wallet ownership to a Governance smart contract. Adhering to a standard API enables general tools to populate governance information of various projects, thus increasing transparency.
Motivation
Traditionally, many contracts that require that they be owned or controlled in some way use ERC-173
which standardized the use of ownership in the smart contracts. For example to withdraw funds or perform administrative actions.
contract dApp {
function doSomethingAdministrative() external onlyOwner {
// admin logic that can be performed by a single wallet
}
}
Often, such administrative rights for a contract are written for maintenance purpose but users need to trust the owner. Rescue operations by an owner have raised questions on decentralised nature of the projects. Also, there is a possibility of compromise of an owner’s private key.
At present, many governance implementations by ambitious projects need users to visit a specific UI to see governance information about their project. Some examples of live implementations having different API that does the same thing are Compound Governance, Uniswap Governance and Sushiswap Governance. It’s just like if the ERC-20 standard wasn’t finalized, then token projects would have their own block explorer. Adhering to a standard API would enable general tools (like Etherscan) to populate governance information, thus increasing transparency to users. Using widely popular ERC-20
token as a governance token, existing tools built to work with ERC-20
can already display voters. This can result in a wide adoption for contract governance over private key based ownership.
Specification
A Governance contract that is compliant with ERC-2767
shall implement the following interfaces:
/// @title ERC-2767 Governance
/// @dev ERC-165 InterfaceID: 0xd8b04e0e
interface ERC2767 is ERC165 {
/// @notice Gets number votes required for achieving consensus
/// @dev Should cost less than 30000 gas
/// @return Required number of votes for achieving consensus
function quorumVotes() external view returns (uint256);
/// @notice The address of the Governance ERC20 token
function token() external view returns (address);
}
ERC-20
Governance Token
An ERC-2767
Governance Contract should reference an address through token()
that implements ERC-20
interface. token()
is allowed to return self address (address(this)
), if ERC-20
functionalities are implemented in the same contract (one can consider checking out Diamond Standard ERC-2535
to optimise contract size).
Implementations are allowed to have varying ERC-20
’s totalSupply()
(through any standard of minting or burning). But having a fixed quorumVotes()
return value in this case would cause required votes consensus in %
with respect to totalSupply()
to change. To automatically account for this, any custom logic under quorumVotes()
is allowed to return for e.g. 51%
of totalSupply()
.
ERC-165
Interface Identification
An ERC-2767
Governance Contract should also implement ERC-165
. This helps general tools to identify whether a contract is a ERC-2767
Governance contract.
interface ERC165 {
/// @notice Query if a contract implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
/// @dev Interface identification is specified in ERC-165. This function
/// uses less than 30,000 gas.
/// @return `true` if the contract implements `interfaceID` and
/// `interfaceID` is not 0xffffffff, `false` otherwise
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
Rationale
The goals of this EIP have been the following:
- Standardize API of Governance contracts to make it easy for analysis tools to be built.
- Encourage use of
ERC-20
based weighted governance over existing multi-sig (generally limited to 50 max owners) for big projects. - Encourage existing
ERC-173
ownership smart contracts / projects to move to Governance based ownership by removing the effort needed to host custom UI for their project. - Encourage availability of publicly audited governance contracts, just like
ERC-20
which anyone can use. - Make it possible to utilize existing
ERC-20
tools for owners of governance token analysis. - Make future protocols possible that need to interact with governances of multiple projects.
- Keep this EIP minimal and allow another EIPs to standardize any specific functionalities.
Backwards Compatibility
Smart contracts that are ERC-173
compliant can transfer their ownership to a Governance contract. This enables such contracts to become compatible with ERC-2767
Governance.
However, there are some existing projects with governance implementations and most of them have custom APIs (Compound Governance, Uniswap Governance and Sushiswap Governance), since a standard did not exist. Not having an ERC-2767
compatible governance contract means only that general tools might not be able to populate their governance information without including some special code for the project.
For existing governance contracts to get compatible with ERC-2767
:
- Projects can deploy a new governance contract and transfer ownership to it to be
ERC-2767
compatible. This is suitable for those who use Multi-sig wallets for Governance. - It is understood that redeploying governance contracts would be a troublesome task, and contracts who already have functionality similar to
ERC-20
based (weighted votes) have a bit advanced way to avoid it. Basically, they can create a forwarder contract implementsERC-2767
and forwards all calls to the actual non-standard methods. Projects can list the forwarder contract to display the information project’s governance info without requiring any custom code in analysys tool, but this might have certain limitations depending on the project’s existing governance implementation. Specification of forwarder contract is out of scope for this EIP and it may be addressed in another EIP if required.
Implementation
The reference implementations are available in this repository. Publicly audited implementations will be included in future.
Security Considerations
Implementers are free to choose between On-chain and Off-chain consensus. Exact specification is out of scope for this standard (open for other EIPs to standardize). However, this section mentions points that implementers can consider.
On-chain
In such implementations, community can create transaction proposals and vote on it by sending on-chain transactions.
- OpenZeppelin Snapshots can be used to prevent double voting.
Off-chain
- The signatures in off-chain governance implementation can follow recommendations of
ERC-191
orERC-712
. - To prevent replaying signatures, it’d be best if executer is required to sort the signatures based on increasing addresses.
Copyright
Copyright and related rights waived via CC0.
Citation
Please cite this document as:
Soham Zemse, Nick Mudge, "EIP-2767: Contract Ownership Governance," Ethereum Improvement Proposals, no. 2767, July 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2767.