I have a question about the RSK integration (specifically about how callback addresses are used) https://github.com/smartcontractkit/chainlink-RSK/blob/master/test-runner/src/contracts/Consumer.sol
function requestRIFPriceByCallback(uint256 _payment, address _callback) public {
Chainlink.Request memory req = buildChainlinkRequest(specId, _callback, this.fulfill.selector);
req.add("get", "https://api.liquid.com/products/580");
req.add("path", "last_traded_price");
req.addInt("times", 100000000);
sendChainlinkRequest(req, _payment);
}
https://github.com/smartcontractkit/chainlink/blob/develop/evm-contracts/src/v0.4/tests/Consumer.sol
function requestEthereumPrice(string _currency) public {
Chainlink.Request memory req = buildChainlinkRequest(specId, this, this.fulfill.selector);
req.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY");
string[] memory path = new string[](1);
path[0] = _currency;
req.addStringArray("path", path);
sendChainlinkRequest(req, ORACLE_PAYMENT);
}
These are from Consumer.sol (above from RSK and below from original) Why does the RSK consumer require a callback address and what does that do/how does it work?
Both of these functions have callback addresses. You’ll see in the second method they just use ‘this’. The callback address is a parameter in the ‘buildChainlinkRequest’ function. It specifies which contract to return the data to. That combined with the function selector lets you pick which contract and function you want to return your data to.
The 2nd method doesn’t have a callback address because it’s set to ‘this’. The first function lets you pick.