1

I have a solidity project which uses contracts written in solidity version 0.8, and also includes several OpenZeppelin contracts (all using solidity version 0.8).

I need to deploy these contracts on an ethereum fork which only supports solidity version <0.5

  1. What is the correct way in which i can deploy these contracts on the blockchain fork?
  2. What issues will i face if i start upgrading all these contracts, downgrading them to solidity version 0.4 ? Is it feasible ?
2
  • Can you share more info about the fork? It's the EVM version that counts, not the Solidity compiler. Even in the latest version the compiler has never dropped support for an older EVM. You can still for example compile your contract using only instructions that were available on Homestead fork. See the --evm-version compiler parameter.
    – cameel
    Dec 23, 2021 at 12:35
  • As for downgrading to 0.4.0, it's feasible but probably not worth your time unless you absolutely have to. Have a look through the lists of breaking changes for each version: v0.5.0, v0.6.0, v0.7.0, v0.8.0. Especially the 0.5.0 -> 0.4.0 transition can be rough unless the contract is just small.
    – cameel
    Dec 23, 2021 at 12:39

1 Answer 1

0

Experienced this same issue for using solidity version that are newer than the ones in the openzeppelin contracts.

Hardhat has a setting for multiple compilers
however the value set in the openzeppelin contract is not overridden by that.

1. What is the correct way in which I can deploy these contracts on the blockchain fork?
-> This is a totally different question but you if you want to confirm whether its possible 
- yes if and only if all subcontracts use the same compiler version. 
i.e. probably older openzeppelin version or eliminate using that.  (not recommended)

2. What issues will I face if I start upgrading all these contracts
downgrading them to solidity version 0.4 ? Is it feasible ?
Would not recommend this approach as there have been significant changes since that version.

Seeing that you want to perform upgrades - my recommendation would be to update those solidity version 0.4 contracts syntax to match the required version that satisfies using openzeppelin-contracts-upgradeable.

Use the Hardhat Plugin to create a new project - set the contracts in there and start updating your smart contract to new solidity version standards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.