##############################################################################################################################################################################
# Title: Hardhat Setup & Deployment
# Description: This script helps you set up a Hardhat project with multiple contracts and deploy them via Ignition to a local network.
##############################################################################################################################################################################

# Node.js and npm must be installed.
# Install Hardhat locally

npm install --save-dev hardhat

# Initialize a new Hardhat project

npx hardhat init

# Example project structure:
# test-project/
# ├── contracts/
# │   ├── Contract1.sol
# │   ├── Contract2.sol
# │   ├── Contract3.sol
# │   ├── Contract4.sol
# │   └── Contract5.sol
# ├── ignition/
# │   └── modules/
# │       └── ContractModule.js
# ├── hardhat.config.js
# └── package.json

# Content of the file ignition/modules/ContractModule.js:
# (commented for inclusion in shell script)

# >>> BEGIN JS MODULE (DO NOT EXECUTE IN SHELL) <<<
# const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
#
# module.exports = buildModule("ContractModule", (m) => {
#   const contract1 = m.contract("Contract1");
#   const contract2 = m.contract("Contract2");
#   const contract3 = m.contract("Contract3");
#   const contract4 = m.contract("Contract4");
#   const contract5 = m.contract("Contract5");
#
#   return { contract1, contract2, contract3, contract4, contract5 };
# });
# >>> END JS MODULE <<<

# Start the local Hardhat network

npx hardhat node

# Deploy the contracts using Hardhat Ignition

npx hardhat ignition deploy ignition/modules/ContractModule.js --network localhost