Replies: 1 comment
-
Yep, the compiler of the extension is just something we add to vscode to have linting highlights and syntax correction, however brownie downloads the compiler for the version of the contract separately. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say you have something like this in your code
... and you are trying
brownie compile
. You will get the following error.This won't help ...
Changing the compiler version in VSCode with the solidity plugin via right click
"Solidity: change workspace compiler version (Remote)" to 0.8.0 or anything above won't help.
Brownie will ignore this and try to get the highest version in the range of your pragma solidity starting point.
pragma solidity >=0.6.0 <0.9.0;
The starting point here is 0.6.0 so Brownie will use 0.6.12 and try to compile this file regardless of the settings of VSCode.
Solution:
Edit: When you need to stay in your main version, e.g. so something between 0.6.6 and 0.6.12 because higher versions are not backward compatible, you have to use the carrot character like so:
pragma solidity ^0.6.6;
Now the highest solc version in this case 0.6.12 of this main version 0.6.* will be used.
Special case
In the code below, you want to use a library that is written in solidity version 0.8.* (see the import statement).
In this case you might need to adapt your code to fit the higher version. Here a typical upwards compatibility bug.
on 0.8.0 a transfer looks like this
payable(msg.sender).transfer(address(this).balance);
on 0.6.0 a transfer looks like this
msg.sender.transfer(address(this).balance);
Beta Was this translation helpful? Give feedback.
All reactions