在结构 Chainlink.Request 内存中进行参数相关查找后,成员 "add" 未找到或不可见
Member "add" not found or not visible after argument-dependent lookup in struct Chainlink.Request memory
我正在创建 nft 智能合约并使用 chainlinkClient.sol 更新 URI。
chainlinkClient 版本:v0.6
错误:TypeError:在结构 Chainlink.Request 内存中进行依赖于参数的查找后,找不到成员“add”或不可见。
知道为什么我会收到此错误吗?
代码:
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol";
contract phoneNumber is ChainlinkClient{
uint256 public phone_no;
address private oracle;
bytes32 private jobId;
uint256 private fee;
constructor(uint256 _initial_phone_no){
setPublicChainlinkToken();
oracle = 0x7AFe1118Ea78C1eae84ca8feE5C65Bc76CcF879e;
jobId = "6d1bfe27e7034b1d87b5270556b17277";
fee = 0.1 * 10 ** 18; // 0.1 LINK
phone_no = _initial_phone_no;
}
function requestVolumeData() public returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.update_phone_no.selector);
// Set the URL to perform the GET request on
request.add("get", "http://localhost:3000/images/phone.json");
request.add("path", "phone.new");
// Multiply the result by 1000000000000000000 to remove decimals
int timesAmount = 10**18;
request.addInt("times", timesAmount);
// Sends the request
return sendChainlinkRequestTo(oracle, request, fee);
}
function update_phone_no(bytes32 _requestId, uint256 new_phone_no) public recordChainlinkFulfillment(_requestId)
{
phone_no = new_phone_no;
}
function withdrawLink() external {
LinkTokenInterface linkToken = LinkTokenInterface(chainlinkTokenAddress());
require(linkToken.transfer(msg.sender, linkToken.balanceOf(address(this))), "Unable to transfer");
}
}
您的导入语句缺少“@”符号。像这样将其添加到开头:
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
注意:也不要忘记将您的构造函数可见性说明符显式声明为 public 或内部。
我正在创建 nft 智能合约并使用 chainlinkClient.sol 更新 URI。 chainlinkClient 版本:v0.6 错误:TypeError:在结构 Chainlink.Request 内存中进行依赖于参数的查找后,找不到成员“add”或不可见。 知道为什么我会收到此错误吗?
代码:
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "chainlink/evm-contracts/src/v0.6/ChainlinkClient.sol";
contract phoneNumber is ChainlinkClient{
uint256 public phone_no;
address private oracle;
bytes32 private jobId;
uint256 private fee;
constructor(uint256 _initial_phone_no){
setPublicChainlinkToken();
oracle = 0x7AFe1118Ea78C1eae84ca8feE5C65Bc76CcF879e;
jobId = "6d1bfe27e7034b1d87b5270556b17277";
fee = 0.1 * 10 ** 18; // 0.1 LINK
phone_no = _initial_phone_no;
}
function requestVolumeData() public returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.update_phone_no.selector);
// Set the URL to perform the GET request on
request.add("get", "http://localhost:3000/images/phone.json");
request.add("path", "phone.new");
// Multiply the result by 1000000000000000000 to remove decimals
int timesAmount = 10**18;
request.addInt("times", timesAmount);
// Sends the request
return sendChainlinkRequestTo(oracle, request, fee);
}
function update_phone_no(bytes32 _requestId, uint256 new_phone_no) public recordChainlinkFulfillment(_requestId)
{
phone_no = new_phone_no;
}
function withdrawLink() external {
LinkTokenInterface linkToken = LinkTokenInterface(chainlinkTokenAddress());
require(linkToken.transfer(msg.sender, linkToken.balanceOf(address(this))), "Unable to transfer");
}
}
您的导入语句缺少“@”符号。像这样将其添加到开头:
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
注意:也不要忘记将您的构造函数可见性说明符显式声明为 public 或内部。