A comprehensive Solidity smart contract development learning project featuring multiple practical contract examples and Foundry development environment setup.
SolidityBootcamp/
├── Foundry/
│ └── FundMe/ # Crowdfunding contract project
│ ├── src/ # Smart contract source code
│ │ ├── FundMe.sol # Main crowdfunding contract
│ │ └── PriceConverter.sol # Price conversion library
│ ├── script/ # Deployment scripts
│ │ ├── DeployFundMe.s.sol # Deployment script
│ │ ├── HelperConfig.s.sol # Configuration helper
│ │ └── Interactions.s.sol # Interaction script
│ ├── test/ # Test files
│ │ ├── unit/ # Unit tests
│ │ ├── integration/ # Integration tests
│ │ └── mocks/ # Mock contracts
│ ├── lib/ # Dependencies
│ ├── foundry.toml # Foundry configuration
│ └── Makefile # Build scripts
└── RemixSolidity/ # Remix IDE version
├── FundMe/ # Crowdfunding contracts
└── Storage/ # Storage contracts
- Fundraising: Allows users to send ETH for crowdfunding
- Minimum Amount Limit: Each donation requires at least 5 USD worth of ETH
- Price Oracle: Uses Chainlink price oracle to get ETH/USD exchange rate
- Fund Withdrawal: Only contract owner can withdraw all funds
- Fallback Functions: Supports direct ETH sending to contract
- Simple Storage: Basic data storage functionality
- Struct Operations: Demonstrates struct usage
- Mapping Operations: Shows mapping data structure
- Factory Pattern: StorageFactory contract demonstrates contract factory pattern
- Solidity: 0.8.19
- Foundry: Modern Ethereum development framework
- Chainlink: Decentralized oracle network
- Forge: Testing and deployment tools
forge-std: Foundry standard librarychainlink-brownie-contracts: Chainlink contract libraryfoundry-devops: DevOps tools library
cd Foundry/FundMe
forge buildforge test- Set up environment variables
cp .env.example .env
# Edit .env file and add your private key and RPC URL- Deploy to Sepolia testnet
make deploy-sepoliaOr deploy manually:
forge script script/DeployFundMe.s.sol:DeployFundMe \
--rpc-url ${SEPOLIA_RPC_URL} \
--private-key ${PRIVATE_KEY} \
--broadcast \
--verify \
--etherscan-api-key ${ETHERSCAN_API_KEY}The project includes a comprehensive test suite:
- Unit Tests: Test individual function functionality
- Integration Tests: Test contract interactions
- Mock Tests: Use mock contracts for testing
Run specific tests:
forge test --match-test testFundMain functions:
fund(): Send ETH for crowdfundingwithdraw(): Withdraw all funds (owner only)cheaperWithdraw(): More cost-effective withdrawal methodgetAddressToAmountFunded(): Query address donation amountgetFunder(): Get funder addressgetOwner(): Get contract ownergetPriceFeed(): Get price oracle address
Price conversion library:
getPrice(): Get ETH/USD pricegetConversionRate(): Calculate USD equivalent of ETH amount
- Solidity version: 0.8.19
- Remapping configuration: Chainlink contract paths
- Network configuration: Sepolia and zkSync local networks
PRIVATE_KEY: Deployer private keySEPOLIA_RPC_URL: Sepolia testnet RPC URLETHERSCAN_API_KEY: Etherscan API key
- Sepolia: Testnet deployment
- Anvil: Local development network
This project covers the following Solidity concepts:
- Smart contract basics
- Function modifiers
- Error handling
- Events
- Libraries
- Inheritance
- Interfaces
- Test writing
- Deployment scripts
- Price oracle integration