This repository contains smart contracts for creating a provably random lottery. The lottery ensures fairness and randomness using Chainlink VRF and automates the draw process with Chainlink Automation.
User Participation: Users can enter the lottery by purchasing tickets. Prize Pool: All collected ticket fees are awarded to the winner. Automated Draw: The lottery will automatically draw a winner after a set period. Chainlink Integration. Chainlink VRF: Ensures randomness. Chainlink Automation: Triggers the draw at specified intervals.
Users enter the lottery by paying for a ticket. Ticket fees are collected and pooled for the prize.
After a predetermined period, the lottery draws a winner programmatically. The draw uses Chainlink VRF to ensure randomness. Chainlink Automation triggers the draw based on the specified time interval.
To deploy the contracts, use the provided Makefile which automates the deployment process. Ensure you have the necessary environment variables and dependencies set up.
Environment Variables Ensure you have the following environment variables configured:
RPC_URL
: Your Ethereum test RPC URL like sepolia
PRIVATE_KEY
: Your private key for deployment.
ETHERSCAN_API_KEY
: Your Etherscan API key for contract verification.
Use the Makefile to deploy the contracts. The deployment script is configured to handle the deployment process.
make deploy
This command will:
Compile the contracts. Deploy the contracts to the Ethereum testNet. Verify the contracts on Etherscan. Testing The repository includes tests to ensure the contracts function as expected. Tests are written to run on a local chain, a forked testnet, and a forked mainnet.
To run the tests, use the provided Makefile:
make test
This will execute the test suite and provide feedback on the contract functionality.