-
from scripts.helpful_scripts import get_account, get_contract, fund_with_link
from brownie import Lottery, network, config
import time
def deploy_lottery():
account = get_account()
lottery = Lottery.deploy(
get_contract("eth_usd_price_feed").address,
get_contract("vrf_coordinator").address,
get_contract("link_token").address,
config["networks"][network.show_active()]["fee"],
config["networks"][network.show_active()]["keyhash"],
{"from": account},
publish_source=config["networks"][network.show_active()].get("verify", False),
)
print("Lottery Deployed :D !")
return lottery
def start_lottery():
account = get_account()
lottery = Lottery[-1]
starting_tx = lottery.startLottery({"from": account})
starting_tx.wait(1)
print("The lottery is started!")
def enter_lottery():
account = get_account()
lottery = Lottery[-1]
value = lottery.getEntranceFee() + 100000000
tx = lottery.enter({"from": account, "value": value})
tx.wait(1)
print("Welcome :)")
def end_lottery():
account = get_account()
lottery = Lottery[-1]
# To end the contract we call the VRFrandom function and in order to do that we need some LINK
# So we first fund the contract then end the lottery
tx = fund_with_link(lottery.address)
tx.wait(1)
ending_transaction = lottery.endLottery({"from": account})
ending_transaction.wait(1)
time.sleep(60)
print(f"{lottery.recentWinner()} is the winner!")
def main():
deploy_lottery()
start_lottery()
enter_lottery()
end_lottery() |
Beta Was this translation helpful? Give feedback.
Answered by
n4n0b1t3
Feb 23, 2022
Replies: 1 comment 2 replies
-
|
My guess is, missing the key "keyhash" in the network rinkeby configuration. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
shucks18
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


My guess is, missing the key "keyhash" in the network rinkeby configuration.
Just copy the keyhash line into the rinkeby section should work.