This repository contains a sample project made mainly to learn something about
Solidity, Chainlink ecosystem and Hardhat.
It is based on:
https://github.com/pappas999/chainlink-hardhat-box
https://github.com/nomiclabs/hardhat-hackathon-boilerplate
and reuse a lot of them.
It is a dummy lottery. The user buys a ticket in one transaction and then draws a lot in another one, wins or loses.
It is not the best implementation of the lottery on Ethereum, it may be the worst one or at least too verbose one.
NPM
npm install
Default netowrk: kovan
export KOVAN_RPC_URL='www.infura.io/asdfadsfafdadf'
export PRIVATE_KEY='abcdef'
export ALCHEMY_MAINNET_RPC_URL="https://eth-mainnet.alchemyapi.io/v2/your-api-key"
npx hardhat compile
npx hardhat test --network hardhat
npx hardhat deploy
It needs that to take random numbers from an oracle.
npx hardhat fund-link --contract insert-vrf-contract-address-here
Buying the lottery ticket for i.e. 0.05 ETH
npx hardhat buy-ticket --contract insert-contract-address-here
npx hardhat roll --contract insert-contract-address-here