PatrickAlphaC / hardhat-fund-me-fcc

82 stars 184 forks source link

Could not compile the Contracts with version ^0.8.8 #109

Closed snake-py closed 1 year ago

snake-py commented 1 year ago

Hey I tried copy-pasting the contracts as you did from the repo and then tried to compile them. It told me that version 0.8.8 is required for the fundMe contract, so the modifier is working correctly.

The error message I was seeing:

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/FundMe.sol (^0.8.8)
  * @chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol (^0.8.0)
  * contracts/PriceConverter.sol (^0.8.8)

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

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

I could only fixed by setting all versions to 0.8.0, without the ^ (also in the hardhat.config.js).

Inside the FundMe.sol contract I also commented the error NotOwner() and adjusted the modifier to look like this:

    modifier onlyOwner {
        require(msg.sender == i_owner);
        // if (msg.sender != i_owner) revert NotOwner();
        _;
    }

Then it compiles