A crowdsourcing DAPP built to deploy on Ethereum.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This project was created in conjunction with Patrick Collins as part of Cyfrin's Updraft solidity course. This is a simple smart contract which allows crowdsourcing on the Ethereum mainnet.
This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
- git
- If you have correctly installed git you should see a response similar to the one below when you run
git --version
git --version git version x.x.x
- If you have correctly installed git you should see a response similar to the one below when you run
- foundry
- If you have correctly installed git you should see a response similar to the one below when you run
forge --version
forge --version forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)
- If you have correctly installed git you should see a response similar to the one below when you run
- Clone the repo
git clone https://github.com/0x5am/foundry-fund-me
- Navigate to the repo
cd foundry-fund-me
- Execute the makefile
make
forge script script/DeployFundMe.s.sol
The following instructions will allow you to work with this repository in zkSync.
In addition to the requirements above, you will also need:
-
- If you have correctly installed git you should see a response similar to the one below when you run
forge --version
forge --version forge 0.0.2 (816e00b 2023-03-16T00:05:26.396218Z)
- If you have correctly installed git you should see a response similar to the one below when you run
-
-
- If you have correctly installed git you should see a response similar to the one below when you run
npm --version
npm --version 8.1.0
- If you have correctly installed git you should see a response similar to the one below when you run
-
-
- If you have correctly installed git you should see a response similar to the one below when you run
docker --version
docker --version Docker version 20.10.7, build f0df35
- To make sure the daemon is running correctly you should see a similar response when you run
sh docker --info
Client: Context: default Debug Mode: false
- If you have correctly installed git you should see a response similar to the one below when you run
Run the following commands:
npx zk-sync-cli dev config
Select In memory node
and do not select any additional modules.
Then run the following command:
npx zksync-cli dev start
If done correctly, you should see an output similar to the following:
In memory node started v0.1.0-alpha.22:
- zkSync Node (L2):
- Chain ID: 260
- RPC URL: http://127.0.0.1:8011
- Rich accounts: https://era.zksync.io/docs/tools/testing/era-test-node.html#use-pre-configured-rich-wallets
make deploy-zk
This will deploy a mock price feed and fund me contract to the zkSync node using a custom makefile shortcut.
- Set up your environment variables
- You'll want to set your
TESTNET_RPC_URL
andPRIVATE_KEY
as environment variables in a .env file.PRIVATE_KEY
: The private key of your account/wallet (like MetaMask, for example). NOTE: THIS IS FOR DEVELOPMENT PURPOSES ONLY, PLEASE DO NOT USE AN ACCOUNT THAT HAS ANY REAL FUNDS ASSOCIATED.TESTNET_RPC_URL
: This should be the url of whatever testnet node you are working with. This project was tested on the Seplolia testnet, you can set up one for free with Alchemy.- Optionally, you can add your
ETHERSCAN_API_KEY
if you wish to verify your contract on Etherscan.
- Get testnet ETH
- Head over to any faucet (Chainlink, Google, Alchemy). After a few minutes the testnet ETH should appear in your wallet.
- Deploy using the following command:
forge script script/DeployFundMe.s.sol --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY
After deploying to a testnet or local net, you will be able to run the scripts. This can be done using cast when deployed locally:
cast send <FUNDME_CONTRACT_ADDRESS> "fund()" --value 0.1ether --private-key <PRIVATE_KEY>
or
forge script script/Interactions.s.sol:FundFundMe --rpc-url sepolia --private-key $PRIVATE_KEY --broadcast
forge script script/Interactions.s.sol:WithdrawFundMe --rpc-url sepolia --private-key $PRIVATE_KEY --broadcast
cast send <FUNDME_CONTRACT_ADDRESS> "withdraw()" --private-key <PRIVATE_KEY>
You can estimate how much gas each of your functions cost by running the following command:
forge snapshot
If done correctly, you will see an output file called .gas-snapshot
.
Distributed under the MIT License. See LICENSE.txt
for more information.