OpenZeppelin/openzeppelin-contracts

Sharing contract versions in the same repo

adjisb opened this issue · 0 comments

  • We use a combination of OZ version 4 and 5 in the same repository because we have a set of different contracts in the same project.
  • To do that we have entries like the following: "@openzeppelin/contracts-upgradeable-5.0.2": "npm:@openzeppelin/contracts-upgradeable@5.0.2" in the package.json file.
  • Openzeppelin V5 upgradables expect a to have the regular contracts (non upgradables) in a fixed place.
  • When we try to compile we get: Error HH411: The library @openzeppelin/contracts, imported from @openzeppelin/contracts-upgradeable-5.0.2/token/ERC721/ERC721Upgradeable.sol, is not installed. Try installing it using npm.
  • This is because ERC721Upgradeable is importing: IERC721 from @openzeppelin/contracts/token/ERC721/IERC721.sol so it expects to have IERC721.sol inside the @openzeppelin/contracts directory.

It seems that having the regular version of the contracts as a implicit dependency of the upgradable ones is a bad idea or if this is the choose solution it sounds like a good idea to add the version to the directory (and also to the package.json dependencies).