8. Contract Lottery | Raffle
One Liner Dependencies Installation
Contract Details
Raffle
Enter the lottery (paying some amount)
Pick a random winner (verifiably random)
Winner to be selected every X minutes -> completely automate
Chainlink Oracle -> Randomness, Automated Execution (Chainlink Keepers)
Events
Whenever we update a dynamic array or mapping, we should emit an event
Stored in the logging data structure of the EVM
Whenever we emit an event, there are two types of parameters
indexed parameters / topics
We can have upto 3 of these
These are seachable
unindexed parameters
Decoded via their ABIs
Costs less gas
Hardhat Shorthand
Npm package that is installed globally as package
hh
Supports shell autocomplete
yarn global add shorthand
Hardhat special testing/debugging methods
https://hardhat.org/hardhat-network/docs/reference#special-testing/debugging-methods
evm_increaseTime
evm_increaseTime
Allows us to increase time of the blockchain
evm_mine
evm_mine
Allows us to mine(create) new blocks
Final Files
https://github.com/PatrickAlphaC/hardhat-smartcontract-lottery-fcc
Last updated