Truffle migrate 在打开的 zeppelin ERC721 上显示错误

问题描述

我对松露和 solidity 很陌生,这可能是一个新手错误

在输入 truffle migrate --reset 时,出现以下错误

    @openzeppelin/contracts/introspection/ERC165.sol:24:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable,making it "abstract" is sufficient.
    constructor () internal {
    ^ (Relevant source part starts here and spans across multiple lines).,@openzeppelin/contracts/token/ERC721/ERC721.sol:93:5: Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable,making it "abstract" is sufficient.
    constructor (string memory name_,string memory symbol_) public {       
    ^ (Relevant source part starts here and spans across multiple lines)

> Artifacts written to C:\Users\greathawkeye\blockchain\abis
> Compiled successfully using:
   - solc: 0.7.6+commit.7338295f.Emscripten.clang

看起来这个警告阻止我编译。这是我的代币和我的迁移合同:

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

import '@openzeppelin/contracts/token/ERC721/ERC721.sol';

contract MyToken is ERC721 {
    constructor() ERC721('MyToken','MYT') {}
}

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.8.0;

contract Migrations {
    address public owner;
    uint256 public last_completed_migration;

    modifier restricted() {
        if (msg.sender == owner) _;
    }

    constructor() {
        owner = msg.sender;
    }

    function setCompleted(uint256 completed) public restricted {
        last_completed_migration = completed;
    }

    function upgrade(address new_address) public restricted {
        Migrations upgraded = Migrations(new_address);
        upgraded.setCompleted(last_completed_migration);
    }
}

truffle version 给了我这个:

Truffle v5.1.62 (core: 5.1.62)
solidity - >=0.6.0 <0.8.0 (solc-js)
Node v15.5.0
Web3.js v1.2.9

这是我的truffle-config.js

module.exports = {
  compilers: {
    solc: {
      version: ">=0.6.0 <0.8.0",optimizer: {
        enabled: true,runs: 200
      }
    }
  },networks: {
    development: {
      host: "127.0.0.1",port: 7545,network_id: "*" // Match any network id
    }
  }
};

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...