Before running any command, you need to create a .env file and set a BIP-39 compatible mnemonic as an environment
variable. Follow the example in .env.example. If you don't already have a mnemonic, use this website to generate one.
Then, proceed with installing dependencies:
yarn install
yarn add hardhat
yarn add hardhat-docgenCompile the smart contracts with Hardhat:
$ npx hardhat compileCompile the smart contracts and generate TypeChain artifacts:
$ yarn run typechainLint the Solidity code:
$ yarn lint:solLint the TypeScript code:
$ yarn lint:tsRun the Mocha tests:
$ npx hardhat testGenerate the code coverage report:
$ yarn add hardhat-coverage
$ npx hardhat coverage --testfiles "./test"Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
$ npx hardhat cleanDeploy the contracts to Rinkeby Network:
Token Contract
$ npx hardhat deploy:Token --network rinkebyFactory Contract
$ npx hardhat deploy:Factory --network rinkebyVerify the contracts on Etherscan programatically:
Token Contract
$ npx hardhat verify <address_of_the_deployed_token_contract> --network rinkeby <name_of_the_token> <symbol_of_the_token> Factory Contract
$ npx hardhat verify <address_of_the_deployed_factory_contract> --network rinkebyIf you use VSCode, you can enjoy syntax highlighting for your Solidity code via the hardhat-vscode extension.