A provably fair raffle (lottery) smart contract built with Foundry and deployed live on Sepolia, using Chainlink VRF for secure randomness.
This project was built end-to-end: design → testing → deployment → live execution.
- 🎫 Permissionless raffle entry
- 🔒 Secure randomness via Chainlink VRF
- 🧪 Comprehensive testing with Foundry
- 🚀 Live deployment on Sepolia
- ✅ Verified contract on Etherscan
- Network: Sepolia
- Contract: https://sepolia.etherscan.io/address/0xBD2D768B8b332151c6b58BfE0E065ae5118a7749
- All interactions (entry, VRF fulfillment, winner selection) are public and verifiable on-chain.
- Users enter the raffle by paying the entrance fee
- After the interval passes, a winner is requested via Chainlink VRF
- VRF provides verifiable randomness
- A winner is selected and paid automatically
No admin intervention. No trusted party.
This project uses a Makefile to simplify common Foundry workflows.
make build
Run tests
make test
Install dependencies
make installThis installs:
- forge-std
- chainlink-brownie-contracts
- solmate
- foundry-devops
Deploy to Sepolia
make deploy-sepolia
This command:
- Uses the Sepolia RPC from .env
- Deploys using a Foundry keystore account
- Broadcasts transactions
- Verifies the contract on Etherscan
- Environment variables are loaded automatically from .env.
Deployment is handled via Foundry scripts.
forge script script/DeployRaffle.s.sol \
--rpc-url <RPC_URL> \
--account <ACCOUNT_NAME> \
--broadcast \
--verify
Secrets are managed via .env (not committed).
🛠 Tech Stack
- Solidity
- Foundry
- Chainlink VRF
- Sepolia Testnet
This project was built to deeply understand:
- Smart contract testing workflows
- Chainlink VRF integration
- Deployment & verification pipelines
- Real-world EVM behavior