Welcome to the Sample Hardhat Project! This repository demonstrates the basics of using Hardhat, including deploying a sample smart contract, running tests, and interacting with Hardhat Ignition modules.
Before getting started, ensure you have the following installed on your machine:
-
Clone the repository:
git clone https://github.com/yourusername/sample-hardhat-project.git cd sample-hardhat-project -
Install dependencies:
Using npm:
npm install
Or using Yarn:
yarn install
This project includes several useful Hardhat tasks. Here are some commands you can run to interact with your project:
-
Display Hardhat help:
npx hardhat help -
Run tests:
npx hardhat test -
Run tests with gas reporting enabled:
REPORT_GAS=true npx hardhat test -
Start a local Hardhat node:
npx hardhat node
-
Deploy contract using Hardhat Ignition:
npx hardhat ignition deploy ./ignition/modules/Lock.ts
You can add more commands and scripts in the package.json file to simplify your workflow. For example:
"scripts": {
"test": "npx hardhat test",
"node": "npx hardhat node",
"deploy": "npx hardhat ignition deploy ./ignition/modules/Lock.ts"
}Now, you can run:
npm run test
npm run node
npm run deployHere’s an overview of the project structure:
├── contracts # Solidity contracts
├── tests # Contract tests
├── scripts # Helper scripts for deployment
├── ignition # Hardhat Ignition modules (e.g., deploy modules)
├── hardhat.config.js # Hardhat configuration file
├── package.json # Project metadata and dependencies
└── README.md # Project documentation (this file)
Contributions are welcome! If you’d like to report a bug, suggest an enhancement, or submit a pull request, please review the CONTRIBUTING.md guidelines.
This project is licensed under the MIT License.
Happy coding! If you run into any issues or have questions, feel free to open an issue.