Index
b"# Fluidity Truffle Box\n\nA truffle box providing us with a more comprehensive setup for our truffle repositories.\nIncluded:\n- Circle CI set up\n- Migration Utils\n- [Solidity Coverage](http://github.com/leapdao/solidity-coverage#master)\n- [Eth-gas-reporter](https://github.com/cgewecke/eth-gas-reporter)\n- Solhint\n- Standard ganache\n- Ganache 'unlimited' (unlimited gas and contract size)\n- Slither\n- Mythril\n\n\n## To unbox:\n- Run `truffle unbox airswap/fluidity-truffle-box`\n\n## Circle CI:\nA circle CI configuration file is provided already in the repository. This file is set up to perform:\n- `yarn install`\n- test migrations\n- run all tests and calculate their coverage\n- linting (this does not fix linting issues but reports them)\n- eth-gas-reporter report on gas usage on contract deploys and tests\n- clean up old branches in github\n\n## Migration Utils:\nThis tool integrates with truffle migrations to enable a more comprehensive tracking of deployed contracts\nand their addresses. Utilising `migration_utils.js` enables multiple deployed instances of the same contract\nto be tracked easily, which truffle alone does not allow.\n\n## Solidity Coverage\nWe use a [branch of solidity-coverage written by leapdao](http://github.com/leapdao/solidity-coverage#master),\nwhich enables us to use the newer versions of solidity (0.5.0+).\n\nWe have found that solidity-coverage does not work with some versions of node. Our team use node v8.14.0 and\nv8.16.0 at this current moment in time.\n\nTo run coverage locally, you must run the local coverage network using `yarn ganache-coverage`. In a new\nterminal tab then run `yarn coverage` which will run all truffle tests and calculate coverage. To use\ntruffle with this local blockchain, use `yarn truffle-coverage ___` filling in the command you want to use.\n\n## Solhint\nSolhint is a solidity linter. `.solhint.json` contains our standard linting setup, which can be edited/updated.\n`.solhintignore` marks any files that the linter should ignore e.g. any files that you havent written yourself.\n`yarn lint` will execute solhint on all `.sol` files within the contracts folder.\n\n## Standard Ganache\nGanache can be run on your terminal using the command `yarn ganache`. Using truffle with this can then occur\nusing `yarn truffle ___` where you merely fill in the commands you would like to use.\n\n## Ganache 'Unlimited'\nWe have set up what we call 'ganache unlimited' which allows unlimited block size and unlimited contract size\non ganache. To start this version of ganace run `yarn ganache-unlimited` and interact with it using\n`yarn truffle-unlimited ___`\n\n## Slither\n\nPrerequisites: for the following instructions to work, you must have:\n- python3\n\nFrom within the root of the directory, run the following commands:\n\n```bash\n~ pip3 install virtualenv // to install virtualenv\n~ virtualenv venv-slither // to setup a virtual environment in folder ./venv-slither\n~ source venv-slither/bin/activate // to activate your virtual environment\n~ pip3 install -r slither-requirements.txt // to install the necessary requirements for slither\n```\n\nYour local virtual environment is now setup ready to run slither. To run slither on the contracts, how run\nthe following:\n```bash\nslither .\n```\n\n## Mythril-Classic\n\nIf you do not have a Mac, [please see the wiki for ubuntu or docker setup instructions](https://github.com/ConsenSys/mythril-classic/wiki/Installation-and-Setup)\nPrerequisites: for the following instructions to work, you must have:\n- python3\n- homebrew\n- virtualenv (installed in section above)\n\nFrom within the root of the directory, run the following commands:\n\n```bash\n~ brew update\n~ brew upgrade\n~ brew tap ethereum/ethereum\n~ brew install leveldb\n~ brew install solidity // now you have all the necessary dependencies from brew\n\n~ virtualenv venv-mythril // to setup a virtual environment in folder ./venv-mythril\n~ source venv-mythril/bin/activate // to activate your virtual environment\n~ pip3 install -r mythril-requirements.txt // to install the necessary requirements for mythril\n```\n\n### Now to actually run mythril...\n\n'Mythril-Classic' depends on importing all of the relevant contract imports before analysing the code. Allowing\nthese files to be imported actually has to be enabled,and gets more complex when allowing imports from\nnode-modules (e.g. Open Zeppelin). For this reason it's easier to run mythril on a truffle build folder,\nwhich does all the imports for you.\nTo set this up we therefore run:\n\n```bash\n~ rm -r build // To remove the existing build (in case theres any old files no longer used in there)\n~ yarn truffle compile // To generate a fresh build with the latest versions\n```\n\nNow all `myth` commands just need to be appended with `--truffle` to ensure they use the build folder.\ne.g. the following command will run mythril on all contracts using the build folder:\n```bash\n~ myth -x --truffle\n```"