Skip to content

compound-developers/compound-governance-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick Start: Compound Governance

Code examples for building your own interface for Compound Protocol Governance. The COMP & Governance smart contracts are live on the Ethereum Main and Ropsten test networks.

Full Quick Start Tutorial on the Compound Medium Blog

What is Compound?

Compound is an open-source, autonomous protocol built for developers, to unlock a universe of new financial applications. Interest and borrowing, for the open financial system. Learn more on the website:

Compound Finance

What is Compound Protocol Governance?

The Compound protocol is upgraded and configured in a decentralized fashion. All changes (from supported assets, to system parameters) are decided by COMP token-holders using the voting system.

Community members can create proposals or vote on proposals to modify the protocol. This is made possible by the Compound Governance smart contract.

In order to participate in governance, users do not need to hold any COMP token in their Ethereum wallet. However, users need to have COMP delegated to their address. Delegation is a utility function in the COMP ERC-20 token contract.

Learn more in the Compound Protocol Governance Documentation.

Examples

The following code examples can be used in a Web3-enabled website.

There are examples for querying the Ethereum blockchain directly as well as examples that use the Compound REST API. Operations that get can be done using either implementation. However set operations must be performed by writing to the blockchain with Web3, which requires ETH to be spent on gas fees.

For latest contract addresses and ABIs, see the networks page in the docs.

Get All COMP Token Holders

Get All Delegates

Get All Proposals (All States)

Get All Ballots for a Proposal

Delegate Your Voting Rights

Cast Your Vote for an Active Proposal

Signature Examples

Running

Clone this repository. Use a Web3 enabled browser (like Brave, or install the MetaMask browser extension). Serve the files from an HTTP server; The HTML files will not work if you open them directly in your browser. The following command line commands includes an HTTP server, which is installed with Node.js and npm.

git clone git@github.com:compound-developers/compound-governance-examples.git
cd compound-governance-examples/
npm install -g http-server
http-server -p 8080

Then go to http://localhost:8080/api-examples/get_proposals in your web browser.

Compound Governance Resources