- Open a Git Bash (in Windows) or a terminal (in Mac).
- Create a folder
Solidityand enter it.mkdir Solidity cd Solidity - Initialize a Foundry project.
forge init fundraising - Enter the new folder and open Visual Studio Code.
cd fundraising code . - Move src/Counter.sol elsewhere (e.g., the
origfolder). - Move test/Counter.t.sol elsewhere (e.g., the
origfolder). - Move test/Counter.s.sol elsewhere (e.g., the
origfolder). - Copy all files from
/smart_contracts/code/solidity/fundraisingto yourfundraisingfolder. - Install OpenZeppelin
forge install OpenZeppelin/openzeppelin-contracts --no-commit - Build the contract.
forge build - Deploy the contract using deployment script (and using your private key).
forge script script/FundraiserFactory.s.sol --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
- Open a Git Bash (in Windows) or a terminal (in Mac).
- Create a folder
Weband enter it.mkdir Web cd Web - Create a React + Vite app.
npm create vite@latest fundraising-app -- --template react - Enter the new folder and install Vite.
cd fundraising-app npm install - Install reuqired libraries.
npm install react-router-dom @mui/material @emotion/react @emotion/styled web3 cryptocompare big-integer - Open Visual Studio Code.
code . - Backup
src/App.jsxtosrc/App.jsx.ORIG.mv src/App.jsx src/App.jsx.ORIG - Backup
src/App.csstosrc/App.css.ORIG.mv src/App.css src/App.css.ORIG - Backup
src/main.jsxtosrc/main.jsx.ORIG.mv src/main.jsx src/main.jsx.ORIG - Copy all files from
/smart_contracts/code/web/fundraising-appto yourfundraising-appfolder. - Put
go.cjsinto your app root (i.e., fundraising-app). (You can copy this file from/smart_contracts/code/web/fundraising-app/go.cjs.) - Run
go.cjsto extract the contract's ABI and address.mkdir src/fundraising/abi node go.cjs - View the web page.
npm run dev
Notes:
- Install the
React Developer Toolsplugin in your browser for advanced debugging. forge cleancan remove the build artifacts and cache directories.
Think: How to automatically update fundraiser cards after a fundraising campaign is updated (e.g., donated)?
Credits: The code of this example is based on the work of RedSquirrelTech.

