0

The events emitted from the requestRobotUrlBytes function which is directly called by me seems to work fine but those emitted from fulfillBytes which is called by the oracle are not emitted.

I'm using brownie. Here is the contract and the events logs.

//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/
 */

/**
 * @notice DO NOT USE THIS CODE IN PRODUCTION. This is an example contract.
 */
 //from GenericLargeResponse
contract RobotUrlAPIConsumer is ChainlinkClient {
  using Chainlink for Chainlink.Request;

  // variable bytes returned in a signle oracle response
  bytes public data;
  string public robot_url;

  /**
   * @notice Initialize the link token and target oracle
   * @dev The oracle address must be an Operator contract for multiword response
   *
   *
   * Kovan Testnet details:
   * Link Token: 0xa36085F69e2889c224210F603D836748e7dC0088
   * Oracle: 0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8 (Chainlink DevRel)
   *
   */
  constructor(address link, address operator_contract) 
  {
    setChainlinkToken(link);
    setChainlinkOracle(operator_contract);
  }

  /**
   * @notice Request variable bytes from the oracle
   */
  function requestRobotUrlBytes(
  )
    public
  {
    data = "";
    robot_url = "";
    bytes32 specId = "24f1447aa11e4a178b73d9fedd12755c";
    uint256 payment = 100000000000000000;
    Chainlink.Request memory req = buildChainlinkRequest(specId, address(this), this.fulfillBytes.selector);
    req.add("get", "https://chainlink-robot.diode.link:8050/get_robot_url");
    req.add("path", "robot_url");
    sendOperatorRequest(req, payment);
    emit RobotUrlRequestFulfilled(specId, robot_url);
  }

  event RequestFulfilled(
    bytes32 indexed requestId,
    bytes indexed data
  );

  event RobotUrlRequestFulfilled(
    bytes32 indexed requestId,
    string robot_url
  );

  /**
   * @notice Fulfillment function for variable bytes
   * @dev This is called by the oracle. recordChainlinkFulfillment must be used.
   */
  function fulfillBytes(
    bytes32 requestId,
    bytes memory bytesData
  )
    public
    recordChainlinkFulfillment(requestId)
  {
    emit RequestFulfilled(requestId, bytesData);
    data = bytesData;
    robot_url = string(data);
    emit RobotUrlRequestFulfilled(requestId, robot_url);
  }
}
{'ChainlinkRequested': [OrderedDict([('id', 
0xe3efb3e00d218d22522990910ec811c7ebcfaa0fdc55b90a308d8abf097ff91f)])], 
'(unknown)': [OrderedDict([('topic1', 
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'), 
('topic2', '0x000000000000000000000000d4e19a16e68ae621141097756df61793d1fba243'), 
('topic3', '0x0000000000000000000000006d7bd53e66b415550294bb91bf957e7a617f3baa'),
 ('data', 0x000000000000000000000000000000000000000000000000016345785d8a0000)]), 
OrderedDict([('topic1', '0xe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16'),
 ('topic2', 
'0x000000000000000000000000d4e19a16e68ae621141097756df61793d1fba243'), 
('topic3', '0x0000000000000000000000006d7bd53e66b415550294bb91bf957e7a617f3baa'), 
('data', 0x000000000000000000000000000000000000000000000000016345785d8a0000000000000
000000000000000000000000000000000000000000000000000004000000000000000000000
000000000000000000000000000000000000000001643c6d41b900000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000323466313434376161313165346131373862373364396
6656464313237353563c2fb8523000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000001000
000000000000000000000000000000000000000000000000000000000000200000000000000
000000000000000000000000000000000000000000000000e00000000000000000000000000
00000000000000000000000000000000000004a63676574783568747470733a2f2f63686169
6e6c696e6b2d726f626f742e64696f64652e6c696e6b3a383035302f6765745f726f626f745
f75726c647061746869726f626f745f75726c00000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000)])],
 'OracleRequest': [OrderedDict([('specId', 
0x3234663134343761613131653461313738623733643966656464313237353563), 
('requester', '0xD4e19A16e68AE621141097756DF61793d1fBA243'), ('requestId',
 0xe3efb3e00d218d22522990910ec811c7ebcfaa0fdc55b90a308d8abf097ff91f), 
('payment', 100000000000000000), ('callbackAddr', 
'0xD4e19A16e68AE621141097756DF61793d1fBA243'), ('callbackFunctionId', 
0xc2fb8523), ('cancelExpiration', 1652563856), ('dataVersion', 2), ('data', 0x63676574783568747470733a2f2f636861696e6c696e6b2d726f626f742e64696f64652e6
c696e6b3a383035302f6765745f726f626f745f75726c647061746869726f626f745f75726c
)])], 'RobotUrlRequestFulfilled': [OrderedDict([('requestId', 
0x3234663134343761613131653461313738623733643966656464313237353563), 
('robot_url', '')])]}
1
  • Hey @Radu, to which event are you referring? If I am not mistaken, there is a RobotUrlRequestFulfilled event in the logs you provided.
    – Andrej
    May 17 at 19:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.