Skip to content
 
 

Repository files navigation

Sample Hardhat Project

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.

Table of Contents

Prerequisites

Before getting started, ensure you have the following installed on your machine:

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/sample-hardhat-project.git
    cd sample-hardhat-project
  2. Install dependencies:

    Using npm:

    npm install

    Or using Yarn:

    yarn install

Usage

Running Hardhat Tasks

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

Additional Commands

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 deploy

Project Structure

Here’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)

Contributing

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.

License

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages