1

Below is the snip of the script: Using Brownie in VS Code Error: "Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually."

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))
  • Could you please look here:https://ethereum.stackexchange.com/a/111864/57451 It's likely you just don't have any LINK in your contract. – Patrick Collins Oct 20 '21 at 00:01

2 Answers2

0

I think this has already been answered here. To summarize it, you probably have vrf_coordinator version error. Try the rinkeby's values from the official docs.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](https://meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted](https://stackoverflow.com/help/deleted-answers). – Tyler2P Mar 11 '22 at 19:24
0

I had the same issue. But Patrick is correct, I did not have any Link tokens inside of my newly created contract on Rinkeby network...So I commented out most of the lines of the code in create_collectible.py to import and apply the fund_advanced_collectible() function once more on my contract:

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) 

With a reminder of the function definition of fund_advanced_collectible from helpfulscripts.py:

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

Once the transaction was confirmed, I could verify in https://rinkeby.etherscan.io/address that my contract had 0.1 Link and so when executing your code again, the error disappeared...

Dharman
  • 30,962
  • 25
  • 85
  • 135
Daniel Weigel
  • 1,097
  • 2
  • 8
  • 14