0

I am new in Solidity and currently I am trying to deploy simple smart contract that requests ETH price "LOWDAY", and "HIGHDAY". I already did very similar SC that requests only "VOLUME24HOUR" and it worked great. This is error that I get: contracts/API_Consumer_Info.sol:24:66: DeclarationError: Undeclared identifier. Did you mean "jobID"? Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector); ^---^

pragma solidity ^0.6.7;

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

contract APIConsumerInfo is ChainlinkClient
{
uint256 public lowDay;
uint256 public highDay;

address private oracle;
bytes32 private jobID;
uint256 private fee;

constructor() public
{
    setPublicChainlinkToken();
    oracle = 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e;
    jobID = "29fa9aa13bf1468788b7cc4a500a45b8";
    fee = 0.1 * 10 ** 18;
}

function requestLowDay() public returns (bytes32 requestID)
{
    Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);  //Error occur here
    request.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
    request.add("path", "RAW.ETH.USD.LOWDAY");
    int timesAmount = 10**2;
    request.addInt("times", timesAmount);
    return sendChainlinkRequestTo(oracle, request, fee);
}

function fulfill(bytes32 _requestId, uint256 _dayLow) public recordChainlinkFulfillment(_requestId)
{
    lowDay = _dayLow;
}

function requestHighDay() public returns (bytes32 requestID)
{
    Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);  //Error occur here
    request.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
    request.add("path", "RAW.ETH.USD.HIGHDAY");
    int timesAmount = 10**2;
    request.addInt("times", timesAmount);
    return sendChainlinkRequestTo(oracle, request, fee);
}

function fulfill(bytes32 _requestId, uint256 _dayHigh) public recordChainlinkFulfillment(_requestId)
{
    highDay = _dayHigh;
}

function withdrawLink() external 
{
    LinkTokenInterface linkToken = LinkTokenInterface(chainlinkTokenAddress());
    require(linkToken.transfer(msg.sender, linkToken.balanceOf(address(this))), "Unable to transfer");
}
}

The base code is not written by my and it works perfectly with "VOLUME24HOUR" call. When I did necessary changes to request.add("path") and added new variable lowDay/highDay it started to throw error.

Thank you ʕっ•ᴥ•ʔっ

1 Answer 1

2

check this line " buildChainlinkRequest(jobId, address(this), this.fulfill.selector);" there is a typo instead of "jobID".

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.