Cleanup and readme
simplify bootstrap
This commit is contained in:
parent
0d9b2d7d58
commit
b03095e149
35
README.md
35
README.md
@ -13,11 +13,16 @@ Aragon itself uses the [Truffle framework](http://truffleframework.com/) for som
|
||||
|
||||
### Installation
|
||||
|
||||
All requirements are defined in `package.json`.
|
||||
|
||||
$ npm install
|
||||
|
||||
### Requirements
|
||||
Each of the aragon apps are separate packages:
|
||||
|
||||
All requirements are defined in `package.json`.
|
||||
$ cd apps/[app]
|
||||
$ npm install
|
||||
|
||||
or use the bootstrap command (see below)
|
||||
|
||||
### Local development chain
|
||||
|
||||
@ -28,15 +33,30 @@ chain. Using the ganache simulator no full Ethereum node is required.
|
||||
We use the default aragon-cli devchain command to confgure and run a local
|
||||
development ganache.
|
||||
|
||||
`npm run devchain` (or `aragon devchain --port 7545)
|
||||
$ npm run devchain (or aragon devchain --port 7545)
|
||||
|
||||
To clear/reset the chain use:
|
||||
|
||||
`npm run devchain -- --reset` (or `aragon devchain --port 7545 --reset`)
|
||||
$ npm run devchain -- --reset (or aragon devchain --port 7545 --reset)
|
||||
|
||||
We default to port 7545 for development to not get in conflict with the default
|
||||
Ethereum RPC port.
|
||||
|
||||
### Bootstrap
|
||||
|
||||
1. Run an Ethereum node and ipfs
|
||||
|
||||
$ npm run devchain
|
||||
$ ipfs daemon
|
||||
|
||||
2. Deploy each app to the devchain
|
||||
|
||||
$ npm run deploy:apps
|
||||
|
||||
3. Deploy a new DAO with the latest app versions
|
||||
|
||||
$ npm run deploy:dao
|
||||
|
||||
|
||||
## Contract Deployment
|
||||
|
||||
@ -47,12 +67,11 @@ on the Kredits DAO independently.
|
||||

|
||||
|
||||
A DAO can be deployed using the `scripts/deploy-kit.js` script or with the
|
||||
`npm run deploy:dao:dev` command. This deploys a new Kredits DAO, installs
|
||||
`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.
|
||||
|
||||
## ACL / Permissions
|
||||
|
||||
## Helper scripts
|
||||
|
||||
@ -108,6 +127,10 @@ Run seeds defined in `config/seeds.js`.
|
||||
or
|
||||
$ npm run seeds
|
||||
|
||||
|
||||
## ACL / Permissions
|
||||
|
||||
|
||||
## Upgradeable contracts
|
||||
|
||||
We use aragonOS for upgradeablity of the different contracts.
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.4;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
contract Migrations {
|
||||
address public owner;
|
||||
@ -8,15 +8,15 @@ contract Migrations {
|
||||
if (msg.sender == owner) _;
|
||||
}
|
||||
|
||||
function Migrations() {
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setCompleted(uint completed) restricted {
|
||||
function setCompleted(uint completed) public restricted {
|
||||
last_completed_migration = completed;
|
||||
}
|
||||
|
||||
function upgrade(address new_address) restricted {
|
||||
function upgrade(address new_address) public restricted {
|
||||
Migrations upgraded = Migrations(new_address);
|
||||
upgraded.setCompleted(last_completed_migration);
|
||||
}
|
||||
|
8787
apps/contribution/package-lock.json
generated
8787
apps/contribution/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,12 @@
|
||||
{
|
||||
"name": "app-name",
|
||||
"name": "kredits-contribution",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"@aragon/os": "^4.1.0",
|
||||
"@aragon/cli": "^5.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"start": "npm run start:aragon:ipfs",
|
||||
"start:aragon:ipfs": "aragon run",
|
||||
|
@ -1,63 +1 @@
|
||||
/**
|
||||
* https://github.com/aragon/aragonOS/blob/v4.0.0/truffle-config.js
|
||||
*/
|
||||
const homedir = require('homedir')
|
||||
const path = require('path')
|
||||
|
||||
const HDWalletProvider = require('truffle-hdwallet-provider')
|
||||
const HDWalletProviderPrivkey = require('truffle-hdwallet-provider-privkey')
|
||||
|
||||
const DEFAULT_MNEMONIC = 'explain tackle mirror kit van hammer degree position ginger unfair soup bonus'
|
||||
|
||||
const defaultRPC = (network) =>
|
||||
`https://${network}.infura.io`
|
||||
|
||||
const configFilePath = (filename) =>
|
||||
path.join(homedir(), `.aragon/${filename}`)
|
||||
|
||||
const mnemonic = () => {
|
||||
try {
|
||||
return require(configFilePath('mnemonic.json')).mnemonic
|
||||
} catch (e) {
|
||||
return DEFAULT_MNEMONIC
|
||||
}
|
||||
}
|
||||
|
||||
const settingsForNetwork = (network) => {
|
||||
try {
|
||||
return require(configFilePath(`${network}_key.json`))
|
||||
} catch (e) {
|
||||
return { }
|
||||
}
|
||||
}
|
||||
|
||||
// Lazily loaded provider
|
||||
const providerForNetwork = (network) => (
|
||||
() => {
|
||||
let { rpc, keys } = settingsForNetwork(network)
|
||||
rpc = rpc || defaultRPC(network)
|
||||
|
||||
if (!keys || keys.length == 0) {
|
||||
return new HDWalletProvider(mnemonic(), rpc)
|
||||
}
|
||||
|
||||
return new HDWalletProviderPrivkey(keys, rpc)
|
||||
}
|
||||
)
|
||||
module.exports = {
|
||||
networks: {
|
||||
development: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
network_id: '*'
|
||||
},
|
||||
mainnet: {
|
||||
network_id: 1,
|
||||
provider: providerForNetwork('mainnet')
|
||||
},
|
||||
rinkeby: {
|
||||
network_id: 4,
|
||||
provider: providerForNetwork('rinkeby')
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = require("../../truffle.js");
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.4;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
contract Migrations {
|
||||
address public owner;
|
||||
@ -8,15 +8,15 @@ contract Migrations {
|
||||
if (msg.sender == owner) _;
|
||||
}
|
||||
|
||||
function Migrations() {
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setCompleted(uint completed) restricted {
|
||||
function setCompleted(uint completed) public restricted {
|
||||
last_completed_migration = completed;
|
||||
}
|
||||
|
||||
function upgrade(address new_address) restricted {
|
||||
function upgrade(address new_address) public restricted {
|
||||
Migrations upgraded = Migrations(new_address);
|
||||
upgraded.setCompleted(last_completed_migration);
|
||||
}
|
||||
|
@ -1,63 +1 @@
|
||||
/**
|
||||
* https://github.com/aragon/aragonOS/blob/v4.0.0/truffle-config.js
|
||||
*/
|
||||
const homedir = require('homedir')
|
||||
const path = require('path')
|
||||
|
||||
const HDWalletProvider = require('truffle-hdwallet-provider')
|
||||
const HDWalletProviderPrivkey = require('truffle-hdwallet-provider-privkey')
|
||||
|
||||
const DEFAULT_MNEMONIC = 'explain tackle mirror kit van hammer degree position ginger unfair soup bonus'
|
||||
|
||||
const defaultRPC = (network) =>
|
||||
`https://${network}.infura.io`
|
||||
|
||||
const configFilePath = (filename) =>
|
||||
path.join(homedir(), `.aragon/${filename}`)
|
||||
|
||||
const mnemonic = () => {
|
||||
try {
|
||||
return require(configFilePath('mnemonic.json')).mnemonic
|
||||
} catch (e) {
|
||||
return DEFAULT_MNEMONIC
|
||||
}
|
||||
}
|
||||
|
||||
const settingsForNetwork = (network) => {
|
||||
try {
|
||||
return require(configFilePath(`${network}_key.json`))
|
||||
} catch (e) {
|
||||
return { }
|
||||
}
|
||||
}
|
||||
|
||||
// Lazily loaded provider
|
||||
const providerForNetwork = (network) => (
|
||||
() => {
|
||||
let { rpc, keys } = settingsForNetwork(network)
|
||||
rpc = rpc || defaultRPC(network)
|
||||
|
||||
if (!keys || keys.length == 0) {
|
||||
return new HDWalletProvider(mnemonic(), rpc)
|
||||
}
|
||||
|
||||
return new HDWalletProviderPrivkey(keys, rpc)
|
||||
}
|
||||
)
|
||||
module.exports = {
|
||||
networks: {
|
||||
development: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
network_id: '*'
|
||||
},
|
||||
mainnet: {
|
||||
network_id: 1,
|
||||
provider: providerForNetwork('mainnet')
|
||||
},
|
||||
rinkeby: {
|
||||
network_id: 4,
|
||||
provider: providerForNetwork('rinkeby')
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = require("../../truffle.js");
|
||||
|
23
apps/proposal/contracts/misc/Migrations.sol
Normal file
23
apps/proposal/contracts/misc/Migrations.sol
Normal file
@ -0,0 +1,23 @@
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
contract Migrations {
|
||||
address public owner;
|
||||
uint public last_completed_migration;
|
||||
|
||||
modifier restricted() {
|
||||
if (msg.sender == owner) _;
|
||||
}
|
||||
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setCompleted(uint completed) public restricted {
|
||||
last_completed_migration = completed;
|
||||
}
|
||||
|
||||
function upgrade(address new_address) public restricted {
|
||||
Migrations upgraded = Migrations(new_address);
|
||||
upgraded.setCompleted(last_completed_migration);
|
||||
}
|
||||
}
|
8787
apps/proposal/package-lock.json
generated
8787
apps/proposal/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,7 @@
|
||||
"@aragon/os": "^4.1.0",
|
||||
"@aragon/cli": "^5.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"start": "npm run start:aragon:ipfs",
|
||||
"start:aragon:ipfs": "aragon run",
|
||||
|
@ -1,63 +1 @@
|
||||
/**
|
||||
* https://github.com/aragon/aragonOS/blob/v4.0.0/truffle-config.js
|
||||
*/
|
||||
const homedir = require('homedir')
|
||||
const path = require('path')
|
||||
|
||||
const HDWalletProvider = require('truffle-hdwallet-provider')
|
||||
const HDWalletProviderPrivkey = require('truffle-hdwallet-provider-privkey')
|
||||
|
||||
const DEFAULT_MNEMONIC = 'explain tackle mirror kit van hammer degree position ginger unfair soup bonus'
|
||||
|
||||
const defaultRPC = (network) =>
|
||||
`https://${network}.infura.io`
|
||||
|
||||
const configFilePath = (filename) =>
|
||||
path.join(homedir(), `.aragon/${filename}`)
|
||||
|
||||
const mnemonic = () => {
|
||||
try {
|
||||
return require(configFilePath('mnemonic.json')).mnemonic
|
||||
} catch (e) {
|
||||
return DEFAULT_MNEMONIC
|
||||
}
|
||||
}
|
||||
|
||||
const settingsForNetwork = (network) => {
|
||||
try {
|
||||
return require(configFilePath(`${network}_key.json`))
|
||||
} catch (e) {
|
||||
return { }
|
||||
}
|
||||
}
|
||||
|
||||
// Lazily loaded provider
|
||||
const providerForNetwork = (network) => (
|
||||
() => {
|
||||
let { rpc, keys } = settingsForNetwork(network)
|
||||
rpc = rpc || defaultRPC(network)
|
||||
|
||||
if (!keys || keys.length == 0) {
|
||||
return new HDWalletProvider(mnemonic(), rpc)
|
||||
}
|
||||
|
||||
return new HDWalletProviderPrivkey(keys, rpc)
|
||||
}
|
||||
)
|
||||
module.exports = {
|
||||
networks: {
|
||||
development: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
network_id: '*'
|
||||
},
|
||||
mainnet: {
|
||||
network_id: 1,
|
||||
provider: providerForNetwork('mainnet')
|
||||
},
|
||||
rinkeby: {
|
||||
network_id: 4,
|
||||
provider: providerForNetwork('rinkeby')
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = require("../../truffle.js");
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.4;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
contract Migrations {
|
||||
address public owner;
|
||||
@ -8,15 +8,15 @@ contract Migrations {
|
||||
if (msg.sender == owner) _;
|
||||
}
|
||||
|
||||
function Migrations() {
|
||||
constructor() public {
|
||||
owner = msg.sender;
|
||||
}
|
||||
|
||||
function setCompleted(uint completed) restricted {
|
||||
function setCompleted(uint completed) public restricted {
|
||||
last_completed_migration = completed;
|
||||
}
|
||||
|
||||
function upgrade(address new_address) restricted {
|
||||
function upgrade(address new_address) public restricted {
|
||||
Migrations upgraded = Migrations(new_address);
|
||||
upgraded.setCompleted(last_completed_migration);
|
||||
}
|
||||
|
@ -6,8 +6,7 @@
|
||||
"@aragon/os": "^4.1.0",
|
||||
"@aragon/cli": "^5.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"start": "npm run start:aragon:ipfs",
|
||||
"start:aragon:ipfs": "aragon run",
|
||||
|
@ -1,63 +1 @@
|
||||
/**
|
||||
* https://github.com/aragon/aragonOS/blob/v4.0.0/truffle-config.js
|
||||
*/
|
||||
const homedir = require('homedir')
|
||||
const path = require('path')
|
||||
|
||||
const HDWalletProvider = require('truffle-hdwallet-provider')
|
||||
const HDWalletProviderPrivkey = require('truffle-hdwallet-provider-privkey')
|
||||
|
||||
const DEFAULT_MNEMONIC = 'explain tackle mirror kit van hammer degree position ginger unfair soup bonus'
|
||||
|
||||
const defaultRPC = (network) =>
|
||||
`https://${network}.infura.io`
|
||||
|
||||
const configFilePath = (filename) =>
|
||||
path.join(homedir(), `.aragon/${filename}`)
|
||||
|
||||
const mnemonic = () => {
|
||||
try {
|
||||
return require(configFilePath('mnemonic.json')).mnemonic
|
||||
} catch (e) {
|
||||
return DEFAULT_MNEMONIC
|
||||
}
|
||||
}
|
||||
|
||||
const settingsForNetwork = (network) => {
|
||||
try {
|
||||
return require(configFilePath(`${network}_key.json`))
|
||||
} catch (e) {
|
||||
return { }
|
||||
}
|
||||
}
|
||||
|
||||
// Lazily loaded provider
|
||||
const providerForNetwork = (network) => (
|
||||
() => {
|
||||
let { rpc, keys } = settingsForNetwork(network)
|
||||
rpc = rpc || defaultRPC(network)
|
||||
|
||||
if (!keys || keys.length == 0) {
|
||||
return new HDWalletProvider(mnemonic(), rpc)
|
||||
}
|
||||
|
||||
return new HDWalletProviderPrivkey(keys, rpc)
|
||||
}
|
||||
)
|
||||
module.exports = {
|
||||
networks: {
|
||||
development: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
network_id: '*'
|
||||
},
|
||||
mainnet: {
|
||||
network_id: 1,
|
||||
provider: providerForNetwork('mainnet')
|
||||
},
|
||||
rinkeby: {
|
||||
network_id: 4,
|
||||
provider: providerForNetwork('rinkeby')
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = require("../../truffle.js");
|
||||
|
@ -33,8 +33,8 @@
|
||||
"appName": "dummy.open.aragonpm.eth",
|
||||
"network": "rinkeby"
|
||||
},
|
||||
"rpc": {
|
||||
"network": "rpc",
|
||||
"development": {
|
||||
"network": "development",
|
||||
"appName": "dummy.aragonpm.eth"
|
||||
},
|
||||
"default": {
|
||||
|
22
deploy-apps.sh
Executable file
22
deploy-apps.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
rootDir=`pwd`
|
||||
|
||||
echo "## Kredits app bootstrap"
|
||||
echo ""
|
||||
echo "Setting up each aragon app in ./apps"
|
||||
echo "a new app version will be deployed"
|
||||
echo "----"
|
||||
|
||||
for dir in ./apps/*/; do
|
||||
set -x
|
||||
cd $dir
|
||||
npm install
|
||||
aragon apm publish major
|
||||
cd $rootDir
|
||||
set +x
|
||||
done
|
||||
|
||||
echo "Done, new versions of all apps deployed"
|
10
package.json
10
package.json
@ -7,12 +7,14 @@
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build-json": "aragon contracts compile --all && node ./scripts/build-json.js",
|
||||
"build-json": "npm run compile-contracts && node ./scripts/build-json.js",
|
||||
"repl": "truffle exec scripts/repl/js",
|
||||
"compile-contracts": "aragon contracts compile --all",
|
||||
"bootstrap": "npm run compile-contracts && npm run deploy-dev && truffle exec scripts/seeds.js",
|
||||
"deploy-dev": "ENS=0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1 aragon contracts exec scripts/deploy-kit.js",
|
||||
"devchain": "aragon devchain",
|
||||
"bootstrap": "npm run reset && truffle exec scripts/seeds.js",
|
||||
"reset": "npm run deploy:apps && npm run deploy:dao",
|
||||
"deploy:dao": "npm run compile-contracts && ENS=0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1 aragon contracts exec scripts/deploy-kit.js",
|
||||
"deploy:apps": "./deploy-apps.sh",
|
||||
"devchain": "aragon devchain --port 7545",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
|
15
truffle.js
15
truffle.js
@ -46,14 +46,9 @@ const providerForNetwork = (network) => (
|
||||
)
|
||||
module.exports = {
|
||||
networks: {
|
||||
rpc: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
network_id: '*'
|
||||
},
|
||||
development: {
|
||||
host: 'localhost',
|
||||
port: 8545,
|
||||
port: 7545,
|
||||
network_id: '*'
|
||||
},
|
||||
mainnet: {
|
||||
@ -63,6 +58,14 @@ module.exports = {
|
||||
rinkeby: {
|
||||
network_id: 4,
|
||||
provider: providerForNetwork('rinkeby')
|
||||
},
|
||||
kovan: {
|
||||
network_id: 42,
|
||||
provider: providerForNetwork('kovan')
|
||||
},
|
||||
goerli: {
|
||||
network_id: 5,
|
||||
provider: providerForNetwork('goerli')
|
||||
}
|
||||
},
|
||||
compilers: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user