Common contracts and libraries used across the various M^0 Solidity projects.
You may have to install the following tools to use this repository:
- foundry to compile and test contracts
- lcov to generate the code coverage report
- yarn to manage npm dependencies
- slither to static analyze contracts
Install dependencies:
yarn
forge installRun the following command to compile the contracts:
forge compileForge is used for coverage, run it with:
yarn coverageYou can then consult the report by opening coverage/index.html:
open coverage/index.htmlTo run all tests:
forge testRun test that matches a test contract:
forge test --mc <test-contract-name>Test a specific test case:
forge test --mt <test-case-name>To run slither:
yarn slitherPrettier is used to format Solidity code. Use it by running:
yarn prettierSolhint is used to lint Solidity files. Run it with:
yarn solhintOr to autofix some issues:
yarn solhint-fixForge is used to generate the documentation. Run it with:
yarn docThe command will generate the documentation in the docs folder and spinup a local server on port 4000 to view the documentation.