Uses
- Hardhat: compile and run the smart contracts on a local development network
- TypeChain: generate TypeScript types for smart contracts
- Ethers: renowned Ethereum library and wallet implementation
- Waffle: tooling for writing comprehensive smart contract tests
- Solhint: linter
- Prettier Plugin Solidity: code formatter
If you run Node.js in the sandbox, you need to make some adjustments.
Include this in the node-sandbox script:
--mount type=bind,source="${HOME}/.cache/hardhat-nodejs,target=${HOME}/.cache/hardhat-nodejs" \
--mount type=bind,source="${HOME}/.config/hardhat-nodejs,target=${HOME}/.config/hardhat-nodejs" \
--mount type=bind,source="${HOME}/.local/share/hardhat-nodejs,target=${HOME}/.local/share/hardhat-nodejs" \
--mount type=bind,source="${HOME}/.local/share/buidler-nodejs,target=${HOME}/.local/share/buidler-nodejs" \
You might also need to create those directories before running the first time:
mkdir -p ${HOME}/.cache/hardhat-nodejs
mkdir -p ${HOME}/.config/hardhat-nodejs
mkdir -p ${HOME}/.local/share/hardhat-nodejs
mkdir -p ${HOME}/.local/share/buidler-nodejsBefore running any command, make sure dependencies are installed in a reproducible way:
$ YARN_ENABLE_SCRIPTS=false yarn install --immutable-
YARN_ENABLE_SCRIPTS=false-- skips lifecycle scripts (preinstall, postinstall, etc.). -
--immutable-- ensures the lockfile (yarn.lock) isn't modified.
If you already have the enableScripts and enableImmutableInstalls set in your .yarnrc.yml, you can simply run:
$ yarn installTo audit the dependencies, disable enableImmutableInstalls in your .yarnrc.yml and run:
$ yarn npm auditTo apply automatic version bumps where possible, run:
$ yarn npm audit fix$ yarn cleanCompile the smart contracts with Hardhat:
$ yarn compileRun the Mocha tests:
$ yarn testRun test with gas report
$ REPORT_GAS=true yarn testRun test with solidity coverage report
$ yarn coverage- Gas reporter hardhat-gas-reporter
- Etherscan hardhat-etherscan