This contract was developed as part of the Cyfrin Updraft Foundry Fundamentals course. It allows users to fund a contract with a minimum USD value in ETH and enables the owner to withdraw the funds. The project uses Chainlink for reliable price feeds and supports zkSync for layer-2 scaling. Designed to improve Foundry and Solidity skills, it is intended for testing on Anvil, Sepolia, and zkSync networks.
- Crowdfunding: Users can fund the contract with ETH.
- Minimum Funding Requirement: Ensures a minimum amount of USD equivalent in ETH is sent.
- Owner Withdrawal: Only the contract owner can withdraw the funds.
- Chainlink Price Feeds: Uses Chainlink oracles to fetch the ETH/USD price.
- zkSync Support: Supports zkSync for transactions.
- Foundry - Ethereum development environment.
- Node.js and npm - For zkSync CLI.
- An Ethereum wallet (e.g., MetaMask).
-
Clone the repository:
git clone https://github.com/juanc004/Foundry-FundMe-Project.git cd Foundry-FundMe-Project
-
Install dependencies and build the project:
make all
-
Update .env variables with your respective values:
SEPOLIA_RPC_URL=<YOUR_SEPOLIA_RPC_URL> PRIVATE_KEY=<YOUR_PRIVATE_KEY> ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_API_KEY> SENDER_ADDRESS=<YOUR_PUBLIC_ADDRESS> DEFAULT_ANVIL_KEY=<YOUR_DEFAULT_ANVIL_KEY> DEFAULT_ZKSYNC_LOCAL_KEY=<YOUR_DEFAULT_ZKSYNC_LOCAL_KEY>
Note: This is a testing contract and should not be used for live purposes with real funds.
To deploy the contract on different networks:
On Anvil:
Start Anvil in a separate terminal:
make anvil
Deploy the contract:
make deploy CHAIN=anvil
On Sepolia:
make deploy CHAIN=sepolia
To fund the contract on different networks:
On Anvil:
make fund Chain=anvil
On Sepolia:
make fund Chain=sepolia
To withdraw funds as the contract owner on different networks:
On Anvil:
make withdraw CHAIN=anvil
On Sepolia:
make withdraw CHAIN=sepolia
To run tests:
make test
make zktest