无法更改VSCode中的solc编译器版本



在尝试使用布朗尼进行编译时,我在VSCode中遇到了此错误。我知道这个错误来自我的一个文件中的pragma solidity版本,它与我的编译器不同:

PS C:UsersmeDocumentsCodeBlockchainbrownie_fundme> brownie compile
INFO: Could not find files for the given pattern(s).
Brownie v1.18.1 - Python development framework for Ethereum
Compiling contracts...
Solc version: 0.8.13
Optimizer: Enabled  Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
ParserError: Source file requires different compiler version (current compiler is 0.8.13+commit.abaa5c0e.Windows.msvc) - note that nightly builds are considered to be strictly less than the released version
--> C:/Users/me/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/vendor/SafeMathChainlink.sol:2:1:
|
2 | pragma solidity ^0.6.0;
| ^^^^^^^^^^^^^^^^^^^^^^^

我试图使用Juan Blanco的"Solidity"VSCode扩展将我的编译器版本更改为">更改全局/工作区编译器版本(远程(";,选择版本0.6.0。(我确认这将"solidity.compileUsingRemoteVersion": "v0.6.0+commit.6c089d02"添加到我的设置.json中(。

但当我再次运行brownie compile时,我仍然会得到相同的错误:

">。。。ParserError:源文件需要不同的编译器版本(当前编译器为0.8.13+commit.abaa5c0e.Windows.msvc(…",显示我的编译器版本保持不变。

(我将默认编译器设置为远程,在进行这些更改后,我还尝试重新启动任何打开的终端。(

我已经安装了带有pip的solcx,并且在我的"C:/Users/me";目录,它包含一个文件夹";solc-v0.8.13";。我试着删除那个文件夹并重新编译,但布朗尼自动下载了相同的v0.8.13。

我对如何更改全局或工作区编译器版本感到困惑。solc的版本是否会从我的VSCode设置之外的其他地方被覆盖?

将以下brownie-config.yaml文件添加到您的项目中:

compiler:
solc:
version: 0.6.12

当你compile时,布朗尼会从配置下载solc版本。

最新更新