About
This is an example of a full scale smart contract project, made using Solidity and Brownie. You can use this repo as a refresher on how to use Brownie and write smart contracts.
How the contract works:
- Anyone can enter the lottery with 50 USD or more worth of ETH
- The owner will choose when the lottery is over
- The lottery will select one random winner and transfer the funds
Todo
- Further decentralize using Chainlink Keepers
Setup
Note: This isn't a guide on how to set up system for development! For that, see PatrickAlphaC/smartcontract-lottery, on which this project is based.
To set up your new project, either:
Use chainlink-mix
brownie bake chainlink-mix && mv chainlink <your_project_name>
Or start from scratch
brownie init
Other files
Create a .env
file inside your project's directory and add the following
export PRIVATE_KEY_1 = <YOUR_PRIVATE_KEY_1>
export PRIVATE_KEY_2 = <YOUR_PRIVATE_KEY_2>
export WEB3_INFURA_PROJECT_ID = <YOUR_PROJECT_ID>
export ETHERSCAN_TOKEN = <YOUR_API_TOKEN>
To encrypt your private key, add it to Brownie instead
brownie accounts new <choose_account_id>
Usage
Compile
brownie compile
Test
brownie test --network <choose_network> -s
Deploy
brownie run scripts/deploy_lottery.py --network <choose_network>