0

I keep getting this error and can't figure out why. I have 1.4 ETH and 110 LINK in my metamask account. I'm connected to the Kovan testnet. Any help would be much appreciated.

Error: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? The execution failed due to an exception. Reverted

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";

contract CheckingThisOut is ChainlinkClient {
    using Chainlink for Chainlink.Request;

    address[] private subaddress;

    address private oracle;
    bytes32 private jobId;
    uint256 private fee;

    constructor() {
        setChainlinkToken(0xa36085F69e2889c224210F603D836748e7dC0088);
        //https://market.link/nodes/323602b9-3831-4f8d-a66b-3fb7531649eb/metrics?start=1640025302&end=1640630102
        //Linkpool
        oracle = 0x56dd6586DB0D08c6Ce7B2f2805af28616E082455;
        //https://market.link/jobs/d3d7cfc4-963e-4bc6-b94d-21bfe8d90aff
        jobId = "c128fbb0175442c8ba828040fdd1a25e";
        // 17 0s = 0.1 LINK
        // 18 0s = 1 LINK
        fee = 0.1 * 10 ** 18; // (Varies by network and job)
    }

    /**
     * Create a Chainlink request to retrieve API response, find the target
     * data, then multiply by 1000000000000000000 (to remove decimal places from data).
     */
    function requestSubscriptions() public returns (bytes32 requestId)
    {
        Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);

        // Set the URL to perform the GET request on
        request.add("get", "http://1423-104-243-59-126.ngrok.io/");


        request.add("path", "result");

        // Sends the request
        return sendChainlinkRequestTo(oracle, request, fee);
    }


    function fulfill(bytes32 _requestId, address[] memory _subaddress) public recordChainlinkFulfillment(_requestId)
    {
        subaddress = _subaddress;
    }
}

3 Answers 3

2

Wow i figured it out. I spent 5 hours on this and as soon as I posted the question, I watched the same tutorial video again (for the 10th time). I never sent LINK to the deployed contract address. I sent some LINK and it worked.

1

That's due to insufficient LINK in the deployed contract. It worked after I followed this https://docs.chain.link/docs/fund-your-contract/ and sent 2 LINK to the contract.

0

@Chris Can you explain how you did that, please? I have .27ETH and 40 LINK in my Kovan Test Net. How do I send Link to the deployed contract address in my code...

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6 <0.9.0;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract FundMe {

    mapping (address => uint256) public addressToAmountFunded;
    
function fund() public payable {
    uint256 minimumUSD = 50 * 10 ** 18;
        require (getConversionRate (msg.value) >= minimumUSD, "You need to spend more ETH!");
            addressToAmountFunded[msg.sender] += msg.value;
    ///msg.sender and msg.value both in every contract call and transaction 
    //msg.sender is the sender and msg. value is how much they sent 
}
function getVersion () public view returns (uint256) {
    AggregatorV3Interface _priceFeed = AggregatorV3Interface (0x9326BFA02ADD2366b30bacB125260Af641031331);
        return _priceFeed.version();
}
function getPrice () public view returns (uint256) {
    AggregatorV3Interface _priceFeed = AggregatorV3Interface (0x9326BFA02ADD2366b30bacB125260Af641031331);
        (,int256 answer,,,) = _priceFeed.latestRoundData();
            return uint256 (answer);     
}
function withdraw () payable public {
    msg.sender.transfer(address(this).balance);
//this means current contract //whoever called the withdraw function (msg.sender) transfer them the money
}

}
1
  • It's been a few months, so I don't really remember. I think I just sent the LINK to the contract address via metamask.
    – Chris
    Commented Mar 21, 2022 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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