Before running any command, make sure to install dependencies:
$ npm installCompile the smart contracts with Hardhat:
$ npm run compileCompile the smart contracts and generate TypeChain artifacts:
$ npm run typechainLint the Solidity code:
$ npm run lint:solLint the TypeScript code:
$ npm run lint:tsRun tests using interactive CLI
$ npm run test:runnerRun all the tests:
$ npm run testGenerate the code coverage report:
$ npm run coverageSee the gas usage per unit test and average gas per method call:
$ REPORT_GAS=true npm run testDelete the smart contract artifacts, the coverage reports and the Hardhat cache:
$ yarn cleanDeploy the contracts to Hardhat Network:
$ npm run deployDeploy the contracts to a specific network, such as the Ropsten testnet:
$ npm run deploy:network ropstenIf 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.