As part of my learning path of smart contract/blockchain/web3 development I took Cyfrin Updraft course. This repository is a result of me learning Foundry fundamentals lesson. Thank you Patrick and the team for putting together such an amazing learning resource!
The heart of this repository is a FundMe smart contract that represents a simple crowd funding application that allows users to send ETH to contract and keep track of which user contributed how much. The owner of the contract can then withdraw the funds.
P.S. As part of this project I've also used Cursor IDE, which I liked a lot for its native AI capabilities.
As part of lesson I've learned a bunch of things:
- Using onchain oracle to retrieve real world data about ETH/USD conversion rates.
- Using modifiers in smart contract and tests to better organize the code and not repeat myself.
- Learned how to encrypt private key and use it to run deployments and other commands using
and running commands, such as
cast wallet import NAME_OF_THE_KEY --interactivecast send CONTRACT_ADDRESS "store(uint256)" 9903 --rpc-url RPC_URL --account NAME_OF_THE_KEY - Learning about Solidity storage, and some gas optimization techniques to make smart contract deployment and xecution more gas efficient.
- Learned different ways to transfer funds from smart contract to another address.
- Learned Foundry commands to initialze project, build, test and deploy smart contracts locally, as well as to testnets using Alchemy URLs.
- Learned about Foundry
forge,cast,anvilandchiselcomponents. - Learned how to abstract contract address for onchain oracle to be used with
AggregatorV3Interface, so thatFundMecontract and testing can be done in multiple chains without the need to change the code in multiple places. - Writing scripts to be able to use them for deployment and testing purposes.
- Writing unit and integration tests using Solidity and Foundry.
- Using cheatcodes for testing.
- Learned how to run tests on testnet using
forge test --fork-url. - Overview of
foundry.tomlfile. - Creating and working with
Makefileto be able to create shortcuts for complex commands. - Smart contract verification process using Etherscan API key.
- Learning differences between vanilla Foundry and zkSync Foundry.
- Learning about
broadcastfolder andgas-snapshotfiles. And many, many, many other things!
- Clone the repository using
git clone https://github.com/accurec/CyfrinUpdraftCourseFoundryFundMe.git - Install Foundry.
- Run
foundryup. - Run
forge buildto download dependencies for the project and compile the code. - Run
forge testto run tests locally. - To run tests on Sepolia or deploy locally you would need to create
.envfile with the following variables that you can get from runninganvilcommand and also setting up your Alchemy app to connect to Sepolia:LOCAL_RPC_URL,LOCAL_PRIVATE_KEY,SEPOLIA_ALCHEMY_API_URL. Once the values are in.envfile, you can run shortcut commands from theMakefile.