hardhat solidity不同版本,不能正常编译

比特聪 比特聪 提出于 2021-04-15 09:17 9241 浏览

hardhat.config.js

compilers: [
      {
        version: "0.7.0"
      },
      {
        version: "0.7.3"
      },
      {
        version: "0.8.0"
      },
      {
        version: "0.8.1"
      },
    ]
  },

编译时异常提示

npx hardhat compile Solidity 0.8.0, 0.8.1 are not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

Learn more at https://hardhat.org/reference/solidity-support"

Error HH606: The project cannot be compiled, see reasons below.

These files import other files that use a different and incompatible version of Solidity:

  • @soliditylabs/erc20-permit/contracts/ERC20Permit.sol (^0.7.0) imports @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0) and @openzeppelin/contracts/utils/Counters.sol (^0.8.0)

These files depend on other files that use a different and incompatible version of Solidity:

  • contracts/ERC20PermitToken.sol (^0.7.0) depends on @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0), @openzeppelin/contracts/utils/Counters.sol (^0.8.0) and 2 other files. Use --verbose to see the full list.

To learn more, run the command again with --verbose

Read about compiler configuration at https://hardhat.org/config

For more info go to https://hardhat.org/HH606 or run Hardhat with --show-stack-traces

2 个回答

Tiny熊 2021-04-15 09:47

擅长:智能合约,以太坊

Yee CTO 2021-04-17 22:14

写回答

你需要登录后才可以回答问题,登录