A decentralized solution for farmer registration and produce verification using blockchain.
- agrosafe-contracts/: Smart contracts built with Foundry
- agrosafe-frontend/: React + TypeScript frontend with Wagmi and Reown AppKit
- Node.js 18+ and npm
- Foundry (for contract deployment)
- Git
cd agrosafe-contracts
# Install dependencies
forge install
# Compile contracts
forge build
# Run tests
forge test
# Deploy to local Anvil (for testing)
anvil # In one terminal
forge script script/Deploy.s.sol:Deploy --rpc-url http://localhost:8545 --broadcast # In anothercd agrosafe-frontend
# Install dependencies
npm install
# Create .env.local with your configuration
cp .env.local.example .env.local
# Edit .env.local with your contract address and Reown Project ID
# VITE_AGROSAFE_ADDRESS=<deployed-contract-address>
# VITE_REOWN_PROJECT_ID=<your-reown-project-id>
# Start development server
npm run dev
# Build for production
npm run buildVITE_AGROSAFE_ADDRESS: The deployed AgroSafe contract addressVITE_REOWN_PROJECT_ID: Your Reown/WalletConnect project ID from https://cloud.reown.com/
- Solidity Contract: Fixed Ownable constructor call for OpenZeppelin v5 compatibility
- Frontend TypeScript:
- Consolidated viem imports to avoid duplication
- Fixed walletClient hook usage (wagmi v2 pattern with
.dataproperty) - Added proper environment variable type definitions
- Updated WagmiConfig to WagmiProvider (wagmi v2 API)
- Environment Setup: Created .env.example files for configuration guidance
- Smart contract deployed and verified on target chain
- Contract address added to frontend
.env.local - Reown Project ID configured
- Frontend builds without errors (
npm run build) - Test farmer registration and produce recording flows