This is advance demonstartion of smart contract to enter a lottery. Players have to pay a minimum ETH to enter the Raffle. Then we are using chainlink Keeper to start a new lottery automatically after X minutes. We also use Chainlink VRF to get a truly temper proof and decentarlzied way of getting a random winner. We also use VRFCooridnator package from the chainlink.
This code is written while following the free course on Solidity by Patrick Collions.
This project is developed with hardhat framework using TypeScript. This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the ecosystem.
Smart contracts is in /contracts folder. All the test code is in /test folder. Deploy scripts are inside the /deploy folder.
We have tested the code in or hardhat local network. For testnet we have used rinkeby. Make sure you have some ETH in your testnet network before you deploy and test code. You can get free testnet ETH on major testnet network through chainlink website.
To run and test the code in your local development machine copy the repo with following command. We have used yarn package manager. You can use NPM.
git clone https://github.com/sanjaydefidev/hardhat-lottery-smartcontractInstalling all the dependencies
yarn installTo comile the solidity.
yarn hardhat compileTo deploy on testnet.
yarn hardhat deploy --network rinkebyTo run the mocha tests on local.
yarn hardhat testTo run the mocha tests on testnet.
yarn hardhat test --network rinkebyTo run the coverage of code.
yarn hardhat coverageFor futher detail of this tutorial check this link.
Thank you @PatrickAlphaC for creating such and awesome tutorial.