我一直在关注 Solidity、区块链和智能合约课程 - 从初学者到专家 Python 教程 ( https://www.youtube.com/watch?v=M576WGiDBdQ&t=28658s )。当我运行 deploy_lottery.py 时,它会在结束抽奖时崩溃。这是 Lottery.sol 中的代码片段
function endLottery() public onlyOwner {
lottery_state = LOTTERY_STATE.CALCULATING_WINNER;
bytes32 requestId = requestRandomness(keyhash, fee);
emit RequestedRandomness(requestId);
}
这是 deploy_lottery.py 中的代码片段
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