NFT:试图运行create_collectibles脚本抛出执行恢复错误:这是来自帕特里克柯林斯Youtube教程.&



下面是脚本的片段错误:"气体估计失败:'执行恢复'。该交易可能会恢复。如果你想广播,你必须手动设置燃气限制。">

from brownie import AdvancedCollectible, accounts, config
from scripts.helpful_scripts import get_breed
import time
STATIC_SEED = 123
def main():
dev = accounts.add(config["wallets"]["from_key"])
advanced_collectible = AdvancedCollectible[len(AdvancedCollectible) - 1]
transaction = advanced_collectible.createCollectible(
STATIC_SEED, "None", {"from": dev, "gas_limit": 50000}
)
print("Waiting on second transaction...")
# wait for the 2nd transaction
transaction.wait(1)
time.sleep(35)
requestId = transaction.events["requestedCollectible"]["requestId"]
token_id = advanced_collectible.requestIdToTokenId(requestId)
breed = get_breed(advanced_collectible.tokenIdToBreed(token_id))
print("Dog breed of tokenId {} is {}".format(token_id, breed))

我想这里已经有了答案。总而言之,您可能会遇到vrf_coordinator版本错误。从官方文档中试试冰场的值。

我也有同样的问题。但是Patrick是对的,我在Rinkeby网络上新创建的合同中没有任何Link令牌…因此,我注释掉了create_collectible.py中的大部分代码行,以便在我的合约上再次导入和应用fund_advanced_collectible()函数:

from helpfulscripts import fund_advanced_collectible
def main():
dev=accounts.add(config['wallets']['from_key'])
advanced_collectible= AdvancedCollectible[len(AdvancedCollectible)-1]
# transaction=advanced_collectible.createCollectible(STATIC_SEED,"None", {"from": dev})
# transaction.wait(1)
# time.sleep(35)
# requestID=transaction.events["requestedCollectible"]["requestID"]
# tokenID=advanced_collectible.requestIDToTokenID(requestID)
# breed=get_breed(advanced_collectible.tokenIDToBreed(tokenID))
# print('Dog breed of {} is {}.'.format(tokenID, breed)) 
fund_advanced_collectible(advanced_collectible) 

提醒一下helpfulscripts.py中fund_advanced_collectible的函数定义:

def fund_advanced_collectible(nft_contract):
dev=accounts.add(config['wallets']['from_key'])
link_token=interface.LinkTokenInterface(config['networks'][network.show_active()]['link_token'])
link_token.transfer(nft_contract, 100000000000000000,{"from":dev})

一旦交易被确认,我可以在https://rinkeby.etherscan.io/address上验证我的合同有0.1链接,所以当再次执行你的代码时,错误消失了…

最新更新