This repository has been archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2a95bf
commit e82f89d
Showing
13 changed files
with
247 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,24 @@ reports: | |
exclude_contracts: | ||
- SafeMath | ||
dependencies: | ||
- smartcontractkit/chainlink-brownie-contracts@1.0.2 | ||
- smartcontractkit/chainlink-brownie-contracts@1.1.1 | ||
- OpenZeppelin/[email protected] | ||
compiler: | ||
solc: | ||
remappings: | ||
- '@chainlink=smartcontractkit/chainlink-brownie-contracts@1.0.2' | ||
- '@chainlink=smartcontractkit/chainlink-brownie-contracts@1.1.1' | ||
- '@openzeppelin=OpenZeppelin/[email protected]' | ||
# automatically fetch contract sources from Etherscan | ||
autofetch_sources: True | ||
dotenv: .env | ||
# set a custom mnemonic for the development network | ||
networks: | ||
default: development | ||
development: | ||
keyhash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4' | ||
fee: 100000000000000000 | ||
jobId: '29fa9aa13bf1468788b7cc4a500a45b8' | ||
verify: False | ||
ganache: | ||
verify: False | ||
mainnet-fork: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/python3 | ||
from brownie import Lottery, accounts, config, network | ||
from scripts.helpful_scripts import get_contract, get_account, fund_with_link | ||
import time | ||
|
||
lottery_enum = {0: "OPEN", 1: "CLOSED", 2: "CALCULATING_WINNER"} | ||
|
||
|
||
def deploy_lottery(): | ||
account = get_account() | ||
# level up get_account for all 3 though | ||
print(network.show_active()) | ||
return Lottery.deploy( | ||
get_contract("eth_usd_price_feed").address, | ||
get_contract("vrf_coordinator").address, | ||
get_contract("link_token").address, | ||
config["networks"][network.show_active()]["keyhash"], | ||
{"from": account}, | ||
publish_source=config["networks"][network.show_active()].get("verify", False), | ||
) | ||
|
||
|
||
def start_lottery(): | ||
account = get_account() | ||
lottery = Lottery[-1] | ||
transaction = fund_with_link(lottery.address) | ||
transaction.wait(1) | ||
transaction_2 = lottery.startLottery({"from": account}) | ||
transaction_2.wait(1) | ||
print(f"The lottery is currently {lottery_enum[lottery.lottery_state()]}") | ||
|
||
|
||
def enter_lottery(): | ||
account = get_account() | ||
lottery = Lottery[-1] | ||
value = lottery.getEntranceFee() + 100000000 | ||
transaction_2 = lottery.enter({"from": account, "value": value}) | ||
transaction_2.wait(1) | ||
print(f"{account} has entered the lottery!") | ||
|
||
|
||
def end_lottery(): | ||
account = get_account() | ||
lottery = Lottery[-1] | ||
print(f"The previous winner is {lottery.recentWinner()}, let's get a new one!") | ||
transaction = lottery.endLottery({"from": account}) | ||
transaction.wait(1) | ||
time.sleep(60) | ||
print(f"{lottery.recentWinner()} is the new winner!") | ||
|
||
|
||
def main(): | ||
deploy_lottery() | ||
# start_lottery() | ||
# enter_lottery() | ||
# end_lottery() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from scripts.helpful_scripts import deploy_mocks | ||
|
||
|
||
def main(): | ||
deploy_mocks() |
Oops, something went wrong.