When I try creating a Chainlink contract from "master contract" and fund it with LINK, I keep getting the error:

"VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information."

What am I doing wrong? Here's my REMIX code: https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&evmVersion=null&gist=79cf8c59f1fbf6e6a0327920c9a9c49a

  • 1
    What testnet are you on? Are you deploying to injected web3 or javascript vm? Mar 25 at 10:21
  • @PatrickCollins Kovan testnet injected web3 using Metamask Mar 25 at 15:45
  • Do you have testnet link and ETH? Mar 25 at 15:46
  • @PatrickCollins Yes, I have LINK and Eth, and I tried funding the factory contract before but that doesn't help. It also doesn't matter how much I pay to the contract. I also made a screen recording to help you help me: drive.google.com/file/d/1hpgJbqWuxoG1EsL3aD9MgxCYU5tFsgC1/… . Thanks again. Mar 25 at 16:31
  • that is a monstrosity of code. Can you please create a minimum reproducible contract? It's really hard for me to test in it's current state. And please update the question with the function that you're calling that is causing the error. Mar 25 at 23:51

Okay, I figured it out. In the video I put in one of my comments, I was forgetting to tell Remix to use injected web3 instead of Javascript VM. However, the more important thing I learned, was that you have to fund the "contract factory" with LINK tokens so that it can create the individual contracts and transfer LINK to them. Thanks @PatrickCollins for the help.

P.S. The code on Remix was straight from a Chainlink blog post: https://blog.chain.link/parametric-insurance-smart-contract/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.