Skip to content

adityaxxz/foundry-fund-me

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FundMe Smart Contract

A decentralized funding contract that allows users to send ETH while ensuring a minimum USD value, Built with Foundry.

📜 Contract Details

  • Etherscan verified contract here
  • Uses Chainlink Price Feeds for accurate ETH/USD conversion
  • Implements withdrawal pattern
  • Gas-optimized operations
  • Comprehensive test suite

Core Features

  • Funding: Users can send ETH (minimum $5 USD equivalent)
  • Price Feed Integration: Real-time ETH/USD conversion via Chainlink
  • Withdrawal: Only owner can withdraw accumulated funds
  • Gas Optimized: Implements gas-efficient withdrawal patterns
  • Security: Owner-only functions, secure fund management

Built With

  • Foundry - Development framework
  • Chainlink - Price Feed Oracle
  • Solidity version ^0.8.18

🚀 Getting Started

Prerequisites

Installation

  1. Clone this repository:
git clone https://github.com/yourusername/foundry-fund-me
cd foundry-fund-me
  1. Install dependencies:
forge install
  1. Build the project:
forge build

Running Tests

# Run all tests
forge test

# Run tests with gas report
forge test --gas-report

# Run a specific test
forge test --match-test testFunctionName

# Run tests with verbosity
forge test -vv

Usage

Deploy

  1. Setup environment variables:
cp .env.example .env
# Add your RPC_URL and PRIVATE_KEY to .env
  1. Deploy:
forge script script/DeployFundMe.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Interact with Contract

Fund the contract:

forge script script/Interactions.s.sol:FundFundMe --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Withdraw funds (only owner):

forge script script/Interactions.s.sol:WithdrawFundMe --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Testing

The project includes:

  • Unit tests
  • Integration tests
  • Forked network tests

Test Coverage

forge coverage

License

This project is licensed under the MIT License - see the LICENSE file for details

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published