0

I have gone through the existing error link EthTx Adapter in Chainlink Job

and the solutions recommended is also tried, but still i am facing the same issue. Approach I taken to debug is given below

Network: Apothem ( Xinfin )
Eth_URL: wss://ws.apothem.network
Chain_id: 51
  • Deployed the Oracle contrct in Apothem network using https://remix.xinfin.network/
  • Deployed the testClient contract with Oracle Address & Link Contract overriden in Constructor in Apothem Network using remix
  • Deployed the Oracle contrct in Apothem network using https://remix.xinfin.network/
  • Ensured, setfullfilmentPermission method is done by overriding chainlink node address(regular) , with true flag
  • Funded my testclient contract with LINK token
  • Created the job in Chainlink node UI using following job spec
{
  "initiators": [
    {
      "type": "external",
      "params": {
        "name": "xdc",
        "body": {
          "endpoint": "xinfin-testnet",
          "addresses": [ Oracle contract address]
        }
      }
    }
  ],
    "tasks": [
    {
      "type": "cryptoprice",
    },
    {
      "type": "Copy"
    },
    {
      "type": "Multiply"
    },
    { "type": "EthUint256" },
    { "type": "EthTx" }
  ]
}

Have ensured the external adapter is running in port i.e, 5000 and bridge has been created in chainlink node ui. When I trigger the createRequest method by overriding jobid, coin and market. Job is triggering in Chainlink node and I could see that all tasks are completed except EthTx adapter which throws, "Transaction reverted txn On chain" error

contract RequestClient is ChainlinkClient, Ownable {
    address private oracle;
    bytes32 private jobId;
    uint256 constant private ORACLE_PAYMENT = 2 * LINK;
    
    uint256 public volume;

    constructor(address _link) public {
        setChainlinkToken(_link);
        oracle = 0xcee7a06ca7002f778e70f8f14a28534986c1aa28;
    }
    event requestCreated(address indexed requester,bytes32 indexed jobId, bytes32 indexed requestId);
    
    event requestFulfilled(bytes32 indexed _requestId, uint256 _data);

  
    /*
     * Create a request and send it to default Oracle contract
    */
      function createRequest(
        string _jobId,
        string _coin,
        string _market
      )
        public
        onlyOwner
        returns (bytes32 requestId)
      {
        // create request instance
        Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(_jobId), address(this), this.fulfill.selector);
        req.add("endpoint", "price");
        req.add("fsym", _coin);
        req.add("tsyms", _market);
        req.add("copyPath", _market);
        req.addInt("times", 100);
        // send request & payment to Chainlink oracle
        requestId = sendChainlinkRequestTo(oracle, req, ORACLE_PAYMENT);
        emit requestCreated(msg.sender, stringToBytes32(_jobId), requestId);
    }
    
    /**
     * Receive the response in the form of uint256
     */ 
    function fulfill(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
    {
        emit requestFulfilled(_requestId, volume);
        volume = _volume;
    }
    
    function stringToBytes32(string memory source)
        private
        pure
        returns (bytes32 result)
    {
        bytes memory tempEmptyStringTest = bytes(source);

        if (tempEmptyStringTest.length == 0) {
            return 0x0;
        }

        assembly {
            result := mload(add(source, 32))
        }
    }
}

Please note, I tried to debug the revertreason from txhash, but i dont see any revertreason parms available in txHash receipt.

Any direction, help would be really greatfull.

7
  • Where is your fulfill method? If you have one can you post it? I need to see that to be able to debug this properly.
    – Zak Ayesh
    Jun 14, 2021 at 20:46
  • Added the fulfil method above, please check & thanks for the reply.
    – Lokesh
    Jun 15, 2021 at 3:28
  • What are your ETH_CHAIN_ID env variables and ETH_URL set to? Reference: docs.chain.link/docs/configuration-variables
    – Zak Ayesh
    Jun 15, 2021 at 16:03
  • Also make sure you are not just setting "SetFullffillmentPermission" to only true but in the format "node_addreess, true" as seen in this tutorial: docs.chain.link/docs/fulfilling-requests/…
    – Zak Ayesh
    Jun 15, 2021 at 16:11
  • Hi - thanks for the reply -- please see below ..ETH_CHAIN_ID=51, ETH_URL=wss://ws.apothem.network and yes, I have passed both node_address and true in setfulfillmentpermission method.
    – Lokesh
    Jun 15, 2021 at 16:47

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.