Only version 0.8.7 in Remix IDE Solidity Compiler - ethereum

Only version 0.8.7 in Remix IDE Solidity Compiler.
How do I choose the 0.5.15 version of the compiler?

Related

Run Mythril tool on a Hardhat Project?

How to run the Mythril tool for analysis on smart contracts compiled by Hardhat?
Hardhat project has the contract(.sol) and artifacts(.json) files .
Mythril when run with a (.sol) contract uses solc-compiler to compile the contract, whereas solc-compiler does not work for me, and I want to use hardhat to compile and later Mythril to analyze it.
Research-Based

Error in plugin #nomiclabs/hardhat-etherscan: Error! Missing Or invalid Module name

I tried to verify my contract with constructor arguments but hardhat throwing that error everytime
npx hardhat verify --network rinkeby 0x50a45120252c2FeeD06915F46D8Fbabec1a008df "TestSmartContract" "TSC" "my_ipfs_link1" "my_ipfs_link2"
these arguments is same as my contract's arguments
Downgrade the plugin version to 3.0.1 like this solves the issue:
npm i -s #nomiclabs/hardhat-etherscan#3.0.1
The issue seems to occur with the 3.0.2 version of #nomiclabs/hardhat-etherscan, it is fixed in the latest version 3.0.3. Please upgrade to the latest version (3.0.3) to fix it or use 3.0.1.

Which version of safeMath to import from openZeppelin contracts on github.com?

There are more than one version of safeMath on openZeppelin. On master branch, the URL is:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol
Besides master branch, there are quite a few other version available. Here is version 3.0.0:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.0.0/contracts/math/SafeMath.sol
If someone wants to use the safeMath in her/his smart contact development, which version shall be imported? Shall import master branch at any time?
master branch:
pragma "^0.7.0"
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol"
contract myContract() {
//do something
}
It depends on the solidity version you are using in your main contract. For contract using versions >=0.8.0 the use of safeMath read this.
For contract written in older version (say) 0.6.0 the use of the latest safeMath library written for version 0.8.0 will not be compatible.
In conclusion, try using the version of safeMath that is the same with the version of your main contract.

how do i solve this truffle compile error?

The following error is shown when using compiling with truffle:
Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.23;
^----------------------^
SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.5.4;
^---------------------^
Compilation failed. See above.
Truffle v5.0.4 (core: 5.0.4)
Node v8.12.0
The truffle that you have installed doesnot support solidity compiler 0.5.4, you may either try solving it by using compiler of 0.4.23 or higher as pragma solidity >=0.4.23 or upgrade the compiler that your truffle supports which is mentioned in this link
You should declare solidity compiler version in truffle.js file.
compilers: {
solc: {
version: '^0.4.23'
}
}
Some things you can do,
Open the file in VS Code . Right click on .sol file and click "solidity:download compiler". Then select the version that matches the version of solidity used in your contract (i.e written at top of the .sol file ). Then right click again on the .sol file and choose "solidity : Change the default workspace compiler to remote, local,...".From that choose "localNodeModule"
Right click again on the .sol file and choose "solidity : Change the default workspace compiler to remote, local,...".From that choose "remote"
Go to VS Code>File>preferences>settings
there under left panel, u'll find extensions and in it u'll find solidity preferences. There choose remote.
With that the file will start using the mentioned version

Mixing v0.4.x contracts and v0.5.x contracts in Truffle possible?

Is it possible to deploy contracts with truffle that do not all follow the same pragma?
I'm trying to deploy a solidity 0.4.10 contract alongside a solidity 0.5.0 contract in one truffle project. I defined my solc as 0.5.0 in truffle.js.
With the breaking changes in Solidity v0.5.0 this is not possible since you are utilizing the v0.5.0 compiler with Truffle. You should consider upgrading your old contract to utilize the latest pragma and follow the latest syntax.
If you have an old contract that you need to interface with, you can utilize the interoperability pragma.