-
Notifications
You must be signed in to change notification settings - Fork 182
Description
Overview
In the programmatic API, the print function creates a contract with imports that are not versioned. For the reasons described in #692 (comment), these should remain unversioned, but callers such as Remix should add remappings to pin dependencies to specific versions.
Enhancement Request
Provide function(s) in the API that when given specific contract options, returns remappings that map unversioned import prefixes to versioned import prefixes.
For example, the interface may look something like:
getVersionedRemappings: (opts?: Options) => string[];
When opts.upgradeable is falsy, this should return a string array with one element, e.g.:
[
"@openzeppelin/contracts/=@openzeppelin/[email protected]/"
]
When opts.upgradeable is truthy, this should return a string array with two elements (for both non-upgradeable and upgradeable libraries), e.g.:
[
"@openzeppelin/contracts/=@openzeppelin/[email protected]/",
"@openzeppelin/contracts-upgradeable/=@openzeppelin/[email protected]/"
]
Callers such as Remix should append these elements as lines in remappings.txt. End users can update the versions in that file if they want their code to use newer versions of OpenZeppelin Contracts, when new versions are available.