6. Hardhat
Hardhat Setup
Deploying SimpleStorage (Method 1)
const { ethers } = require("hardhat");
async function main() {
const SimpleStorageFactory = await ethers.getContractFactory("SimpleStorage");
console.log("Deploying contract...");
const simpleStorage = await SimpleStorageFactory.deploy();
await simpleStorage.deployed();
console.log(`Deployed contract to: ${simpleStorage.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.log(error);
process.exit(1);
});Networks in Hardhat
Programatic Verification
hardhat.config.js
deploy.js
Interacting with Contracts in Hardhat
deploy.js
Artifacts Troubleshooting
Custom Hardhat Tasks
tasks/block-number.js
hardhat.config.js
Hardhat Localhost Node
Hardhat console
Running Tests
test/test-deploy.js
Hardhat Gas Reporter
hardhat.config.js
Solidity Coverage
Hardhat Waffle
Last updated