FRONT END REPO: https://github.com/umashankar-tech/Simple-Defi-Dapp-Frontend
This project demonstrates a simple DeFi smart contract workflow using Foundry, including local deployment with Anvil and integration with a React frontend.
- Solidity Smart Contract:
SimplePayableAndWithdrawal.sol
for basic payable and withdrawal functionality. - Testing: Comprehensive tests using Forge.
- Local Blockchain: Anvil for local development and testing.
- Deployment Scripts: Automated deployment with Forge scripts.
- Frontend Integration: Designed for easy ABI and address export to React apps.
- Foundry (includes Forge & Anvil)
- Node.js (for React frontend)
forge build
forge test
anvil
forge script script/DeploySimplePayableAndWithdrawal.s.sol --rpc-url http://127.0.0.1:8545 --private-key <your_private_key> --broadcast
After deployment, the ABI is generated at:
out/SimplePayableAndWithdrawal.sol/SimplePayableAndWithdrawal.json
Copy the "abi"
section from this file for use in your React app.
import contractAbi from './abi/SimplePayableAndWithdrawal.json';
// Use contractAbi.abi with ethers.js or web3.js
src/
– Solidity contractsscript/
– Deployment scriptstest/
– Contract testsout/
– Build artifacts (including ABI)broadcast/
– Deployment logs