Hardhat is method of development Dapp similar truffle
It is writing smart contract, and execute compile, test and deploy.
It use ethers.js instead of web3.js
Truffle install global, but hardhat install and run for each individual project use npx
mkdir mydapp
yarn init -y
yarn add hardhat --dev
npx hardhat help
So Many packages are installed.
Select a basic sample project. if you want use typescript, you would select third.
just press enter
then, your structure of these folder is same like these.
folder
- artifacts [result of compile]
- cache
- contracts [smart contract]
- scripts [Execution script of deploy etc]
- test [unit test]
- hardhat-config.js [environment of develop]
hard-hat is based on plugin. so you should install some basic plugins.
Fist of all, let's install uint test plugin.
yarn add @nomiclabs/hardhat-waffle ethereum-waffle chai --dev
Install ethereum web library ethers.js
yarn add @nomiclabs/hardhat-ethers ethers --dev
Then, install openzeppelin updagrade contract plugin
yarn add @openzeppelin/hardhat-upgrades ---dev
You can complete basic step to use hardhat typing the following.
npx hardhat compile
npx hardhat test --network rinkeby ./test/mytest.js
npx hardhat run --network rinkeby ./scripts/mydeploy.js
npx hardhat console --network rinkeby
So, let's typing these to know hardhat tasks.
npx hardhat help
Before writing contract, See basic files of the haradhat.
Create solidity file named SimpleStorageUpgrade in Contracts directory