Chainlink 获取请求突然无法使用当前的 solidity 版本

Chainlink get request suddenly not working with current solidity version

我使用下面的代码已经有一段时间了,它运行得很好。但是,今天我收到以下错误:

TypeError: Member "add" not found or not visible after argument-dependent lookup in struct >Chainlink.Request memory.

我尝试将我的 Solidity 版本切换到 0.6.6,然后将 Chainlink 版本切换到 v0.6,它似乎与旧版本完美兼容。

有人对可能出现的问题有什么建议吗?

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.6;

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

    contract APIConsumer is ChainlinkClient {


    uint256 public volume;

    address private oracle;
    bytes32 private jobId;
    uint256 private fee;
    address public _link = 0xa36085F69e2889c224210F603D836748e7dC0088;

    constructor() {
        if (_link == address(0)) {
            setPublicChainlinkToken();
        } else {
            setChainlinkToken(_link);
        }
        oracle = 0x56dd6586DB0D08c6Ce7B2f2805af28616E082455;
        jobId = "b6602d14e4734c49a5e1ce19d45a4632";
        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");
    
   
        request.add("path", "RAW.ETH.USD.VOLUME24HOUR");
    
        int timesAmount = 10**18;
        request.addInt("times", timesAmount);
    
        // Sends the request
        return sendChainlinkRequestTo(oracle, request, fee);
    }   


    function fulfill(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
    {
        volume = _volume;
    }
}

是的!好问题。

这是对较新合同的更新。

添加这一行:

contract APIConsumer is ChainlinkClient {
    using Chainlink for Chainlink.Request; // This is the new line