Work in progress! These things are changing and to be discussed. There are all suggestions. Feel free to deviate if you need to.
- Prefer Typescript for application code
- Prefer ES6 javascript for quick setup scripts (for easy portability)
- We are using node version 10
We are using npm (but should consider yarn)
All Javascript must be formatted with ESLint using the DAOSTACK configuration.
#.eslintrc.json
{
"extends": "eslint:recommended",
"env": {
"amd": true,
"node": true,
"es6": true
},
"rules": {
"semi": 2,
"eol-last": 2,
"eqeqeq": "error"
}
}
All Solidity files must follow the style guide found here. All Solidity code must pass solium linter check using DAOSTACK configuration.
Use tslint with the recommended settings. Please do not disable too many rules:
# tslint.json
{
"extends": [
"tslint:recommended"
]
}The package.json should include a lint command:
"lint": "tslint --project tsconfig.json -t codeFrame 'src/**/*.ts' 'test/**/*.ts'"We use semantic versioning. That means versions like this (in package.json):
"version": "12.13.110",
Where applicable, use jest for testing
We use Travis for continuous integration
Many of our projects (subgraph, client, alchemy) require some other services to run (ganache, postgres, alchemy-server).
We provide Docker containers and a docker-compose file to start these containers. So, typically, a development or testing session will start with
docker-compose up # with perhaps more argumentsend end with
docker-compose downWe are building all docker containers from the standard Ubuntu base images. The main reason for that is because also travis uses Ubuntu, and so we have similar code in our containers as in the travis container itself.
FROM node:10.13.0
Re-use docker images (but not docker-compose files) from dependencies. I.e. do:
# docker-compose.yml
subgraph:
build:
context: ./node_modules/@daostack/subgraph
# and set up port mapping and volume mounts etc locallyWorking with the containers in your docker files:
docker-compose up # start all doker files, follow all logs
docker-compose up alchemy # start the alchemy container and its dependences, follow the alchemy log
docker-compose logs ganache # follow the logs of the ganache container
docker-compose down -v # stop all containers and network
docker-compose build ganache # (re)build a specific containerGet a bash shell in a container:
docker-compose exec subgraph /bin/bash # log in to the subgraph container- Docker containers are running but you cannot find out where they are. Run
sudo docker stop $(docker ps -a -q)to stop all running containers.
Start ganache with the following options:
--deterministic
--networkId ganache
This will give us a fixed predictable set of accounts to work with (see below), and it will give us a fixed network id to connect to (ganache)
Available Accounts
| ==================
| (0) 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 (~100 ETH)
| (1) 0xffcf8fdee72ac11b5c542428b35eef5769c409f0 (~100 ETH)
| (2) 0x22d491bde2303f2f43325b2108d26f1eaba1e32b (~100 ETH)
| (3) 0xe11ba2b4d45eaed5996cd0823791e0c93114882d (~100 ETH)
| (4) 0xd03ea8624c8c5987235048901fb614fdca89b117 (~100 ETH)
| (5) 0x95ced938f7991cd0dfcb48f0a06a40fa1af46ebc (~100 ETH)
| (6) 0x3e5e9111ae8eb78fe1cc3bb8915d5d461f3ef9a9 (~100 ETH)
| (7) 0x28a8746e75304c0780e011bed21c72cd78cd535e (~100 ETH)
| (8) 0xaca94ef8bd5ffee41947b4585a84bda5a3d3da6e (~100 ETH)
| (9) 0x1df62f291b2e969fb0849d99d9ce41e2f137006e (~100 ETH)
|
| Private Keys
| ==================
| (0) 0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d
| (1) 0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1
| (2) 0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c
| (3) 0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913
| (4) 0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743
| (5) 0x395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd
| (6) 0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52
| (7) 0xa453611d9419d0e56f499079478fd72c37b251a94bfde4d19872c44cf65386e3
| (8) 0x829e924fdf021ba3dbbc4225edfece9aca04b929d6e75613329ca6f1d31c0bb4
| (9) 0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773
|
HD Wallet
| ==================
| Mnemonic: myth like bonus scare over problem client lizard pioneer submit female collect
| Base HD Path: m/44'/60'/0'/0/{account_index}
|
| Gas Price
| ==================
| 20000000000
|
| Gas Limit
| ==================
| 8000000
|
| Listening on 0.0.0.0:8545