Chainlink Consumer合同中回调地址的用途是什么?

凯尔·圣地亚哥(Kyle Santiago)

我有一个关于RSK集成的问题(特别是关于如何使用回调地址)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);
  }

这些来自Consumer.sol(来自RSK,其上方是原始),为什么RSK消费者需要回调地址,该地址起什么作用/如何工作?

帕特里克·柯林斯

这两个函数都有回调地址。您会在第二种方法中看到他们只使用'this'。回调地址是“ buildChainlinkRequest”函数中的参数。它指定将数据返回到哪个合同。结合了功能选择器,您可以选择要将数据返回到哪个合约和功能。

第二个方法没有回调地址,因为它设置为“ this”。第一个功能让您选择。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Java中的回调接口是什么?

Android中的回调是什么?

Json.NET序列化回调中StreamingContext参数的用途是什么?

Android Studio中“向...添加方法合同”的主要用途是什么

Chainlink作业未返回值

BumpGasUntilSafe FindTxByAttempt:找不到记录-Ropsten上的Chainlink节点

Chainlink节点:事务挂起时该怎么办?

运行Chainlink节点-无法连接到数据库

从其他区块链集成到Chainlink

Kotlin 中的回调是什么?

在 Brownie 中分叉主网时,chainlink 请求是如何处理的?

如何为 chainlink 节点/外部适配器设置自定义超时?

从哪里获得 Matic 的 Chainlink VRF 代币?

CHAINLINK 节点 - 您的节点过载并可能开始丢失作业错误

CHAINLINK 节点 - 启动问题 - 无法初始化 ORM

每次单击“getLatestPrice”按钮时,如何更新某些 ChainLink 聚合器提供的数据?

在 Docker-Compose 中设置 Chainlink Keystore 密码

Chainlink API 调用作业未完成 - 教程

使用单个 ChainLink 请求从同一个 JSON 响应中读取多个 uint256 条目

Chainlink 获取请求突然不适用于当前的 Solidity 版本

使用 v2 chainlink 规范提出直接请求

哪些参数对 Chainlink VRF 消费者合约中的变化敏感?

為什麼我收到以下 Chainlink 錯誤:無法估計氣體

在 Solidity 中使用 Chainlink getHistoricalData()。什麼是roundID?

Chainlink Feed Aggregator 的實現

Chainlink 節點 - encode_tx 錯誤長度不正確

如何在我的智能合约中使用chainlink VRF v1?

如何使用 ChainLink Solidity 智能合约修复 TypeError 和 DeclarationError?

ChainLink:当我调用 GetRoundData 时,数据来自哪里?