Chainlink 节点,无法获取 bytes32 的值

Chainlink node, can't get value of bytes32

我创建了自己的永恒适配器,它会重新运行一个字符串作为结果。该节点正确运行作业,不会出现任何错误。我认为错误发生在智能合约中。

这是我当前的智能合约,根据 Chainlink 文档编辑。

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

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

/**
 * Request testnet LINK and ETH here: https://faucets.chain.link/
 * Find information on LINK Token Contracts and get the latest ETH and LINK faucets here: https://docs.chain.link/docs/link-token-contracts/
 */

/**
 * 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;
  
    bytes32 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() {
        setPublicChainlinkToken();
        oracle = 0x6A968f08Ba673EaD62b54Ec7FC4095213a679E63;
        jobId = "bf7f39c102594b46b8acd2db6c0cc84d";
        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 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
        
        
        // 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("currency", "ETH");
        
        // Multiply the result by 1000000000000000000 to remove decimals

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

    // function withdrawLink() external {} - Implement a withdraw function to avoid locking your LINK in the contract
}

外部适配器应该重新运行类似 {\"jobRunID\":0,\"data\":{\"account\":\"0xdF392951284e8779C1e2Fdda5b452222\"},\"result\":\"0dF392951284e8779C1e2Fdda5b45224\",\"statusCode\":200}

我的工作数据看起来像:

type = "directrequest"
schemaVersion = 1
name = "name"
contractAddress = "0x6A968f08Ba673EaD62b54Ec7FC4095213a679E63"
maxTaskDuration = "0s"
observationSource = """
    decode_log   [type=ethabidecodelog
                  abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
                  data="$(jobRun.logData)"
                  topics="$(jobRun.logTopics)"]

    decode_cbor  [type=cborparse data="$(decode_log.data)"]
    fetch        [type=bridge name="yokuPayBeta2" requestData="{\"id\": $(jobSpec.externalJobID), \"data\": { \"currency\": $(decode_cbor.currency)}}"]
    parse        [type=jsonparse path="result" data="$(fetch)"]
    encode_data  [type=ethabiencode abi="(bytes32 value)" data="{ \"value\": $(parse) }"]
    encode_tx    [type=ethabiencode
                  abi="fulfillOracleRequest(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes32 data)"
                  data="{\"requestId\": $(decode_log.requestId), \"payment\": $(decode_log.payment), \"callbackAddress\": $(decode_log.callbackAddr), \"callbackFunctionId\": $(decode_log.callbackFunctionId), \"expiration\": $(decode_log.cancelExpiration), \"data\": $(encode_data)}"
                 ]
    submit_tx    [type=ethtx to="0x6A968f08Ba673EaD62b54Ec7FC4095213a679E63" data="$(encode_tx)"]

    decode_log -> decode_cbor -> fetch -> parse -> encode_data -> encode_tx -> submit_tx
""" 

如果我在 remix 中点击 requestVolumeData,SC 就会被执行。 作为响应,卷打印 0x00000000000000000000000000000000000000000000000000000000000000

哪里出错了,如何解决?

将 ETH 发送到您的 Chainlink 预言机地址。