微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么在 Visual Code 中编译 Solidity 的智能合约会生成此错误:“ParserError: Expected identifier, got 'LParen'”

如何解决为什么在 Visual Code 中编译 Solidity 的智能合约会生成此错误:“ParserError: Expected identifier, got 'LParen'”

我使用的是 ERC1155 的智能合约(Open Zeppelin),它在 Remix 中可以正确编译,但是当我在 Visual Code 中编译时收到

解析器错误:预期标识符,得到“LParen”

智能合约可以成功部署到 Rinkeby 测试网。但是,当我尝试在 Etherscan 中验证合同时,它给了我以下消息:

注意:无法确定构造器参数,请检查并用正确的值替换(6e65746f70656e2e707974686f6e616e7977686572652e636f6d2f7374617469632f6d6574616461646f732f6d6574616461646f7370617261657263313135352e747874)

这是构造函数代码

 // contracts/AFSE.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
//import "../../utils/introspection/ERC165.sol";
contract AFSE is ERC1155{
    mapping (uint256 => mapping(address => uint256)) internal _balances;
    mapping (uint256 => mapping(address => uint256)) internal mapof_urihash;
    address public creator; // Used as the URI for all token types by relying on ID substitution,e.g. https://token-cdn-domain/{id}.json
    event Createtoken(address creator,address owner,uint256 _id,uint256 _value,string uri,uint256 _urihash);

    constructor ()  ERC1155("netopen.pythonanywhere.com/static/Metadados/Metadadosparaerc1155.txt") {
        creator=msg.sender;
    }

我该如何解决这个问题?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?