Inbound and outbound treasury
Development follows these processes outlined in development process
To retrieve the project dependencies and before any further tasks will run correctly
npm ciTo enable Husky commit hooks to trigger the lint-staged behaviour of formatting and linting the staged files prior
before committing, prepare your repo with prepare.
npm run preparenpm run build
npm testIf you make changes that don't get picked up then add a clean into the process
npm run clean
npm run build
npm testIf you want to avoid using the convience scripts, then you can execute against Hardhat directly.
Target to run all the mocha tests found in the /test directory, transpiled as necessary.
npx hardhat testRun a single test (or a regex of tests), then pass in as an argument.
npx hardhat test .\test\sample.test.tsThe TypeScript transpiler will automatically as needed, execute through HardHat for the instantiated environment
npx hardhat run .\scripts\bond-deploy.tsLogging is performed with Bunyan
To have the JSON logging output into a more human-readable form, pipe the stdout to the Bunyan CLI tool.
npx hardhat accounts | npx bunyanThe contracts can be deployed locally and their behaviour verified using our local deploy scripts
The contracts can be deployed locally and their behaviour verified using our remote deploy scripts
We use the Trail of Bits Solidity static analyzer Slither.
With Python 3 in your environment, install using the Python package manager pip3:
pip3 install slither-analyzerWhen at the project root, to run and exclude BitDao.sol, anything containing the path contracts\treasury or node_modules:
slither . --filter-paths "BitDAO.sol|contracts/treasury|node_modules"Alternatively to run using a slither.json config file:
slither . --config-file slither.jsonThe Trail of Bits toolbox image contains a number of applications (including Slither).
With Docker in your environment, install the image from DockerHub:
docker pull trailofbits/eth-security-toolboxTo start a new container with your local source mounted/accessible within the container: (replacing <ABSOLUTE_PATH_TO_WORKING_DIRECTORY> with the absolute path to the project working directory)
docker run -it --mount type=bind,source=<ABSOLUTE_PATH_TO_WORKING_DIRECTORY>,destination=/home/ethsec/test-me trailofbits/eth-security-toolboxThe container will automatically start and log you in, with the project code located in test-me.
Navigate into the test-me directory and run the static analysis:
cd test-me
slither . --filter-paths "BitDAO.sol|contracts/treasury|node_modules"Alternatively to run using a slither.json config file:
cd test-me
slither . --config-file slither.jsonThe size of all contract can be display in a table using a custom task that runs under yarn
yarn run hardhat size-contractsMarkdown files can be generated from the Solidity files
npx hardhat docgenThe output mirrors the Solidity file structure and will be found at ./solidity-docs.