The buildChainlinkRequest line no 47 takes 3 parameters:
- JobId
- Callback Address
- Function to callback to
I have smartcontract1 and smartcontract2. The below mentioned function is inside smartcontract2
function requestVolumeData(string memory _jobId, string memory addrsss, address callBackContract, bytes4 functionSelector) external returns (bytes32 requestId) {
Chainlink.Request memory req = buildChainlinkRequest(
stringToBytes32(_jobId),
callBackContract,
functionSelector
);
req.add("publicKey", addrsss);
return sendChainlinkRequest(req, fee);
}
Code inside smartcontract1 given below,
interface OracleInterfacehere{
function requestVolumeData(string memory _jobId, string memory addrsss, address callBackContract, bytes4 functionSelector) external returns (bytes32) ;
}
function requestingdataFromOracle(string memory _jobId, string memory addrsss, address _smartcontract2) public {
OracleInterfacehere OracleOwnerGuard = OracleInterfacehere(_smartcontract2);
OracleOwnerGuard.requestVolumeData(_jobId, addrsss,address(this), this.fulfill.selector);
}
function fulfill(
bytes32 _requestId,
bool _status
) public recordChainlinkFulfillment(_requestId) {
status = _status;
}
What I am expecting is as smartcontract1 call "requestVolumeData" (inside smartcontract2) function, the oracle will send data back to "fulfill" function of smartcontract1. But this is not working as expected
Note : I have followed this approach(Mentioned in the answer by Patrick) StackExchange question
smartcontract1
if you pass throughaddress(this)
andthis.fulfill.selector
into your call ofsmartcontract2
'sbuildChianlinkRequest
that things are working? This sounds like the proper way to format the request.requestVolumeData
but are callingrequestVolumeDataNext
is that on purpose?