-
Notifications
You must be signed in to change notification settings - Fork 517
Bump @chainlink/contracts to v1.5.0 + Add remapping support #199
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
Bump @chainlink/contracts to v1.5.0 + Add remapping support #199
Conversation
The recent release of contracts@v1.5.0 unvendors a number of contracts. 1.5.0 utilizes remappings to resolve the import paths for these dependency packages. - Upgraded to @chainlink/contracts@v1.5.0 - Added helper js file to handle remappings using hardhat-preprocessor - Added remappings.txt that contains remappings - Updated hardhat.config.js to include remapping preprocessor
- Updated README to include remapping section, warning of third party plugin, and a link to the HH3 branch - Updated remappings.txt to specify the node_modules directory for each remapping. This is not required as hardhat 2 searched the node_modules directory for external libraries by default. However, including it allows developers to better understand exactly what is happeng (or where the remapping is going to).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Note: I've pushed a small commit on top of your branch to improve alerting for end users to the remapping concept.
Also minor comment on version pinning in package.json
Pinned @chainlink/contracts@v1.5.0
zeuslawyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
zeuslawyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This PR modernizes the Hardhat 2 starter kit to work with the unvendored layout in
@chainlink/contracts@1.5.0and documents a way to use Solidity import remappings in HH2 viahardhat-preprocessor.What changed
@chainlink/contractsto v1.5.0hardhat-preprocessorand a small helper to rewrite Solidity imports based on aremappings.txt. Wire it intohardhat.config.jsviapreprocess.contracts@1.5.0(e.g.,vrf/VRFCoordinatorV2_5.abi.json,shared/LinkToken.abi.json).hardhat-preprocessor, and a warning that it’s a third-party plugin.remappings.txtmore explicit by pointing each alias to itsnode_moduleslocation (clearer for newcomers even though HH2 already searchesnode_modules).remappings-helper.jsto explain how the loader and preprocessor hook work.Why
@chainlink/contracts@1.5.0un-vendors several packages and changes import locations; without remapping, HH2 users hit broken imports or long relative paths. Remapping keeps imports clean & resilient.