when import the IERC20.sol, sth wrong happened.
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/SafeERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
Unable to import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol": File not found
pls, how to deal with it.thx.
1 Like
Skyge
December 6, 2020, 3:03am
2
I think you should run
npm install @openzeppelin/contracts
to install the package to use.
1 Like
thx.
I'm using Remix. I installed but it didn't work.
1 Like
Skyge
December 6, 2020, 4:02am
4
If you use remix, I think it will be ok like what you said:
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/SafeERC20.sol 1”;
1 Like
this worked.but another problem occur:(.
Unable to import “undefined”: Not Found
1 Like
Skyge
December 6, 2020, 5:09am
6
If you run on the remix, this will be ok:
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/SafeERC20.sol 1”;
import “https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol 1”;
And if you run your code locally, such as:
import @openzeppelin/contracts/token/ERC20/SafeERC20.sol
you should install the package.
1 Like
yes, run on the remix, and cp ur code, but still:
Unable to import “undefined”: Not Found
1 Like
Hi @franklee00 ,
Welcome to the community
I suggest looking at the following examples which import OpenZeppelin Contracts via GitHub as @Skyge was showing you:
Hi @franklee00 ,
If you are still having issues, can you share your contract that you are attempting to deploy?
Note: You should only use code published in an official release of OpenZeppelin Contracts, the latest release is 3.3 . When importing via GitHub on Remix you can specify the release tag, (otherwise you will get the latest code in the master branch).
thx a lot.
It’s solved by importing the files in Remix directly.
1 Like
When you remove the licensing information from the contract, it fixes this imports error in Remix IDE as of Dec 2nd, at least in our particular case.
for me it was
import "@openzeppelin /contracts/token/ERC20/utils/SafeERC20.sol";
1 Like