-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Comp Token and Governor Alpha [Release Candidate 1]
This patch builds our official release candidates for the Comp and Governor Alpha systems. We make a number of minor changes from the 2.5 Alpha 2 version, including: * Change proposal and quorum thresholds to 1% and 4% respectively * Make a number of cosmetic changes and updates to events * Add test-net deployments [Ropsten, Goerli] * Add additional unit tests, scenarios and formal verification * Upgrade saddle to include `saddle console` * Upgrade Docker for newest version
- Loading branch information
Showing
35 changed files
with
4,026 additions
and
2,828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,38 @@ | ||
allFiredEvents | ||
build | ||
build_ | ||
node_modules | ||
scenario/node_modules | ||
test | ||
!test/contracts | ||
*.DS_Store | ||
.env | ||
.certora* | ||
certora_* | ||
coverage/ | ||
coverage.json | ||
emv-*/ | ||
networks/test.json | ||
networks/test-abi.json | ||
networks/coverage.json | ||
networks/coverage-abi.json | ||
networks/development.json | ||
networks/development-abi.json | ||
networks/coverage-contracts/* | ||
networks/test-contracts/* | ||
networks/*-contracts.json | ||
networks/*-history | ||
networks/*-settings.json | ||
*.DS_Store | ||
test-results.xml | ||
.tsbuilt | ||
yarn-error.log | ||
scenario/build/webpack.js | ||
.scencache | ||
.solcache | ||
.solcachecov | ||
scenario/.tscache | ||
tests | ||
spec | ||
junit.xml | ||
.build | ||
.last_confs | ||
.git | ||
script/certora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
FROM mhart/alpine-node:11.10.1 | ||
FROM mhart/alpine-node:13.8.0 | ||
|
||
RUN apk update && apk add --no-cache --virtual build-dependencies git python g++ make | ||
RUN yarn global add [email protected] | ||
RUN yarn global add [email protected] | ||
RUN yarn global add typescript | ||
RUN wget https://github.com/ethereum/solidity/releases/download/v0.5.13/solc-static-linux -O /bin/solc && chmod +x /bin/solc | ||
|
||
RUN wget https://github.com/ethereum/solidity/releases/download/v0.5.8/solc-static-linux -O /usr/local/bin/solc && \ | ||
chmod +x /usr/local/bin/solc | ||
|
||
RUN mkdir -p /deploy/compound-protocol/scenario | ||
WORKDIR /deploy/compound-protocol | ||
RUN mkdir -p /compound-protocol | ||
WORKDIR /compound-protocol | ||
|
||
# First add deps | ||
ADD ./package.json /deploy/compound-protocol/ | ||
ADD ./yarn.lock /deploy/compound-protocol/ | ||
RUN yarn install | ||
ADD scenario/package.json /deploy/compound-protocol/scenario | ||
ADD scenario/yarn.lock /deploy/compound-protocol/scenario | ||
RUN ls -la /deploy/compound-protocol | ||
RUN ls -la /deploy/compound-protocol/scenario | ||
RUN cd /deploy/compound-protocol/scenario && yarn install | ||
ADD ./package.json /compound-protocol | ||
ADD ./yarn.lock /compound-protocol | ||
RUN yarn install --lock-file | ||
|
||
# Then rest of code and build | ||
ADD . /deploy/compound-protocol | ||
ADD . /compound-protocol | ||
|
||
RUN truffle compile | ||
ENV SADDLE_SHELL=/bin/sh | ||
ENV SADDLE_CONTRACTS="contracts/*.sol contracts/**/*.sol" | ||
RUN npx saddle compile | ||
|
||
RUN apk del build-dependencies | ||
RUN yarn cache clean | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,37 +75,27 @@ To run compound, pull the repository from GitHub and install its dependencies. Y | |
|
||
git clone https://github.com/compound-finance/compound-protocol | ||
cd compound-protocol | ||
yarn # or `npm install` | ||
|
||
You can then compile and deploy the contracts with: | ||
|
||
yarn run deploy | ||
|
||
Note: this project does not use truffle migrations. The command above is the best way to deploy contracts. To view the addresses of contracts, please inspect the `networks/development.json` file that is produced as an artifact of that command. | ||
yarn install --lock-file # or `npm install` | ||
|
||
REPL | ||
---- | ||
|
||
The Compound Protocol has a simple scenario evaluation tool to test and evaluate scenarios which could occur on the blockchain. This is primarily used for constructing high-level integration tests. The tool also has a REPL to interact with local the Compound Protocol (similar to `truffle console`). | ||
|
||
yarn repl | ||
yarn repl -n development | ||
yarn repl -n rinkeby | ||
|
||
> Read CToken cBAT Address | ||
Command: Read CToken cBAT Address | ||
AddressV<val=0xAD53863b864AE703D31b819d29c14cDA93D7c6a6> | ||
|
||
You can read more about the scenario runner in the [Scenario Docs](https://github.com/compound-finance/compound-protocol/tree/master/scenario/SCENARIO.md) on steps for using the repl. | ||
|
||
Deployment | ||
---------- | ||
|
||
The easiest way to deploy some Erc20 tokens, cTokens and a Comptroller is through scenario scripts. | ||
|
||
Testing | ||
------- | ||
Mocha contract tests are defined under the [test directory](https://github.com/compound-finance/compound-protocol/tree/master/test). To run the tests run: | ||
Jest contract tests are defined under the [tests directory](https://github.com/compound-finance/compound-protocol/tree/master/tests). To run the tests run: | ||
|
||
yarn run test | ||
yarn test | ||
|
||
Integration Specs | ||
----------------- | ||
|
@@ -121,13 +111,13 @@ Code Coverage | |
------------- | ||
To run code coverage, run: | ||
|
||
yarn run coverage | ||
yarn coverage | ||
|
||
Linting | ||
------- | ||
To lint the code, run: | ||
|
||
yarn run lint | ||
yarn lint | ||
|
||
Docker | ||
------ | ||
|
@@ -140,9 +130,56 @@ To run in docker: | |
# Run a shell to the built image | ||
docker run -it compound-protocol /bin/sh | ||
|
||
From within a docker shell, you can interact locally with the protocol via ganache and truffle: | ||
|
||
```bash | ||
/compound-protocol # yarn console -n goerli | ||
Using network goerli https://goerli-eth.compound.finance | ||
Saddle console on network goerli https://goerli-eth.compound.finance | ||
Deployed goerli contracts | ||
comptroller: 0x627EA49279FD0dE89186A58b8758aD02B6Be2867 | ||
comp: 0xfa5E1B628EFB17C024ca76f65B45Faf6B3128CA5 | ||
governorAlpha: 0x8C3969Dd514B559D78135e9C210F2F773Feadf21 | ||
maximillion: 0x73d3F01b8aC5063f4601C7C45DA5Fdf1b5240C92 | ||
priceOracle: 0x9A536Ed5C97686988F93C9f7C2A390bF3B59c0ec | ||
priceOracleProxy: 0xd0c84453b3945cd7e84BF7fc53BfFd6718913B71 | ||
timelock: 0x25e46957363e16C4e2D5F2854b062475F9f8d287 | ||
unitroller: 0x627EA49279FD0dE89186A58b8758aD02B6Be2867 | ||
|
||
> await comp.methods.totalSupply().call() | ||
'10000000000000000000000000' | ||
``` | ||
|
||
Console | ||
------- | ||
|
||
After you deploy, as above, you can run a truffle console with the following command: | ||
|
||
yarn console -n goerli | ||
|
||
This command will start a saddle console conencted to Goerli testnet (see [Saddle README](https://github.com/compound-finance/saddle#cli)): | ||
|
||
```javascript | ||
Using network goerli https://goerli.infura.io/v3/e1a5d4d2c06a4e81945fca56d0d5d8ea | ||
Saddle console on network goerli https://goerli.infura.io/v3/e1a5d4d2c06a4e81945fca56d0d5d8ea | ||
Deployed goerli contracts | ||
comptroller: 0x627EA49279FD0dE89186A58b8758aD02B6Be2867 | ||
comp: 0xfa5E1B628EFB17C024ca76f65B45Faf6B3128CA5 | ||
governorAlpha: 0x8C3969Dd514B559D78135e9C210F2F773Feadf21 | ||
maximillion: 0x73d3F01b8aC5063f4601C7C45DA5Fdf1b5240C92 | ||
priceOracle: 0x9A536Ed5C97686988F93C9f7C2A390bF3B59c0ec | ||
priceOracleProxy: 0xd0c84453b3945cd7e84BF7fc53BfFd6718913B71 | ||
timelock: 0x25e46957363e16C4e2D5F2854b062475F9f8d287 | ||
unitroller: 0x627EA49279FD0dE89186A58b8758aD02B6Be2867 | ||
> await comp.methods.totalSupply().call() | ||
'10000000000000000000000000' | ||
``` | ||
|
||
Discussion | ||
---------- | ||
|
||
For any concerns with the protocol, visit us on [Discord](https://compound.finance/discord) to discuss. | ||
For any concerns with the protocol, open an issue or visit us on [Discord](https://compound.finance/discord) to discuss. | ||
|
||
For security concerns, please email [[email protected]](mailto:[email protected]). | ||
|
||
_© Copyright 2020, Compound Labs, Inc._ | ||
_© Copyright 2020, Compound Labs_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.