PatrickAlphaC / smartcontract-lottery

MIT License
79 stars 113 forks source link

Lesson 8 gas estimation failed: execution reverted #46

Closed snowyaya closed 2 years ago

snowyaya commented 2 years ago

I got this error. ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the gas limit manually.

Below is my fund_with_link() function.

def fund_with_link(
    contract_address, account=None, link_token=None, amount=100000000000000000
):  # 0.1 LINK
    account = account if account else get_account()
    link_token = link_token if link_token else get_contract("link_token")
    tx = link_token.transfer(contract_address, amount, {"from": account})
    # link_token_contract = interface.LinkTokenInterface(link_token.address)
    # tx = link_token_contract.transfer(contract_address, amount, {"from": account})
    tx.wait(1)
    print("Fund contract!")
    return tx

I tried resolving the issue by manually adding the gas limit in brownie-config.yaml, but still failed.

settings:
  gas_limit: "2074044"

Any idea how to solve the problem?

Szymanderinio commented 2 years ago

I have the same issue :/ Weird thing is that it works on local blockchain env, but it doesn't work on rinkeby, and yes - I have few eth and link tokens on my wallet

PatrickAlphaC commented 2 years ago

You need LINK token on a testnet!

https://faucets.chain.link/