Update README and npm scripts for hardhat
This commit is contained in:
parent
24990de42a
commit
53dbc1e4ad
132
README.md
132
README.md
@ -50,7 +50,7 @@ development ganache.
|
||||
|
||||
To clear/reset the chain use (e.g. if you run out of funds on your devchain)
|
||||
|
||||
$ npm run devchain -- --reset (or aragon devchain --port 7545 --reset)
|
||||
$ npm run devchain --
|
||||
|
||||
We default to port 7545 for development to not get in conflict with the default
|
||||
Ethereum RPC port.
|
||||
@ -68,52 +68,35 @@ if you want to increase the block time to 10 seconds you can add
|
||||
|
||||
2. Compile contracts
|
||||
|
||||
(compiled contracts will be in `/build`)
|
||||
(compiled artifacts will be in `/artifacts`)
|
||||
$ npm run compile-contracts
|
||||
|
||||
3. Deploy each app to the devchain
|
||||
3. Deploy a new KreditsKit and create a new DAO with the latest app versions
|
||||
|
||||
(make sure you've run `npm install` for every app - see installation)
|
||||
$ npm run deploy:apps
|
||||
|
||||
4. Deploy a new KreditsKit and create a new DAO with the latest app versions
|
||||
|
||||
$ npm run deploy:kit
|
||||
$ npm run deploy:dao
|
||||
|
||||
5. Execute seeds to create demo contributors, contributions, etc. (optional)
|
||||
4. Execute seeds to create demo contributors, contributions, etc. (optional)
|
||||
|
||||
$ npm run seeds
|
||||
|
||||
**Step 2-5 is also summarized in `npm run bootstrap`**
|
||||
**Step 2-4 is also summarized in `npm run bootstrap`**
|
||||
|
||||
If you want to reset your local setup:
|
||||
5. Show contract addresses
|
||||
|
||||
$ npm run reset // deploys a new kit and a new DAO
|
||||
$ npm run reset:hard // deploys all apps and does reset
|
||||
$ cat lib/addresses.json
|
||||
|
||||
## Contract architecture
|
||||
|
||||
Contracts are organized in independent apps (see `/apps`) and are developed and
|
||||
deployed independently. Each app has a version and can be "installed" on the
|
||||
Kredits DAO independently.
|
||||
|
||||

|
||||
|
||||
A DAO can be deployed using the `scripts/deploy-kit.js` script or with the
|
||||
`npm run deploy:dao` command. This deploys a new Kredits DAO, installs the
|
||||
latest app versions and sets the required permissions.
|
||||
|
||||
See each app in `/apps/*` for details.
|
||||
We use the [OpenZeppelin hardhat proxy](https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades) for deploying and managing upgradeable contracts. (see `scripts/create-proxy.js`)
|
||||
|
||||
Each contract is independent and is connected to its dependencies by storing the addresses of the other contracts.
|
||||
|
||||
## Helper scripts
|
||||
|
||||
`scripts/` contains some helper scripts to interact with the contracts from the
|
||||
CLI. _At some point these should be moved into a real nice CLI._
|
||||
|
||||
To run these scripts use `truffle exec`. For example: `truffle exec
|
||||
scripts/add-proposal.js`.
|
||||
To run these scripts use `hardhat run`. For example: `hardhat run scripts/list-contributors.js --network localhost`. (NOTE: add `--network localhost` or the network you want to use)
|
||||
|
||||
Some scripts are also defined as npm script, see package.json.
|
||||
|
||||
@ -128,116 +111,37 @@ Call any function on any contract:
|
||||
Similar to cli.js but only provides a REPL with an initialized `kredits`
|
||||
instance.
|
||||
|
||||
$ truffle exec scripts/repl.js
|
||||
$ hardhat console --network localhost
|
||||
|
||||
### add-{contributor, contribution, proposal}.js
|
||||
|
||||
Script to add a new entries to the contracts using the JS wrapper
|
||||
|
||||
$ truffle exec scripts/add-{contributor, contribution, proposal}.js
|
||||
$ hardhat run scripts/add-{contributor, contribution, proposal}.js --network localhost
|
||||
|
||||
### list-{contributors, contributions, proposals}.js
|
||||
|
||||
List contract entries
|
||||
|
||||
$ truffle exec scripts/list-{contributors, contributions, proposals}.js
|
||||
|
||||
### send-funds.js
|
||||
|
||||
Sends funds to an address. Helpful in development mode to for example fund a
|
||||
metamask account.
|
||||
|
||||
$ truffle exec scripts/send-funds.js
|
||||
$ hardhat run scripts/list-{contributors, contributions, proposals}.js --network localhost
|
||||
|
||||
### seeds.js
|
||||
|
||||
Run seeds defined in `config/seeds.js`.
|
||||
|
||||
$ truffle exec scripts/seeds.js
|
||||
or
|
||||
$ npm run seeds
|
||||
|
||||
### current-address.js
|
||||
### Get the contract addresses
|
||||
|
||||
Prints all known DAO addresses and the DAO address for the current network
|
||||
All contract addresses are stored in `lib/addresses.json`
|
||||
|
||||
$ truffle exec scripts/current-address.js
|
||||
or
|
||||
$ npm run dao:address
|
||||
|
||||
### deploy-kit.js
|
||||
|
||||
Deploys a new KreditsKit that allows to create a new DAO
|
||||
|
||||
$ truffle exec script/deploy-kit.js
|
||||
or
|
||||
$ npm run deploy:kit
|
||||
|
||||
#### Kredits configuration options:
|
||||
|
||||
Configuration options can be set in an environment specific `kredits` object in the `arapp.json` or using a CLI parameter.
|
||||
|
||||
* daoFactory: Ethereum address of the used DAO Factory. On public networks we use [official aragon factories](https://github.com/aragon/deployments/tree/master/environments/)
|
||||
* apmDomain: the ENS domain of the aragonPM (normally `open.aragonpm.eth`)
|
||||
|
||||
(please also see the [arapp.json related configuration options](https://hack.aragon.org/docs/cli-global-confg#the-arappjson-file))
|
||||
|
||||
### new-dao.js
|
||||
|
||||
Creates and configures a new DAO instance.
|
||||
|
||||
$ truffle exec script/new-dao.js
|
||||
or
|
||||
$ npm run deploy:dao
|
||||
|
||||
KreditsKit address is loaded from `lib/addresses/KreditsKit.json` or can be
|
||||
configured through the `KREDITS_KIT` environment variable.
|
||||
|
||||
### deploy-apps.sh
|
||||
|
||||
Runs `npm install` for each app and publishes a new version.
|
||||
|
||||
$ ./scripts/deploy-apps.sh
|
||||
or
|
||||
$ npm run deploy:apps
|
||||
|
||||
## Deployment
|
||||
|
||||
### Apps deployment
|
||||
|
||||
To deploy a new app version run:
|
||||
|
||||
$ aragon apm publish major --environment=NETWORK_TO_DEPLOY
|
||||
|
||||
### KreditsKit
|
||||
|
||||
deploy the KreditsKit as Kit to create new DAOs
|
||||
|
||||
$ truffle exec scripts/deploy-kit.js --network=NETWORK_TO_DEPLOY
|
||||
|
||||
### Creating a new DAO
|
||||
|
||||
make sure all apps and the KreditsKit are deployed, then create a new DAO:
|
||||
|
||||
$ truffle exec scripts/new-dao.js --network=NETWORK_TO_DEPLOY
|
||||
|
||||
## ACL / Permissions
|
||||
$ cat lib/addresses.json
|
||||
|
||||
## Upgradeable contracts
|
||||
|
||||
We use aragonOS for upgradeability of the different contracts. Refer to the
|
||||
[aragonOS upgradeablity documentation](https://hack.aragon.org/docs/upgradeability-intro)
|
||||
for more details.
|
||||
We use OpenZeppelin for an upgradeable contracts: [https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades](https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades)
|
||||
|
||||
### Example
|
||||
|
||||
1. Setup (see #Bootstrap)
|
||||
1. Deploy each contract/apps (see `/apps/*`)
|
||||
2. Create a new DAO (see scripts/deploy-kit.js)
|
||||
2. Update
|
||||
1. Deploy a new Version of the contract/app (see `/apps/*`)
|
||||
2. Use the `aragon dao upgrade` command to "install" the new version for the DAO
|
||||
(`aragon dao upgrade <DAO address> <app name>`)
|
||||
Refer to the OpenZeppelin README and `scripts/create-proxy.js`
|
||||
|
||||
## Known Issues
|
||||
|
||||
|
12
package.json
12
package.json
@ -10,17 +10,13 @@
|
||||
"wallet:create": "hardhat create-wallet",
|
||||
"devchain": "hardhat node --network hardhat",
|
||||
"deploy:dao": "hardhat run scripts/create-proxy.js --network localhost",
|
||||
"seed": "hardhat run scripts/seeds.js --network localhost",
|
||||
"seeds": "hardhat run scripts/seeds.js --network localhost",
|
||||
"install-all": "./scripts/every-app.sh \"npm install\"",
|
||||
"postshrinkwrap": "node scripts/fix-package-lock.js &>/dev/null || true",
|
||||
"build-json": "npm run compile-contracts && node ./scripts/build-json.js",
|
||||
"repl": "truffle exec scripts/repl.js",
|
||||
"seeds": "truffle exec scripts/seeds.js",
|
||||
"compile-contracts": "truffle compile --all",
|
||||
"bootstrap": "npm run reset:hard && npm run seeds",
|
||||
"reset": "npm run deploy:kit && npm run deploy:dao",
|
||||
"reset:hard": "npm run compile-contracts && npm run deploy:apps && npm run reset",
|
||||
"dao:address": "truffle exec scripts/current-address.js",
|
||||
"repl": "hardhat console --network localhost",
|
||||
"compile-contracts": "hardhat compile --force",
|
||||
"bootstrap": "npm run deploy:dao && npm run seeds",
|
||||
"lint:contracts": "solhint \"contracts/**/*.sol\" \"apps/*/contracts/**/*.sol\"",
|
||||
"lint:contract-tests": "eslint apps/*/test",
|
||||
"lint:wrapper": "eslint lib/",
|
||||
|
Loading…
x
Reference in New Issue
Block a user