Before running any command, make sure to install dependencies:
$ npm install
Compile the smart contracts with Hardhat:
$ npm run compile
Compile the smart contracts and generate TypeChain artifacts:
$ npm run typechain
Lint the Solidity code:
$ npm run lint:sol
Lint the TypeScript code:
$ npm run lint:ts
Run tests using interactive CLI
$ npm run test:runner
Run all the tests:
$ npm run test
Generate the code coverage report:
$ npm run coverage
See the gas usage per unit test and average gas per method call:
$ REPORT_GAS=true npm run test
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
$ yarn clean
Deploy the contracts to Hardhat Network:
$ npm run deploy
Deploy the contracts to a specific network, such as the Ropsten testnet:
$ npm run deploy:network ropsten
If you use VSCode, you can enjoy syntax highlighting for your Solidity code via the vscode-solidity extension. The recommended approach to set the compiler version is to add the following fields to your VSCode user settings:
{
"solidity.compileUsingRemoteVersion": "v0.8.4+commit.c7e474f2",
"solidity.defaultCompiler": "remote"
}
Where of course v0.8.4+commit.c7e474f2
can be replaced with any other version.