PatrickAlphaC / smartcontract-lottery

MIT License
79 stars 113 forks source link

version issue in LinkToken.sol file #64

Open N-NeelPatel opened 2 years ago

N-NeelPatel commented 2 years ago

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 commented 2 years ago

Also can someone please tell me the usecase of using mocks

PatrickAlphaC commented 2 years ago

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.

N-NeelPatel commented 2 years ago

I am compiling the Mocks files.

teddy931130 commented 2 years ago

@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 commented 2 years ago

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) . ¯\_(ツ)_/¯

LWN-10 commented 1 year ago

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

niy42 commented 11 months ago

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