Skip to content

FoundryFundMe is a decentralized crowdfunding smart contract built using Solidity and Foundry. It integrates Chainlink price feeds to enforce a minimum USD contribution in ETH and has been successfully deployed on the Sepolia testnet with full unit testing using mock data.

Notifications You must be signed in to change notification settings

Atharva-Joshi8999/Foundry_Fund_Repo

Repository files navigation

FundMe Smart Contract (Foundry)

A simple decentralized crowdfunding smart contract built using Solidity and Foundry. It allows users to fund a contract using ETH, and only the contract owner can withdraw the funds. It also integrates Chainlink price feeds for dynamic USD-based funding thresholds.

🚀 Features

  • Accepts ETH from users
  • Enforces minimum funding in USD using Chainlink price feed
  • Owner-only withdrawal
  • Local and testnet deployment supported (Anvil, Sepolia)
  • Environment variable support via .env

📦 Installation

git clone https://github.com/your-username/foundry-fund-me.git
cd foundry-fund-me
forge install
⚙️ Environment Setup
Create a .env file and fill in your credentials:

env
Copy
Edit
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY
MAINNET_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
PRIVATE_KEY=your_private_key_without_0x
⚠️ Never share or commit your real .env file to GitHub. Use .env.example for reference.

📜 Deploy Contracts
➤ Local Deployment (Anvil)
Start Anvil in a separate terminal:

bash
Copy
Edit
anvil
Then run:

bash
Copy
Edit
forge script script/DeployFundMe.s.sol:DeployFundMe \
--rpc-url http://127.0.0.1:8545 \
--private-key $PRIVATE_KEY \
--broadcast \
-vvv
➤ Testnet Deployment (Sepolia)
bash
Copy
Edit
forge script script/DeployFundMe.s.sol:DeployFundMe \
--rpc-url $SEPOLIA_RPC_URL \
--private-key $PRIVATE_KEY \
--broadcast \
-vvv
🧪 Testing
Tests are excluded from this branch. Refer to dev branch for full test coverage.

If included, run:

bash
Copy
Edit
forge test
📖 License
MIT

✨ Author
Atharva Joshi
CS Engineer | Blockchain Developer in Progress 🚀


⭐️ Give this repo a star if you find it helpful!
yaml
Copy
Edit

---

### ✅ Optional: Add `.env.example`

```env
SEPOLIA_RPC_URL=
MAINNET_RPC_URL=
PRIVATE_KEY=

About

FoundryFundMe is a decentralized crowdfunding smart contract built using Solidity and Foundry. It integrates Chainlink price feeds to enforce a minimum USD contribution in ETH and has been successfully deployed on the Sepolia testnet with full unit testing using mock data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published