This project serves as a boilerplate codebase for developing, deploying, and managing upgradeable smart contracts using Hardhat. It is designed to streamline the setup process and allow developers to focus on building their unique business logic on top of a solid and tested foundation.
- Pre-configured Hardhat environment.
- Integrated upgradeable smart contract patterns.
- Script for seamless deployment and upgrading of contracts.
Before you begin, ensure you have met the following requirements:
- Node.js v12.x or later installed.
- Yarn or npm for managing packages.
- A basic understanding of Ethereum smart contracts and the Hardhat development environment.
To install the necessary dependencies, follow these steps:
git clone https://github.com/ChaituKReddy/hardhat-upgrades-template
cd hardhat-upgrades-template
npm install
- Set up your
.env
file with the necessary environment variables:
PRIVATE_KEY = "your-wallet-private-key";
MUMBAI_RPC_URL = "your-infura-api-key";
ETHERSCAN_API_KEY = "your-etherscan=api-key";
- Configure the
hardhat.config.js
with the desired network settings.
To compile the contracts, run:
npx hardhat compile
To run tests:
npx hardhat test
To deploy contracts, run:
npx hardhat run scripts/deploy.js --network <network-name>
Replace with the desired network as configured in hardhat.config.js.
To upgrade an existing contract, follow these steps:
- Make changes to your contract code.
- Compile the new contract code.
- Run the upgrade script:
npx hardhat run scripts/upgrade.js --network <network-name>
Contributions to this boilerplate are welcome. Please ensure that your PRs are detailed with what changes have been made and under what circumstances it would be useful.
This project is licensed under the MIT - see the LICENSE file for details.