Closed br0wnD3v closed 2 years ago
Hello @bot-eth-dev give a check to your brownie config.yaml and check which version are you using, use the 1.1.1. And also delete the .brownie
folder on your home, and compile again.
In the config file I have
dependencies:
- smartcontractkit/chainlink-brownie-contracts@1.1.1
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/chainlink-brownie-contracts@1.1.1'
And in the Lottery.json I found the compiler details
"compiler": {
"evm_version": "istanbul",
"optimizer": {
"enabled": true,
"runs": 200
},
"version": "0.6.6+commit.6c089d02"
},
And the remappings are
{
"python.defaultInterpreterPath": "/bin/python",
"solidity.compileUsingRemoteVersion": "v0.6.6+commit.6c089d02",
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"bracketPairColorizer.depreciation-notice": false,
"solidity.remappings": [
"@chainlink/=/home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1",
"@openzeppelin/=/home/botvenom/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.4.0"
]
}
After deleting the .brownie I am unable to do anything cause it is in the remappings. what do I do now
So, What I have learned is my vs code was unable to load directly from GitHub so I downloaded chainlink-brownie-contracts@1.1.1 locally in the past. How do I go about that ?
Brownie v1.17.2 - Python development framework for Ethereum
Compiling contracts... Solc version: 0.8.11 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.11+commit.d7f03943.Linux.g++) - note that nightly builds are considered to be strictly less than the released version --> /home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/VRFConsumerBase.sol:2:1: | 2 | pragma solidity ^0.6.0; | ^^^^^^^^^^^^^^^^^^^^^^^
ParserError: Source file requires different compiler version (current compiler is 0.8.11+commit.d7f03943.Linux.g++) - note that nightly builds are considered to be strictly less than the released version --> /home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.4/ERC677Token.sol:1:1: | 1 | pragma solidity ^0.4.11; | ^^^^^^^^^^^^^^^^^^^^^^^^
ParserError: Source file requires different compiler version (current compiler is 0.8.11+commit.d7f03943.Linux.g++) - note that nightly builds are considered to be strictly less than the released version --> /home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.4/vendor/StandardToken.sol:1:1: | 1 | pragma solidity ^0.4.11; | ^^^^^^^^^^^^^^^^^^^^^^^^
ParserError: Source file requires different compiler version (current compiler is 0.8.11+commit.d7f03943.Linux.g++) - note that nightly builds are considered to be strictly less than the released version --> /home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/interfaces/LinkTokenInterface.sol:2:1: | 2 | pragma solidity ^0.6.0; | ^^^^^^^^^^^^^^^^^^^^^^^
I have set the compiler to load the remote version and I've set it to v0.6.6 But it is still showing these errors and even the current compiler is showing 0.8.11?
Ok let's try something here:
hello @cromewar
1)After doing what you said at least 3 times again and again to make sure it was set to 0.6.0
brownie compile
gave me
Brownie v1.17.2 - Python development framework for Ethereum
New compatible solc version available: 0.6.6
Compiling contracts...
Solc version: 0.6.6
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
/home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.4/ERC677Token.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.6.6+commit.6c089d02.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.11;
^----------------------^
/home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.4/vendor/StandardToken.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.6.6+commit.6c089d02.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.11;
^----------------------^
2) I have
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
in my Lottery.sol
3) I am using v0.0.136 Solidity
by Juan Blanco
@PatrickAlphaC any idea about this?
@cromewar I did manage to get it to v0.6.0 but now I have
Brownie v1.17.2 - Python development framework for Ethereum
Compiling contracts...
Solc version: 0.6.0
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
contracts/test/LinkToken.sol:2:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.11;
^----------------------^
/home/botvenom/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/VRFConsumerBase.sol:176:22: ParserError: Expected identifier but got reserved keyword 'immutable'
LinkTokenInterface immutable internal LINK;
^-------^
this error :')
@cromewar Do you think if I degrade all the pragma in my lottery and test contracts to 0.4.11 it might run?
@cromewar I copy pasted my lottery.sol file on remix ide and set the compiler to v0.6.0 and there too the following error shows up
@chainlink/contracts/src/v0.6/VRFConsumerBase.sol:176:22: ParserError: Expected identifier but got reserved keyword 'immutable'
LinkTokenInterface immutable internal LINK;
^-------^
It shouldn't be as that, because the compiler should use anything above that version, let me make some research on this I'll try to reproduce the error.
@cromewar thank you for helping me out :)
Well I wasn't able to reproduce the error, I have a question tough. "What I have learned is my vs code was unable to load directly from GitHub" what you refer to this? adding the remappings to your brownie-config.yaml should be enough to get it done.
Just for curiosity, could you try cloning the course repo lesson and try to compile it?
In the tutorial at first even after doing the remappings I still couldn't get the import to work and I searched here and there where I stumbled upon brownie pm install
so it manually downloaded the chainlink v1.1.1 and configured in the settings.json to remap the @chainlink to the directory.
Well, I downloaded the Lesson 7 repo and ran it. Works smoothly with no errors. I have started to go through the lesson again anyways. I must have messed up somewhere during the lesson, hence the errors. I am so sorry I wasted so much of your time over a probably stupid naive mistake. Thank you so much for cooperating @cromewar. Best Regards, Bot.
Don't worry about it, I really hope you to find the error now your are taking the lesson again.
I have the exact same issue, and I have been trying to find an answer. I've restarted the lesson all over again to make sure I didn't miss anything and I eventually got to this same error when I enter 'brownie compile' or 'brownie run scripts/deploy_lottery.py' . my error code shows:
'Brownie v1.16.4 - Python development framework for Ethereum
Compiling contracts... Solc version: 0.6.0 Optimizer: Enabled Runs: 200 EVM Version: Istanbul CompilerError: solc returned the following errors:
/Users/mrandmrsbush/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.6/VRFConsumerBase.sol:186:33: ParserError: Expected identifier but got reserved keyword 'immutable' LinkTokenInterface internal immutable LINK; ^---------^ '
helpful_scripts.py
`from brownie import ( network, config, accounts, MockV3Aggregator, VRFCoordinatorMock, LinkToken, Contract, )
FORKED_LOCAL_ENVIRONMENTS = ["mainnet-fork"] LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["development", "ganache-cli"]
def get_account(index=None, id=None): if index: return accounts[index] if id: return accounts.load(id) if ( network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS or network.show_active() in FORKED_LOCAL_ENVIRONMENTS ): return accounts[0] return accounts.add(config["wallets"]["from_key"])
contract_to_mock = { "eth_usd_price_feed": MockV3Aggregator, "vrf_coordinator": VRFCoordinatorMock, "link_token": LinkToken, }
def get_contract(contract_name): """This function will grab the contact addresses from the brownie config if defined, otherwise it will deploy a mock version of that contract and return that mock contract.
Args:
contract_name (string)
Returns:
brownie.network.contract.ProjectContract: The most recently deployed
version of this contract.
"""
contract_type = contract_to_mock[contract_name]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
if len(contract_type) <= 0:
deploy_mocks()
contract = contract_type[-1]
else:
contract_address = config["networks"][network.show_active()][contract_name]
contract = Contract.from_abi(
contract_type._name, contract_address, contract_type.abi
)
return contract
DECIMALS = 8 INITIAL_VALUE = 200000000000
def deploy_mocks(decimals=DECIMALS, initial_value=INITIAL_VALUE): account = get_account() MockV3Aggregator.deploy(decimals, initial_value, {"from": account}) link_token = LinkToken.deploy({"from": account}) VRFCoordinatorMock.deploy(link_token.address, {"from": account}) print("Mocks deployed!") ` brownie-config.yaml
'compiler: solc: version: 0.6.0 dependencies:
deploy_lottery.py
'from scripts.helpful_scripts import get_account, get_contract from brownie import Lottery, network, config
def deploy_lottery(): account = get_account() Lottery.deploy( get_contract("eth_usd_price_feed").address, get_contract("vrf_coordinator").address, get_contract("link_token").address, config["networks"][network.show_active()]["fee"], config["networks"][network.show_active()]["keyhash"], {"from": account}, publish_source=config["networks"][network.show_active()].get("verify", False), ) print("Deployed lottery!")
def main(): deploy_lottery() '
.env 'export PRIVATE_KEY= export WEB3_INFURA_PROJECT_ID= export ETHERSCAN_TOKEN= '
ultimately I'm trying to test the contract on a development ganache-cli. The problem is the 'immutable' identifier in the VRFConsumerBase.sol source code. I would like to continue the course, and I do not want to redo all the work I've done so far for a third time. Thank you for the guidance!
It's likely just an issue with the package versions you're using... Could you try the 0.3.1 version of chainlink-brownie-contracts?
Hello everyone, this is in reference to the brownie run scripts/deployLottery.py @7:34:25. When I tried to run it the solc is throwing me the following error. I tried to edit the source files by changing ^ to >= which resulted in even more errors. My remote version for compile is 0.6.6. I've tried to get past it by looking here and there on some websites but this doesn't seem to go away. Any help is appreciated. Thank you!