Luk*_*tis 9 ethereum solidity smartcontracts cryptocurrency etherscan
我目前正在构建符合 ERC721 标准的合约,并已在此处发布合约: https: //ropsten.etherscan.io/address/0xa513bc0a0d3af384fefcd8bbc1cc0c9763307c39 - 我现在正在尝试验证并发布合约源代码
我的文件的开头如下所示:
// SPDX-License-Identifier: MIT
// We will be using Solidity version 0.8.4
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract ViperToken is ERC721 {
Run Code Online (Sandbox Code Playgroud)
但是,当尝试使用 Solidity 单个文件进行验证和发布时,出现以下错误:
ParserError: Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File import callback not supported
--> myc:6:1:
|
6 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
任何人都可以向我指出 1. 解决此问题或 2. 有关如何正确编写导入了可以使用 Etherscan 验证的依赖项的合约的文档。现在这只是一个单文件合同。
Luk*_*tis 13
简而言之,我必须深入研究才能解决这个问题,因为我对 Solidity 还很陌生。
我必须做以下事情;
总而言之,我非常确定 Etherscan Web 应用程序无法验证包含导入文件的合约。
如果有人有兴趣了解我如何构建它,最终产品就在这里https://github.com/lukecurtis93/viper-nft(这只是我在网上找到的 CryptoKitties 克隆作为基础并更新了所有内容)
小智 6
如果您正在编译到 REMIX IDE
来自 REMIX IDE
搜索“Flattener”插件
右键单击文件 -> 展平 yourcontract.sol
在 Etherscan 上复制/粘贴