1

I am using Remix IDE for my smart contract development. I am using the following import line

import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/ChainlinkClient.sol";

But I am getting this error while compilation

DeclarationError: Undeclared identifier. setPublicChainlinkToken();

The entire code is:


pragma solidity ^0.6.0;

import "https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.6/ChainlinkClient.sol";

contract VersionControl {
    
    struct Asset {
        uint256 id;
        string name;
        string metadata;
        string ipfsHash;
        uint256 version;
        
        bool isPresent;
        
        mapping (address => uint256) contribution;
    }
    
    mapping (uint256 => Asset) assets;
                
    address tokenAddress;
    address owner;
    uint256 availabeId;
    
    address private oracle;
    bytes32 private jobId;
    uint256 private fee;
    
    constructor() public {
        owner = msg.sender;
        availabeId = 0;
        
        setPublicChainlinkToken();
        oracle = 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e;
        jobId = "29fa9aa13bf1468788b7cc4a500a45b8";
        fee = 0.1 * 10 ** 18; // 0.1 LINK
        
    }
    
    // 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);
    // }
    
    
}```

Ignore the requestVolumeData as it will be the place where I call the 3rd Party APIs
1
  • Actually, I can't seem to reproduce this error. Could you edit the question to send the full constructor/method? Mar 23, 2021 at 18:47

1 Answer 1

0

You have to inherit the ChainlinkClientinto your contract.

Change your contract line from:

contract VersionControl { 

to

contract VersionControl is ChainlinkClient {

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.