Full‑stack raffle platform where admins create multiple on‑chain raffles and users buy tickets. Winners are selected with Chainlink VRF v2.5, and Chainlink Automation triggers draws on a schedule. A Next.js dApp syncs on‑chain events into Supabase to power dashboards and history views.
Recruiter summary: This project demonstrates end‑to‑end Web3 product development: Solidity (Foundry) smart contracts + Chainlink VRF/Automation, a production-style Next.js App Router dApp (wagmi/viem + Zustand), and an off‑chain index layer (Supabase) for analytics and admin workflows.
- Solidity raffle system with weighted tickets (more tickets = higher chance to win).
- Chainlink VRF v2.5 randomness + Chainlink Automation for upkeep.
- Multi‑raffle factory that deploys and tracks raffle instances.
- Event-driven off‑chain sync to Supabase (raffles, ticket history, winners, revenue).
- Modern dApp stack: Next.js App Router, wagmi/viem, Zustand, Tailwind, Chart.js.
- Foundry scripts + unit/integration tests for reproducible deployments.
| Path | Role |
|---|---|
src/ |
Solidity contracts (Raffle.sol, RaffleFactory.sol). |
script/ |
Foundry deployment + interaction scripts. |
test/ |
Unit + integration tests + Chainlink mocks. |
userinterface/ |
Primary Next.js dApp (landing, user flows, admin dashboard). |
frontend_old/ |
Deprecated UI kept locally but ignored from Git. |
lib/ |
Foundry deps (chainlink, forge-std, foundry-devops, solmate). |
Makefile, foundry.toml |
Common commands and Foundry config. |
RaffleFactory.sol- Owner creates raffles (
CreateRaffle) and maps ids/names to raffle addresses. - Registers a Chainlink Automation upkeep per raffle.
- Manages VRF subscription lifecycle (create/fund/add consumer).
- Owner creates raffles (
Raffle.sol- Users enter by buying a ticketCount:
enterRaffle(uint256 ticketCount). checkUpkeepbecomes true when interval passes and the raffle has players + ETH.performUpkeeprequests randomness from VRF;fulfillRandomWordspicks a weighted winner.- Payout: 10% owner fee, 90% winner payout.
- Users enter by buying a ticketCount:
- Foundry (
forge,cast,anvil) - Node.js 18+
make anvilIn a new terminal:
make deploy-anvilforge testcd userinterface
npm install
npm run devOpen http://localhost:3000.
Create userinterface/.env.local:
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=- Update the on-chain addresses in
userinterface/src/lib/contractData.js(factory address + ABIs). - Update RPCs in
userinterface/src/lib/wagmiConfig.js(currently includes a hard-coded Sepolia RPC and local Anvil).
If you want to deploy to Sepolia, set the required env vars in .env (repo root) and run:
make deploy-sepoliafrontend_old/is intentionally ignored and not part of the maintained code path.broadcast/,cache/,out/contain local artifacts and script logs.

