在混音IDE中导入可证明的

发布于 2025-01-19 09:14:21 字数 2123 浏览 1 评论 0原文

我正在尝试在线IDE上学习坚固性。我正在尝试在IDE中使用可证明的,并且已经激活了插件。我认为也许这可以继承我的合同中的蝙蝠“使用”,但IDE找不到标识符。我尝试从GitHub导入该插件,但仍然无法找到它。如果有任何东西会造成更大的问题,因为当我尝试导入软件包时,IDE找不到任何OpenZepplin文件。我将如何在在线IDE上完成此操作?

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;



import "@openzeppelin/[email protected]/token/ERC721/ERC721.sol";
import "@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/[email protected]/access/Ownable.sol";
import "@openzeppelin/[email protected]/utils/Counters.sol";
import "github.com/provable-things/ethereum-api/provableAPI.sol";



contract Neuron is ERC721, ERC721Enumerable, Ownable {
using Counters for Counters.Counter;

Counters.Counter private _tokenIdCounter;

constructor() ERC721("Neuron", "Neuron") {}

// function make_call() public {
//     provable_query("URL","https://api.kraken.com/0/public/Ticker?pair=ETHXBT");
// }



function _baseURI() internal pure override returns (string memory) {
    return "http://api.Neuron.com/tokens/";
}

function safeMint(address to) public onlyOwner {
    uint256 tokenId = _tokenIdCounter.current();
    _tokenIdCounter.increment();
    _safeMint(to, tokenId);
}

// The following functions are overrides required by Solidity.

function _beforeTokenTransfer(address from, address to, uint256 tokenId)
    internal
    override(ERC721, ERC721Enumerable)
{
    super._beforeTokenTransfer(from, to, tokenId);
}

function supportsInterface(bytes4 interfaceId)
    public
    view
    override(ERC721, ERC721Enumerable)
    returns (bool)
{
    return super.supportsInterface(interfaceId);
}
}

这是一个简单的预制合同,尚未更改任何内容。我已经评论了测试查询调用的功能。

I am trying to learn solidity on the online ide. I am trying to use Provable within the ide and I have activated the plugin. I thought maybe that could just inherit 'usingProvable' off the bat to my contract but the ide could not find the identifier. I tried importing the plugin from github but still is not able to find it. If anything it creates a bigger problem because the ide does not find any of the openzepplin files when I try to import the package. How would I accomplish this on the online ide?

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;



import "@openzeppelin/[email protected]/token/ERC721/ERC721.sol";
import "@openzeppelin/[email protected]/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/[email protected]/access/Ownable.sol";
import "@openzeppelin/[email protected]/utils/Counters.sol";
import "github.com/provable-things/ethereum-api/provableAPI.sol";



contract Neuron is ERC721, ERC721Enumerable, Ownable {
using Counters for Counters.Counter;

Counters.Counter private _tokenIdCounter;

constructor() ERC721("Neuron", "Neuron") {}

// function make_call() public {
//     provable_query("URL","https://api.kraken.com/0/public/Ticker?pair=ETHXBT");
// }



function _baseURI() internal pure override returns (string memory) {
    return "http://api.Neuron.com/tokens/";
}

function safeMint(address to) public onlyOwner {
    uint256 tokenId = _tokenIdCounter.current();
    _tokenIdCounter.increment();
    _safeMint(to, tokenId);
}

// The following functions are overrides required by Solidity.

function _beforeTokenTransfer(address from, address to, uint256 tokenId)
    internal
    override(ERC721, ERC721Enumerable)
{
    super._beforeTokenTransfer(from, to, tokenId);
}

function supportsInterface(bytes4 interfaceId)
    public
    view
    override(ERC721, ERC721Enumerable)
    returns (bool)
{
    return super.supportsInterface(interfaceId);
}
}

this is a simple premade contract on remix and had not changed anything yet. I had commented out the function for testing a query call.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

口干舌燥 2025-01-26 09:14:21

provable_api有点过时。您导入的文件是provableApi_0.4.4.25.sol允许编译器版本> = 0.4.22< syl symlink; 0.5 ,而您导入的OpenZeppelin合同需要^0.8.0

  • 您可以找到一个匹配版本,
  • 可以通过Remix IDE本地复制Provable_api合同,并使用相对路径并尝试使用更高的编译器版本

PS。我认为混音IDE在符号链接上遇到了麻烦。如果您像这样导入库,则可以更容易地看到问题:

import "github.com/provable-things/ethereum-api/provableAPI_0.5.sol";

provable_api is a bit outdated. The file you import is a symlink to provableAPI_0.4.25.sol which allows compiler versions >= 0.4.22 < 0.5, while your imported OpenZeppelin contracts require ^0.8.0.

  • You can find a matching version
  • You can copy the provable_api contract locally in Remix IDE and use a relative path and try using a higher compiler version

PS. I think Remix IDE is having trouble with symbolic links. You can see the problem easier if you import the library like this:

import "github.com/provable-things/ethereum-api/provableAPI_0.5.sol";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文