BSC链合约开源问题,我把几个源码问题提交的时候遇到这个问题,请问怎么解决(有引用其他几个文件,我都提交了)

Compiler debug log: Error! Unable to generate Contract ByteCode and ABI (General Exception, unable to get compiled [bytecode]) For troubleshooting, you can try compiling your source code with the Remix - Solidity IDE and check for exceptions

Compiler Warning(s):

ParserError: Source "extensions/IERC20Metadata.sol" not found: File import callback not supported --> ERC20.sol:6:1: | 6 | import "./extensions/IERC20Metadata.sol" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "utils/Context.sol" not found: File import callback not supported --> ERC20.sol:7:1: | 7 | import "../../utils/Context.sol" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "utils/Context.sol" not found: File import callback not supported --> Ownable.sol:5:1: | 5 | import "../utils/Context.sol" | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org/ for more information. --> token.sol

ParserError: Source "[@openzeppelin/contracts/token/ERC20/ERC20.sol" ]()not found: File import callback not supported --> token.sol:3:1: | 3 | import "[@openzeppelin/contracts/token/ERC20/ERC20.sol"]() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

ParserError: Source "[@openzeppelin/contracts/access/Ownable.sol" ]()not found: File import callback not supported --> token.sol:4:1: | 4 | import '[@openzeppelin/contracts/access/Ownable.sol']() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

请先 登录 后评论

最佳答案 2021-12-01 20:09

你可以先用 hardhat flatten 或者 truffle-flattener 把文件展开放到一个文件里,再提交验证。

注意把重复的版权声明(SPDX-License-Identifier:),编译器声明(pragma solidity)去掉。

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,4038 浏览
  • 江南 提出于 2021-12-01 15:29