I have a smart contract with the following import statements:
import "@prb/contracts/PRBMathSD59x18.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
How to I get Hard Hat to download these external contracts and import them when compiling?
I have tried changing the first line to:
import "@prb/math/contracts/PRBMathSD59x18.sol";
As suggested by this answer but without any success. It might be because I'm using scaffold-eth which recommends using $ yarn deploy
to build the contracts.
I tried installing them manually.
$ npm install @paulrberg/prb-math@2.5.0
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@paulrberg%2fprb-math - Not found
npm ERR! 404
npm ERR! 404 '@paulrberg/prb-math@2.5.0' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/developer/.npm/_logs/2022-10-09T22_29_12_712Z-debug-0.log
I haven't managed to find how to do this in the docs.
First of all in time im writing this the last version of prb
is 2.4.3
and not 2.5.0
so this is your problem.The version you try to install no exist.
So you have 3 dependencies so you need to install it, I recommend to execute this commands:
npm install prb-math
npm install @openzeppelin/contracts
npm install @chainlink/contracts
After installing, if your contract is correct, you will be able to compile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.