Foundry Fund Me is a simple crowdfunding smart contract suite built with Foundry—a fast, modular toolkit for Ethereum development.
- Fund the contract: Users can send ETH to support your project.
- Owner withdrawal: Only the contract owner can withdraw accumulated funds.
- Chainlink Price Feeds: Enforces a USD-denominated minimum contribution.
- Access control: Secure withdrawal using OpenZeppelin’s
Ownablepattern.
-
Install Git & Git Bash Download Git (includes Git Bash) from https://git-scm.com/downloads and follow the installer.
-
Install Node.js Download the Windows installer from https://nodejs.org/en/download/ and run it. Verify:
node -v npm -v
-
(Optional) Set up WSL
-
Open PowerShell as Administrator and run:
wsl --install -
Restart, then install a Linux distro from Microsoft Store (e.g., Ubuntu).
-
In your WSL shell, install Git and Node.js via your distro’s package manager.
-
-
Install Foundry In Git Bash or WSL:
curl -L https://foundry.paradigm.xyz | bash foundryup
-
Install Git (if not already installed):
# macOS (with Homebrew) brew install git # Ubuntu sudo apt update && sudo apt install git -y
-
Install Node.js
# macOS (with Homebrew) brew install node # Ubuntu curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install -y nodejs
-
Install Foundry
curl -L https://foundry.paradigm.xyz | bash foundryup
-
Configure
.envCreate a.envfile in project root:RPC_URL=your_rpc_url PRIVATE_KEY=your_private_key ETHERSCAN_API_KEY=your_etherscan_api_key
Add
.envto.gitignore. -
(Recommended) Create a Wallet Keystore
cast wallet import BOB --interactive
Keystore saved to
~/.foundry/keystores.Deploy with keystore:
forge script script/DeployFundMe.s.sol:DeployFundMe \ --rpc-url $RPC_URL \ --account BOB \ --broadcast \ --verify \ -vvvv
src/ Solidity contracts (FundMe.sol, PriceConverter.sol)
script/ Deployment scripts (Forge scripts)
test/ Unit & integration tests (Forge)
lib/ External libraries (forge-std)
broadcast/ Deployment logs & artifacts
anvilforge build
forge testMainnet/Testnet
forge script script/DeployFundMe.s.sol:DeployFundMe \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--broadcast \
--verify \
-vvvvLocal Anvil
# terminal A:
anvil
# terminal B:
forge script script/DeployFundMe.s.sol:DeployFundMe \
--rpc-url http://127.0.0.1:8545 \
--private-key $PRIVATE_KEY \
--broadcast \
-vvvv# Get balance
cast balance <address> --rpc-url $RPC_URL
# Read-only call
cast call <contract_addr> "functionName(type)" <args> --rpc-url $RPC_URL
# Send transaction
cast send <contract_addr> "functionName(type)" <args> --rpc-url $RPC_URL --private-key $PRIVATE_KEY| Command | Description |
|---|---|
forge fmt |
Format contracts |
forge snapshot |
Record gas usage for functions |
anvil |
Start local Ethereum node |
cast --help |
Show Cast CLI help |
- Fork the repo.
- Create a branch (
git checkout -b feature/xyz). - Make changes & commit.
- Push & open a PR.
Ensure tests pass.
This project is licensed under the MIT License.