Proveably random Lottery contract. Done following this amazing course from Cyfrin!
This contract is a Raffle contract. people can buy tickets and participate to win the raffle.
It uses Chainlink VRF and Automation.
I followed the following code layout:
// Layout of Contract:
// version
// imports
// errors
// interfaces, libraries, contracts
// Type declarations
// State variables
// Events
// Modifiers
// Functions
// Layout of Functions:
// constructor
// receive function (if exists)
// fallback function (if exists)
// external
// public
// internal
// private
// internal & private view & pure functions
// external & public view & pure functions
Using CEI pattern for writing functions!
Done some minimal Unit and integration tests.
Install dependencies:
make install
Build project:
make build
Run test locally:
make run-test
Run test on Sepolia:
make test-sepolia
Deploy on Anvil:
# On another terminal run
anvil
# then run
make deploy-anvil
Deploy on Sepolia:
# then run
make deploy-sepolia
Here is the deployed and verified contract: