smartcontract-lottery icon indicating copy to clipboard operation
smartcontract-lottery copied to clipboard

version issue in LinkToken.sol file

Open N-NeelPatel opened this issue 2 years ago • 7 comments

I am using solidity version 0.8.0 while creating the Lottery.sol file. But For LinkToken.sol file there is not corresponding version 0.8 or 0.6. There is only one version 0.4.11 and it gives me this issue while compile.

contracts/test/LinkToken.sol:3: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.4.11;
^----------------------^

Can someone please help me with this? thanks

N-NeelPatel avatar Apr 26 '22 08:04 N-NeelPatel

Also can someone please tell me the usecase of using mocks

N-NeelPatel avatar Apr 26 '22 17:04 N-NeelPatel

What are you running to compile?

Mocks are so that you can "mock" being a chainlink node or external actor. Chainlink nodes don't run on our local chains so we pretend to be one.

PatrickAlphaC avatar May 02 '22 15:05 PatrickAlphaC

I am compiling the Mocks files.

N-NeelPatel avatar May 09 '22 09:05 N-NeelPatel

@PatrickAlphaC any help would be appreciated. I am facing a similar issue. Following exactly like you show it in your tutorial (link to exact timestamp), I have the following error when I run brownie run scripts/deploy_lottery.py :

ImportError: cannot import name 'LinkToken' from 'brownie' (/opt/homebrew/lib/python3.9/site-packages/brownie/__init__.py)

. I see that after running a brownie compile the LinkToken does not get compiled and its JSON object is not present under build/contracts/test/ (that's why it can't be imported I suppose). . Should we play around with the version of Solidity or the version of the chainlink import in the LinkToken.sol? . Thanks for your help in advance! . P.S: I tried switching between compiler versions (latest/0.8.0/0.6.6), but same effect unfortunately...

teddy931130 avatar Aug 29 '22 17:08 teddy931130

UPDATE: @PatrickAlphaC Sorry about that, while copy-pasting, I had accidentally put some gibberish after the code for LinkToken.sol. When I fixed that, I am now getting the same error as @N-NeelPatel is. . It appears that the compiler version constraint in LinkToken.sol (^0.4.11) is the same as in both of its imports (@chainlink/contracts/src/v0.4/ERC677Token.sol + @chainlink/contracts/src/v0.4/vendor/StandardToken.sol) . Any ideas how to work around this? . If we search for a LinkToken mock in @chainlink/contracts/src/v0.6 it's missing. . What if we try to import the LinkToken.sol from here (in @chainlink/contracts/src/v0.4/LinkToken.sol)? Although we will still run into the compiler version issue... (if you try to compile with 0.4.11 brownie complains with IncompatibleSolcVersion: Brownie only supports Solidity versions >=0.4.22) . ¯\_(ツ)_/¯

teddy931130 avatar Aug 29 '22 17:08 teddy931130

I am having the same issue with the LinkToken.sol when running - I have tried updating compiler version in the yaml file but this is incompatible with the 0.4.11 version of the LinkToken.sol. Attempting to downgrade the compiler version leads to an 'immutable' error where immutable keyword was added in Solidity 0.6.5

LWN-10 avatar Feb 26 '23 07:02 LWN-10

I am currently experiencing the same "LinkToken version not compactible with brownie" problem. Was anyone able to find a solution in the end?

niy42 avatar Nov 30 '23 08:11 niy42