Skip to content

johnpaulcas/foundry-template

Repository files navigation

Foundry Template

This template helps you easily start development with Foundry. Follow the steps below for installation and deployment.

Prerequisites

  1. Git - Download

  2. Foundry (Forge, Anvil, Cast) - Download (make sure to run foundryup at least once)

  3. Node.js - Download

(Optional)

Installation

  1. Fork or clone the project
git clone https://github.com/{{username}}/foundry-template.git
  1. Navigate to the project directory and install dependencies
cd foundry-template
forge install
  1. Create a .env file in the root project directory and populate the following variables (refer to .env.example for reference)
# Replace with your private key
PRIVATE_KEY=0xYOUR_PRIVATE_KEY

# Replace with your Alchemy (https://www.alchemy.com/) or Infura key (https://infura.io/)
SEPOLIA_RPC_URL=YOUR_RPC_URL

# Replace with your Etherscan key (https://etherscan.io/)
ETHERSCAN_API_KEY=YOUR_ETHERSCAN_API_KEY

Deployment

  • Deploy your contract on a local blockchain
npm run deploy:local

Note: Note: Ensure your local blockchain is running. If not, you can start it by running anvil in your terminal:

anvil
  • Deploy and verify your contract on the Sepolia Network
npm run deploy:sepolia
  • Deploy and verify your contract on the Mainnet Network
npm deploy:mainnet