首页 > 解决方案 > NFT:尝试运行 create_collectibles 脚本会引发执行恢复错误:这是来自 Patrick Collins Youtube 教程

问题描述

以下是脚本的片段: 在 VS 代码中使用 Brownie 错误:“气体估算失败:'执行已恢复'。此交易可能会恢复。如果您希望广播,则必须手动设置气体限制。”

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))

标签: ethereumnftbrownie

解决方案


推荐阅读