This template helps you easily start development with Foundry. Follow the steps below for installation and deployment.
-
Git - Download
-
Foundry (Forge, Anvil, Cast) - Download (make sure to run foundryup at least once)
-
Node.js - Download
(Optional)
- Yarn - Download
- Fork or clone the project
git clone https://github.com/{{username}}/foundry-template.git- Navigate to the project directory and install dependencies
cd foundry-template
forge install- Create a
.envfile in the root project directory and populate the following variables (refer to.env.examplefor 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- Deploy your contract on a local blockchain
npm run deploy:localNote: 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