Gas estimation error with 32000 error code during deployment on BSC Testnet

0

I can able to deploy on kovan network and get this running fine but cannot able to deploy on bsc testnet

tried with this RPC URL

https://data-seed-prebsc-1-s1.binance.org:8545/ Chain ID : 97

and also

RPC UrL : https://data-seed-prebsc-1-s2.binance.org:8545/ Chain ID : 97

but it didn't help.

Here is the error I get:

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Internal JSON-RPC error. { "code": -32000, "message": "execution reverted" }

Here is the contract I'm trying to run.

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

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

/**
 * THIS IS AN EXAMPLE CONTRACT WHICH USES HARDCODED VALUES FOR CLARITY.
 * PLEASE DO NOT USE THIS CODE IN PRODUCTION.
 */
contract APIConsumer is ChainlinkClient {
    using Chainlink for Chainlink.Request;
  
    uint256 public volume;
    
    address private oracle;
    bytes32 private jobId;
    uint256 private fee;
    
    /**
     * Network: Kovan
     * Oracle: 0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8 (Chainlink Devrel   
     * Node)
     * Job ID: d5270d1c311941d0b08bead21fea7747
     * Fee: 0.1 LINK
     */
    constructor() public {
        setPublicChainlinkToken();
        //oracle = 0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8; //Kovan
        //jobId = "d5270d1c311941d0b08bead21fea7747"; //kovan
        //fee = 0.1 * 10 ** 18; // (Varies by network and job) //kovan
        
        oracle = 0x63B72AF260E8b40A7b89E238FeB53448A97b03D2;  // BSC Testnet
        jobId = "e07f08e39d2c448d9696319bae8eeddf";  // BSC Testnet
        fee = 0.1 * 10 ** 18; // (Varies by network and job) // BSC Testnet
        
    }
    
    /**
     * Create a Chainlink request to retrieve API response, find the target
     * data, then multiply by 1000000000000000000 (to remove decimal places from data).
     */
   function requestVolumeData() 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", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
        
        // Set the path to find the desired data in the API response, where the response format is:
        // {"RAW":
        //   {"ETH":
        //    {"USD":
        //     {
        //      "VOLUME24HOUR": xxx.xxx,
        //     }
        //    }
        //   }
        //  }
        request.add("path", "RAW.ETH.USD.VOLUME24HOUR");
        
        // Multiply the result by 1000000000000000000 to remove decimals
        int timesAmount = 10**18;
        request.addInt("times", timesAmount);
        
        // Sends the request
        return sendChainlinkRequestTo(oracle, request, fee);
    }
    
    
      //Receive the response in the form of uint256
      
    function fulfill(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
    {
        volume = _volume;
    }
    // function withdrawLink() external {} - Implement a withdraw function to avoid locking your LINK in the contract
}

Any help

Thanks

I am not sure but maybe you should call setPublicChainlinkToken() passing the LINK address on testnet: 0x84b9b910527ad5c03a9ca831909e21e236ea7b06

Thans FreezyEx for the reply. I tried that with this contract where in I can send these params thru constructor but it still did not fetch the value

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.6;

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

contract APIConsumer is ChainlinkClient {


uint256 public volume;

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

/**
 * Network: Kovan
 * Oracle: 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e
 * Job ID: 29fa9aa13bf1468788b7cc4a500a45b8
 * Fee: 0.1 LINK
 */
constructor(address _oracle, string memory _jobId, uint256 _fee, address _link) public {
    if (_link == address(0)) {
        setPublicChainlinkToken();
    } else {
        setChainlinkToken(_link);
    }
    // oracle = 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e;
    // jobId = "29fa9aa13bf1468788b7cc4a500a45b8";
    // fee = 0.1 * 10 ** 18; // 0.1 LINK
    oracle = _oracle;
    jobId = stringToBytes32(_jobId);
    fee = _fee;
}

/**
 * Create a Chainlink request to retrieve API response, find the target
 * data, then multiply by 1000000000000000000 (to remove decimal places from data).
 */
function requestVolumeData() 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", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
    
    // Set the path to find the desired data in the API response, where the response format is:
    // {"RAW":
    //   {"ETH":
    //    {"USD":
    //     {
    //      "VOLUME24HOUR": xxx.xxx,
    //     }
    //    }
    //   }
    //  }
    request.add("path", "RAW.ETH.USD.VOLUME24HOUR");
    
    // Multiply the result by 1000000000000000000 to remove decimals
    int timesAmount = 10**18;
    request.addInt("times", timesAmount);
    
    // Sends the request
    return sendChainlinkRequestTo(oracle, request, fee);
}

/**
 * Receive the response in the form of uint256
 */ 
function fulfill(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
{
    volume = _volume;
}

function stringToBytes32(string memory source) public pure returns (bytes32 result) {
    bytes memory tempEmptyStringTest = bytes(source);
    if (tempEmptyStringTest.length == 0) {
        return 0x0;
    }

    assembly {
        result := mload(add(source, 32))
    }
}
}

With these parameters to constructor while on bsc testnet still not fetching the value

0x63B72AF260E8b40A7b89E238FeB53448A97b03D2
e07f08e39d2c448d9696319bae8eeddf
100000000000000000
0x84b9b910527ad5c03a9ca831909e21e236ea7b06

Thanks again for the help