Mohd Shariq
- GitHub: @Shariq103
This is a Provably Fair Smart Contract Lottery built using Solidity and Foundry. It leverages Chainlink VRF for verifiable randomness and Chainlink Automation for time-based triggers, ensuring a completely decentralized and automated gaming experience.
- Truly Random: Uses Chainlink VRF (Verifiable Random Function) to select a winner. No one (not even the developer) can manipulate the result.
- Automated: Uses Chainlink Automation (Keepers) to automatically trigger the winner selection after a set interval.
- Decentralized: The logic lives entirely on the blockchain (Sepolia/Ethereum).
- Gas Efficient: Optimized code structure following best practices.
- Robust Testing: Includes comprehensive Unit and Integration tests using Foundry.
- Language: Solidity ^0.8.19
- Framework: Foundry (Forge, Cast, Anvil)
- Oracle Services: Chainlink VRF v2.5 & Chainlink Automation
- Network: Sepolia Testnet
- Enter: Players join by paying an entrance fee (ETH).
- Wait: The lottery runs for a specific time interval.
- Trigger: Chainlink Automation checks if the time is up.
- Request: The contract requests a random number from Chainlink VRF.
- Fulfill: Chainlink VRF returns a random number, and the contract calculates the winner.
- Payout: The winner automatically receives the entire pot balance.
-
Clone the repository:
git clone [https://github.com/](https://github.com/)[YOUR_USERNAME]/foundry-smart-contract-lottery.git cd foundry-smart-contract-lottery -
Install Dependencies:
make install # or forge install -
Compile the contracts:
forge build
This project includes both Unit and Integration tests to ensure reliability.
Run Unit Tests:
forge test