Compound is a leading decentralized lending protocol that issued the COMP token. This token has accumulated significant value, with its market capitalization hovering around substantial figures. But what is the actual utility of COMP?
Fundamentally, COMP is a governance token. As Compound strives to be a fully decentralized system, it has implemented a decentralized governance mechanism powered by COMP. This same mechanism has been adopted and replicated by other major projects in the DeFi space, such as SushiSwap.
But how does it work in detail?
What is Compound Governance?
At a high level, the governance system is a set of smart contracts. They allow any function on any other smart contract to be called in a decentralized manner from within the governance core contract. In Compound's case, the core contract is set as the admin for the other protocol contracts. This means the core contract gains the ability to call various admin functions, such as adding new markets, changing parameters, and even upgrading the contracts themselves.
COMP token holders are granted voting power. COMP is distributed to active participants within the system, ensuring that those who use Compound can decide its future.
The upgrade functionality is the most powerful. Compound uses a standard proxy upgrade pattern, so by allowing the governance contract to perform upgrades, it can change virtually anything, including the governance mechanism itself.
The governance process follows a strict sequence: proposal creation, voting on the proposal, and a mandatory two-day time lock before execution.
Governance in Practice
Since the governance system is live and ongoing for Compound, you can observe it functioning across several platforms.
- Compound Governance Dashboard: The main hub for governance activity.
- Proposal List: View all past and current proposals for changes.
- Proposal Details: Examine the specifics of a single proposal, including its text description.
- Leaderboard: Statistics on COMP token holders.
- COMP Distribution: Data on which markets received how much COMP.
- Voting App: The primary application for casting votes.
- Timelock App: An interface to view the timelock queue.
You can also inspect the core contracts directly on Etherscan:
- COMP Token Contract
- Core Governance Contract (
GovernorAlpha) - Timelock Contract
A Glimpse into the Governance Smart Contracts
Let's delve into the specifics of the three core governance contracts: the core governance contract (GovernorAlpha.sol), the timelock contract (Timelock.sol), and the COMP token contract itself.
GovernorAlpha.sol
The core logic for creating and executing proposals resides in the GovernorAlpha contract.
The propose() Function
The heart of governance is the propose function. It receives a list of actions, each consisting of:
target: The address where the action will be executed.value: The amount of ether (in wei) to be sent with the call.signature: The function signature to be called (e.g.,transfer(address,uint256)).calldata: The encoded parameters to pass to the function call.
A proposer must have delegated at least 100,000 COMP tokens (≥1% of the initial supply) to their address. Each proposer can only have one active proposal at a time. A human-readable description of the proposal must also be provided.
Referendum: Once a proposal is added, a referendum begins. Addresses that had voting power at the start of the proposal (confirmed via compToken.getPriorVotes) can submit their vote—either for or against—during a 3-day voting period.
The castVote() Function
This function allows an account to vote on a proposal. The account's voting weight is determined by the number of votes delegated to it at the time the proposal state was finalized.
A castVoteBySig function also exists, utilizing EIP-712 offline signatures for gas-less voting, similar to the ERC-20-Permit standard.
The queue() Function
A proposal is successful if:
- A majority of votes are in support.
- At least 400,000 votes (≥4% of the initial supply) are cast.
Once successful, any address can call the queue method to move the proposal into the Timelock queue.
The execute() Function
After the timelock delay has passed, anyone can call the execute method. It will sequentially execute each action in the proposal. For each action, it constructs the calldata by combining the function signature and parameters, then performs a low-level call to the target address.
The cancel() Function
In rare cases, a passed proposal can still be canceled. Currently, a guardian address holds the power to cancel any proposal. If the original proposer loses the required COMP balance after creating a proposal, the proposal can also be canceled. This prevents a scenario where a malicious actor proposes something harmful and then immediately sells their COMP.
Timelock.sol
The Timelock contract is a safety wrapper for proposal execution. Its key parameters are:
- Delay: The number of days a proposal must wait in the queue after being approved before it can be executed. This is configurable by governance between 2 and 30 days (currently set to 2 days).
- Grace Period: The time window after the delay expires during which the proposal must be executed. If this period lapses, the proposal expires and can no longer be executed (currently set to 14 days).
CompToken.sol
Beyond being a standard ERC-20 token, the COMP contract includes specific methods for governance.
delegate()
Users can delegate their COMP voting rights to another address. A delegatee's voting power is the sum of their own COMP balance plus all COMP balances delegated to them. A delegateBySig function is available for permissionless delegation via EIP-712 signatures.
getPriorVotes()
This function is crucial for governance. It retrieves the voting power of an account at a specific past block number. This snapshot mechanism ensures that voting power is fixed at the start of a proposal, preventing manipulation during the voting period.
Compound Autonomous Proposals (CAP)
The requirement of 100,000 COMP to create a proposal is a very high barrier to entry. To foster broader community involvement, a mechanism called Compound Autonomous Proposals (CAP) was introduced. It allows anyone with 100 COMP or more to suggest a proposal. Any CAP that garners 100,000 votes is promoted to be added as a formal governance proposal.
You can view and vote on these autonomous proposals within the Compound voting application.
JS SDK and API
For developers, Compound provides useful tools and APIs for interacting with governance.
- The Compound.js SDK includes governance methods for querying and interacting with proposals programmatically.
- The Compound API offers a Governance Service endpoint to fetch governance-related data.
👉 Explore advanced governance tools
A Real-World Governance Example
Let's examine a real example: Proposal #25, which aimed to add support for the UNI token. The proposal creation transaction shows the list of actions (targets, values, signatures, calldatas).
The actions typically include:
- Setting a new price oracle.
- Marking the new asset market as supported.
- Adding the market to the list of COMP-distributing markets.
- Setting the collateral factor for the asset.
- Setting the reserve factor.
- Setting borrow caps.
The description provides a human-readable rationale for the proposal. Once queued and executed, all these actions are carried out in a single transaction, transparently and verifiably on-chain.
The Future of Decentralized Governance
Compound's governance design is elegantly simple yet powerful. Its model has inspired and been forked by countless other projects in the ecosystem. The future of decentralized governance will undoubtedly involve further innovation, but the core principle remains: true decentralization is achieved by empowering the users and participants of the protocol.
Frequently Asked Questions
What is the main purpose of the COMP token?
The COMP token is primarily a governance token. It grants holders the right to create proposals, vote on changes to the Compound protocol, and delegate their voting power to others. Its value is derived from this ability to influence the direction of a major DeFi protocol.
What is the difference between a proposal and a CAP?
A formal governance proposal requires the proposer to hold 100,000 COMP. A Compound Autonomous Proposal (CAP) is a preliminary suggestion that only requires 100 COMP. If a CAP gains significant community support (100,000 votes), it can be escalated to become a formal proposal for a final vote.
Can a passed proposal be reversed?
Once a proposal is executed, its changes are permanent on the blockchain. However, a new proposal can be created to reverse the effects of a previous one, subject to the same governance process and vote.
What happens if a proposal fails the quorum?
A proposal requires a minimum quorum of 400,000 votes in favor to pass. If it does not meet this quorum, even if a majority of cast votes are "for," the proposal fails and will not be queued for execution.
Who can vote on Compound proposals?
Any address that held COMP tokens (or had COMP delegated to it) at the block number when a proposal was created is eligible to vote on that proposal. The voting power is determined by the token balance at that specific snapshot block.
What is the role of the Timelock contract?
The Timelock contract introduces a mandatory delay between a proposal passing and its execution. This critical security feature gives users of the protocol time to react to upcoming changes, such as exiting positions if they disagree with a decision.