【发布时间】:2021-12-29 18:53:40
【问题描述】:
我一直在关注 Solidity、区块链和智能合约课程 - 从初学者到专家 Python 教程 (https://www.youtube.com/watch?v=M576WGiDBdQ&t=28658s)。当我运行 deploy_lottery.py 时,它会在结束抽奖时崩溃。这是 Lottery.sol 中代码的 sn-p
function endLottery() public onlyOwner {
lottery_state = LOTTERY_STATE.CALCULATING_WINNER;
bytes32 requestId = requestRandomness(keyhash, fee);
emit RequestedRandomness(requestId);
}
这是 deploy_lottery.py 中的代码 sn-p
def end_lottery():
account = get_account()
lottery = Lottery[-1]
# fund the contract
# then end the lottery
tx = fund_with_link(lottery.address)
tx.wait(1)
print("Here")
ending_transaction = lottery.endLottery({"from": account})
print("ended transaction")
ending_transaction.wait(1)
time.sleep(180)
print(f"{lottery.recentWinner()} is the new winner!")
我还附上了错误快照。提前致谢。 https://i.stack.imgur.com/yU8jC.png
【问题讨论】:
-
你使用的是 GitHub 的原始代码吗?
-
我也有同样的问题!
-
不,我跟着 Patrick 在视频中编码。我还逐行检查了所有 github 文件。
标签: solidity smartcontracts chainlink brownie