5

Assuming your using VS code and have the official solidity extension maintained by Juan Blanco (found here). The extension is official in the sense that it is the only extension recommended by ethereum.org. The extension provides a very easy way of toggling compilers: In any *.sol file, right click and press "change workspace compiler version (Remote)&...


3

I went through this error recently. This is happening because the compiler version configured on VS Code workspace is different from the version you want. To fix that just right click on the error and select the option Solidity: Change workspace compiler version (Remote) It will open a drop-down with the available versions and you just pick the 0.7.6. You ...


3

Generally, you should always only use the latest released version available, no prior version whatsoever. As far as I know, there has not been major exploits caused by a Solidity compiler error ever. Thus, the only non-subjective historic data point we have is that "any Solidity compiler version has always been safe." Personally I prefer the major ...


2

@Anurag's answer is correct. You just need to check your versions and please be advised that the version of some libraries in that course are outdated. One big example is 'web3'. The instructor will tell you to install a specific version but you must install the latest version using the command npm install --save web3 Apart from this, the truffle-hdwallet-...


2

Solidity had a historical issue with arithmetic overflows and underflows, that's why having SafeMath enabled was a necessity back in the day. SafeMath has been made obsolete starting from Solidity v0.8.0, as internal checking for arithmetic operations was added by default. I would suggest to always use the latest version of Solidity as possible.


2

You're getting this error because hardhat needs to be able to verify that the URL and accounts you're using for a network are valid for that network. In your specific case, your Private key isn't working. Two ways to fix: 1. Remove the networks you don't want In your hardhat.config.js you can comment out or remove the network that is erroring. Your error is ...


2

Your import statement should look like this: import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol"; You also need to use NPM or Yarn to download the Chainlink packages locally.


1

Found a solution: Solidity needs to be written with capital "S"


1

The view modifier documentation states that : Functions can be declared view in which case they promise not to modify the state. Additionally, the rules of assignment between storage and memory states : Assignments between storage and memory (or from calldata) always create an independent copy. So : function updateStruct(uint256 dummyParam) public ...


1

Visual Studio Code doesn't support fetching GitHub files natively, it is only the Remix's feature. If you want to import the files, you need to download them locally.


1

had to run source .env to enable the .env in Ubuntu 20.04 LTS


1

This is the placeholder sign used for libraries. Maybe you're not providing the correct libraries?  The evm replaces the substring between the $ symbols with the library address during compilation. If the libraries are not provided then the resulting bytecode still has the placeholders. (Credit for this answer goes to Viktor from Tenderly, thanks a lot!)


1

It's better to UNCHECK the Generate contract metadata. from the setting as @Akrramo mentioned otherwise if you UNCHECK the Auto compile then you have to compile the code every time you do some modifications.


1

I don't know why I made it so complicated in my head, but yeah, here is a more elegant version ! function findImports(path) { const importSourceCode = fs.readFileSync(`./${path}`); return { contents: `${importSourceCode}` } } If any one has a better answer, feel free to share ! But this one satisfy my small skills for now (it still ...


1

Here is the code that I wrote to compile files with import statements with solc@0.5.16. The script compile the files and put them into a build folder as a json file. Thanks for helping me making this ! "use-strict"; const path = require("path"); const solc = require("solc"); //don"t forget to install the right solc version ...


1

If you are importing other contracts, those too need to be supporting the same pragma solidity version you are using on your main contract. Another thing would be an issue with truffle, where the solc version you are using is not the same one that you are downloading when trying to run the compile command. this used to occur before but it might be the issue. ...


1

This is a known issue and there will be a bug fix soon. https://github.com/ethereum/solidity/issues/11522


1

The issue seems to be a bug in solcj, see here Using solcjs --bin ./filename.sol does not indicate the optimization flag, which then should be false but this is not the case. As described by @Kamil in the link above, this produces a code that is not equivalent to set optimize to false, neither to true. As a consequence the code produced is not optimized at ...


1

SafeMath is used to protect your contract against math errors, such as overflow (adding uint above the max uint, for instance). SafeMath will revert the transaction if bad math happens in a transaction. It may very slightly increase the gas used for the transaction, but the benefit of safety is generally worth it. SafeMath is no longer needed if you use ...


1

Probably, the closest you will get is to use --asm output from solc. With solc 0.8 you can get the intermediate Yul representation with --ir. The command solc -o build --asm --ir MetaCoin.sol should generate MetaCoin.evm and MetaCoin.yul files in build directory.


1

It is possible to use OpenZeppelin contracts' version 2.5, it was the latest to support solc 0.5.x: IERC20.sol.


1

This answer is about nightly builds in general and not specific to solidity. A nightly build, in general, is a build of a version, that is not finished yet. So there might be more bugs or missing features. It is basically a build of the current work in progress. It is called nightly build because it is common to automatically build them from the current ...


1

You error is not related to nightly builds. One of your files (SafeMath.sol) requires a compiler version (pragma solidity ^0.4.23) lower than the one you selected (0.8.3).


1

Bit of an awkward one. 0.7.4 is too high, given some of the contracts† are ^0.6.0 (and the ^ prevents using 0.7.x.) But you'll need at least 0.6.5 due to the use of the immutable keyword in one of the contracts. So really your choices are >=0.6.5 but < 0.7.0. (I've checked they work.) ( † The important point here being that there are multiple ...


1

The easiest way to utilize this project now (arguably) is to pull from docker as per the offical repo: docker pull remixproject/remix-ide:latest


1

I tried sooooooooo many things to fix this in Nov 2021 and this is finally what did it for me....btw, many thanks to Russo for his insight about Blanco's extension vs Beaugunderson's! While his quick fix didn't immediately fix, I was able to find the needle in the haystack, finally: Open VSCode On left side, open Extensions (Now here, check what Solidity ...


Only top voted, non community-wiki answers of a minimum length are eligible