Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The updated config file wouldn't compile unless I changed the compiler to 8.1 and commented out the private keys. #24

Open
mattjaf opened this issue Mar 12, 2022 · 4 comments

Comments

@mattjaf
Copy link

mattjaf commented Mar 12, 2022

/**
 * @type import('hardhat/config').HardhatUserConfig
 */
require("@nomiclabs/hardhat-waffle")
require("@nomiclabs/hardhat-ethers")
require("@nomiclabs/hardhat-truffle5")
require("@nomiclabs/hardhat-etherscan")
require("hardhat-deploy")


require('dotenv').config()

const MAINNET_RPC_URL = process.env.MAINNET_RPC_URL || process.env.ALCHEMY_MAINNET_RPC_URL || "https://eth-mainnet.alchemyapi.io/v2/..........your key"
const RINKEBY_RPC_URL = process.env.RINKEBY_RPC_URL || "https://rinkeby.infura.io/v3/.....................your key"
const KOVAN_RPC_URL = process.env.KOVAN_RPC_URL || "https://kovan.infura.io/v3/......your key"
const MNEMONIC = process.env.MNEMONIC || "your mnemonic"
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || "your api key"
// optional
const PRIVATE_KEY = process.env.PRIVATE_KEY || "your private key"

module.exports = {
    defaultNetwork: "hardhat",
    networks: {
        hardhat: {

            // // If you want to do some forking, uncomment this
            // forking: {
            //   url: MAINNET_RPC_URL
            // }
        },
        localhost: {
        },
        kovan: {
            url: KOVAN_RPC_URL,
            // accounts: [PRIVATE_KEY],
            accounts: {
                mnemonic: MNEMONIC,
            },
            saveDeployments: true,
        },
        rinkeby: {
            url: RINKEBY_RPC_URL,
            //  accounts: [PRIVATE_KEY],
            // accounts: {
            //  mnemonic: MNEMONIC,
            // },
            saveDeployments: true,
        },
        ganache: {
            url: 'http://localhost:8545',
            accounts: {
                mnemonic: MNEMONIC,
            }
        },
        mainnet: {
            url: MAINNET_RPC_URL,
            // accounts: [PRIVATE_KEY],
            accounts: {
                mnemonic: MNEMONIC,
            },
            saveDeployments: true,
        },
        polygon: {
            url: "https://rpc-mainnet.maticvigil.com/",
            // accounts: [PRIVATE_KEY],
            accounts: {
                mnemonic: MNEMONIC,
            },
            saveDeployments: true,
        },
    },
    etherscan: {
        // Your API key for Etherscan
        // Obtain one at https://etherscan.io/
        apiKey: ETHERSCAN_API_KEY
    },
    namedAccounts: {
        deployer: {
            default: 0, // here this will by default take the first account as deployer
            1: 0 // similarly on mainnet it will take the first account as deployer. Note though that depending on how hardhat network are configured, the account 0 on one network can be different than on another
        },
        feeCollector: {
            default: 1
        }

    },
    solidity: {
        compilers: [
            {
                version: "0.8.1"
            },
            {
                version: "0.7.0"
            },
            {
                version: "0.6.6"
            },
            {
                version: "0.4.24"
            }
        ]
    },
    mocha: {
        timeout: 100000
    }
}
@PatrickAlphaC
Copy link
Owner

Could you make this in a pull request? 🙏

@mattjaf
Copy link
Author

mattjaf commented Mar 15, 2022

Ended up having to do it manually...

It'd be cool to see how the "pull request" is done the OG gangster way

@PatrickAlphaC
Copy link
Owner

I'll leave this issue open if anyone else ran into it

@mattjaf
Copy link
Author

mattjaf commented Mar 19, 2022

Still trying to understand it as well,
I though I broke my hardhat for like 10 straight hours.

Hope this helps,

Seems like when the .env file doesn't have the value for private key it throws:

Error HH8: There's one or more errors in your config file:

  * Invalid account: #0 for network: kovan - private key too short, expected 32 bytes
  * Invalid account: #0 for network: rinkeby - private key too short, expected 32 bytes
  * Invalid account: #0 for network: ganache - private key too short, expected 32 bytes
  * Invalid account: #0 for network: mainnet - private key too short, expected 32 bytes
  * Invalid account: #0 for network: polygon - private key too short, expected 32 bytes

After, commenting it out and trying to compile with 8.4 it throws:

Internal exception in StandardCompiler::compile: C:\Users\circleci\project\libsolidity\ast\AST.cpp(183): Throw in function class std::vector<class solidity::frontend::ErrorDefinition const *,class std::allocator<class solidity::frontend::ErrorDefinition const *> > __cdecl solidity::frontend::ContractDefinition::interfaceErrors(bool) const
Dynamic exception type: struct boost::wrapexcept<struct solidity::langutil::InternalCompilerError>
std::exception::what: 
[struct solidity::util::tag_comment * __ptr64] = 

Error HH600: Compilation failed

Trying to compile with 8.0 it throw:

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/utils/Address.sol (^0.8.1)


These files and its dependencies cannot be compiled with your config. This can happen because they have incompatible Solidity pragmas, or don't match any of your configured Solidity compilers.


  * contracts/RandomSVG.sol
  * contracts/SVGNFT.sol
  * @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol
  * @openzeppelin/contracts/token/ERC721/ERC721.sol

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants