This is a basic solidity smart contract meant for learning purposes. Users can 'fund me' through the smart contract; sending eth to the smart contract that the creator can withdraw at any time.
In the spirit of community, I share this project with detailed comments that can help any newbie get started creating smart contracts with solidity.
The project is part of a blockchain developer program by Cyfrin-Updraft; where we learn how to harness the power of the ethereum blockchain to build powerful decentralized applications that empower the users through their decentralized nature. The Fund-Me project is the first complete project with tests and an actual usecase. With it, you can start a fundraiser for your new business idea or any other cause you wish fundraise for.
- git
- You'll know you did it right if you can run
git --versionand you see a response likegit version x.x.x
- You'll know you did it right if you can run
- foundry
- You'll know you did it right if you can run
forge --versionand you see a response likeforge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)
- You'll know you did it right if you can run
git clone https://github.com/kennjr/foundry-fund-me.git
cd foundry-fund-me
make
forge script script/FundMe.s.sol
We talk about 4 test tiers in the video.
- Unit
- Integration
- Forked
- Staging
This repo we cover #1 and #3.
forge test
or
// Only run test functions matching the specified regex pattern.
forge test --match-test testFunctionName
or
forge test --mt testFunctionName
or
forge test --fork-url $SEPOLIA_RPC_URL
Find out how much of the code has been covered by the written tests with the following command.
forge coverage
The instructions here will allow you to work with this repo on zkSync.
In addition to the requirements above, you'll need:
- foundry-zksync
- You'll know you did it right if you can run
forge --versionand you see a response likeforge 0.0.2 (816e00b 2023-03-16T00:05:26.396218Z).
- You'll know you did it right if you can run
- npx & npm
- You'll know you did it right if you can run
npm --versionand you see a response like7.24.0andnpx --versionand you see a response like8.1.0.
- You'll know you did it right if you can run
There's one issue that you might encounter when running the project; the testUserCanFund() test in the integration tests category fails, I haven't yet figured out what the problem might be, I get an OutOfFunds error yet I allocate 100 eth to the account right before the transaction. I welcome any solution to this problem, simply make a PR and I'll check it out.
If you run into any other issues while interacting with the application, you can contribute to it by: reporting the issue and probably suggest a fix for it.
There aren't any plans to further develop this application. Updates will be minimal and primarily bug fixes as I continue to learn and improve my smart contract development skills.
This software is publicly available under the MIT license.