-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't rename interfaces IWhatever -> IWhateverUpgradeable #3928
Comments
Related to this issue, OpenZeppelin/openzeppelin-upgrades#455, it's impossible to switch from SafeERC20 to using SafeERC20Upgradeable unless you change your variables from Changing this issue with the names of the interfaces will make contracts-upgradeable much more usable. |
Thanks for reaching out about this. We're not going to make this breaking change in the near future but we'll consider it for the next major release. |
There are no updates yet beyond my last comment but I want to provide some more context for why this was done this way initially. Ideally this package ( The only possible alternative to avoid all the mess I just described is to use npm peer dependencies. Until npm v7 these were not great because they were not installed automatically, so they resulted in a poor user experience. Because we chose not to use dependencies, these interfaces need to be defined within the package, and we decided to apply the same rename (*Upgradeable) in order to avoid conflicts with the non-renamed versions in case they were used side by side. Now that peer dependencies have better usability, I think the next version of this package will declare OpenZeppelin Contracts as a peer dependency and import the interfaces from there. |
This needs a few changes in the transpiler to get fixed. See OpenZeppelin/openzeppelin-transpiler#108. |
Also reported some time ago in https://forum.openzeppelin.com/t/why-contracts-upgradeable-has-ierc721upgradeable-and-i-whatever-upgradeable/14793
💻 Environment
openzeppelin-contracts == 4.3.2
openzeppelin-contracts-upgradeable == 4.3.2
📝 Details
The package openzeppelin-contracts-upgradeable renames the interfaces when they are exactly the same as non-upgradeable (vanilla) versions. This isn't necessary and brings a lot of issues like this one
🔢 Code to reproduce bug
Then when I compile I get errors like these:
I think XXXUpgradeable contracts shouldn't define new interfaces but instead implement the standard ones. Interfaces are the same between upgradeable and non-upgradeable contracts.
If name clashes are an issue when importing files from
contracts
andcontracts-upgradeable
, those can be easily avoided using explicit importsThe text was updated successfully, but these errors were encountered: