I have tried everything I know to do (which is limited, ill admit) and I cannot seem to resolve this error.
Error HH606: The project cannot be compiled, see reasons below.
The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.
- @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/IERC20.sol (^0.8.0)
- @openzeppelin/contracts/utils/Context.sol (^0.8.0)
- @openzeppelin/contracts/access/Ownable.sol (^0.8.0)
These files import other files that use a different and incompatible version of Solidity:
- contracts/AccessControl.sol (^0.5.0) imports @openzeppelin/contracts/access/Ownable.sol (^0.8.0)
- contracts/BCToken.sol (^0.5.0) imports @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0)
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 PS C:\Users\smart\WEB3-GAME\Contracts> npx hardhat compile Error HH411: The library @openze import, imported from contracts/BCToken.sol, is not installed. Try installing it using npm.
For more info go to https://hardhat.org/HH411 or run Hardhat with --show-stack-traces PS C:\Users\smart\WEB3-GAME\Contracts> npx hardhat compile Error HH404: File @openzeppelin/contracts/access/ERC20/ERC20.sol, imported from contracts/BCToken.sol, not found.
For more info go to https://hardhat.org/HH404 or run Hardhat with --show-stack-traces PS C:\Users\smart\WEB3-GAME\Contracts> npx hardhat compile Error HH606: The project cannot be compiled, see reasons below.
The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.
- contracts/AccessControl.sol (0.8.0)
- contracts/BCToken.sol (0.8.0)
- @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/IERC20.sol (^0.8.0)
- @openzeppelin/contracts/utils/Context.sol (^0.8.0)
- @openzeppelin/contracts/access/Ownable.sol (^0.8.0)
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 PS C:\Users\smart\WEB3-GAME\Contracts> npx hardhat compile Error HH606: The project cannot be compiled, see reasons below.
The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.
- contracts/AccessControl.sol (^0.8.0)
- contracts/BCToken.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/IERC20.sol (^0.8.0)
- @openzeppelin/contracts/utils/Context.sol (^0.8.0)
- @openzeppelin/contracts/access/Ownable.sol (^0.8.0)
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 PS C:\Users\smart\WEB3-GAME\Contracts> npx hardhat compile Error HH606: The project cannot be compiled, see reasons below.
The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.
- contracts/AccessControl.sol (^0.8.0)
- contracts/BCToken.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol (^0.8.0)
- @openzeppelin/contracts/token/ERC20/IERC20.sol (^0.8.0)
- @openzeppelin/contracts/utils/Context.sol (^0.8.0)
- @openzeppelin/contracts/access/Ownable.sol (^0.8.0)
AccessControl.Sol
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract AccessControl is Ownable {
mapping(address => bool) public admins;
function setAdmin(address user, bool enable) external onlyOwner { admins[user] = enable; }
modifier onlyAdmin() { require( msg.sender == owner() || admins[msg.sender] == true, "AccessControl: Caller doesn't have admin access" ); _; } }
BCToken.sol
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./AccessControl.sol";
contract BCToken is ERC20, AccessControl {
constructor(uint256 amount) ERC20("BCToken", "BCT") public {}
function mint(address user, uint amount)
external
onlyAdmin
returns(bool)
{
_mint(user, amount);
return true;
hardhat.config.js
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: {
compilers: [
{
version: "0.5.7",
},
{
version: "0.6.7",
settings: {},
},
],
},
networks: {
sepolia: {
url: "https://sepolia.infura.io/v3/",
accounts: [process.env.KEY],
}
}
}
}