How problematic is to use different version contracts?

Let's say Im using v4.4.1 on all my smart contracts. Its working well. All of a sudden I want to use a feature of only one smart contract that starts on v4.6.0. If I upgrade all my contracts then there are some contracts that apparently have a counterpart in new version that conflicts with the rest.

DeclarationError: Identifier already declared.
--> contracts/MyContract.sol:18:1:
|
18 | import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/proxy/ERC1967/ERC1967Proxy.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
--> https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.4.1/contracts/utils/Address.sol:9:1:
|
9 | library Address {
| ^ (Relevant source part starts here and spans across multiple lines).

However, if I use my previous version of ERC1967Proxy along with the new version in the rest of my contracts it compiles well. What are the implications of this approach?

Hello @nicolas.guasca

If you want to benefit from features in v4.6, you should just replace v4.4.1 with v4.6. We take great care about backward compatibility, so the transition should be seamless. Fell free to check the changelog to see what might have changed.

1 Like

using two different versions in the same project is strongly discouraged.

One obvious problem happens in the verification process. A flattened contract can only have one version. Mixing versions in one contract causes a failure in this process.

It was indeed a wrong import with previous version. Thank you so much for your support!

What happens when you have a crowdsale of an v4.x token? is it ok to still keep using v2.5 contracts with v4.x tokens? Also how do I mint them from contract if contracts are different?

Help