Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lesson 6: MockV3Aggregator compile error #1790

Unanswered
itgav asked this question in Q&A
Discussion options

I'm using Solidity 0.8.17, the video was using 0.6.x. So, when copying the code for the "MockV3Aggregator" I needed to change some things from version 0.6 to version 0.8. Changes:

  • pragma solidity >=0.6.6 <0.9.0; --> it was "^0.6.0"
  • import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV2V3Interface.sol"; --> it was importing from "v0.6"

I was still having some issues running brownie compile. When I would try to run brownie compile, it would initially download Solidity version 0.6.12. Then, it would say:

"CompilerError: solc returned the following errors:

contracts/test/MockV3Aggregator.sol:6:1: ParserError: Source file requires different compiler version (current compiler is 0.6.12+commit.27d51765.Windows.msvc) - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.8.0;"

I couldn't figure out exactly why it kept trying to compile using Solidity 0.6.12. I tried changing the compiler version in Visual Studio Code but that didn't work. Ultimately, to fix the issue and allow the code to be compiled without error, I added a version specification of 0.8.17 in the brownie-config.yaml file. To specify version, you should already have a hierarchy built out from earlier in the video that looks something like this "compiler >> "solc" >> "remappings". Subordinated to (underneath) the "solc" section, where "remappings" is, add a new section "version" and specify the version.

You must be logged in to vote

Replies: 1 comment

Comment options

Hello @itgav
Please follow this steps and let us know if it works for you:

  1. Delete the build folder on your project. (Try compiling again).
  2. If it does not work, go to your home folder (in windows C:\Users\YourUser) and delete the .brownie folder, which is a hidden one.
  3. Change the compiler version from remote to local and backwards on the Solidity extension for vscode, sometimes that help to refresh the compiler version which is taken.

Does any of this help? Please let us know.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /