With this setup you get the following awesome things:
- As you type in code it being compiled and deployed in real time to your local hardhat.
- The address & ABI of the contract(s) is also being stored neatly in a json file.
- No more accidentally re-deploying old contracts as it will skip them.
- One command to verify contracts
This is all possible because of 🎉🎉 hardhat-deploy 🎉🎉.
In this video you will see what your setup will become like.
- Add your contracts by creating a new
*.sol
file in thecontracts
directory. - Then create a
*.js
deployment script in thedeploy
directory for each contract you add. - You may copy-paste existing files to reduce errors.
- In development do:
npm run chain
to get a local hardhat node goingnpm run deploy
to monitor & deploy your contracts to your local chain.
- When ready to move to testnet do:
npm run deploy-goerli
to deploy your new code to goerli chain.npm run verify-goerli
to verify your new code on etherscan.
- When ready to move to mainnet do:
npm run deploy-mainnet
to deploy your new code to mainnet chain.npm run verify-mainnet
to verify your new code on etherscan.
Copy .env.example
and setup your own .env
file. In this file add your keys. Very Important to use your own keys.
- When doing
npm i
ornpm run chain
you are getting error:
Error HH801: Plugin @nomicfoundation/hardhat-toolbox requires the following dependencies to be installed: @nomicfoundation/hardhat-network-helpers, @nomicfoundation/hardhat-chai-matchers, @nomiclabs/hardhat-ethers, @nomiclabs/hardhat-etherscan, @types/chai, @types/mocha, @typechain/ethers-v5, @typechain/hardhat, chai, hardhat-gas-reporter, solidity-coverage, ts-node, typechain, typescript.
Please run: npm install --save-dev "@nomicfoundation/hardhat-network-helpers@^1.0.0" "@nomicfoundation/hardhat-chai-matchers@^1.0.0" "@nomiclabs/hardhat-ethers@^2.0.0" "@nomiclabs/hardhat-etherscan@^3.0.0" "@types/chai@^4.2.0" "@types/mocha@^9.1.0" "@typechain/ethers-v5@^10.1.0" "@typechain/hardhat@^6.1.2" "chai@^4.2.0" "hardhat-gas-reporter@^1.0.8" "solidity-coverage@^0.8.1" "ts-node@>=8.0.0" "typechain@^8.1.0" "typescript@>=4.5.0"
The solution is to just install ☝️ the missing dependencies the error is telling you to install.
Please create a PR 🙏