0

This would be an old issue, but the solutions I have seen on this site aren't working. I'm trying to import a contract of OpenZeppelin to my Remix IDE.

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/token/ERC721/ERC721Full.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/drafts/Counters.sol";

And it gives me an error:

Unable to import "undefined": TypeError: Failed to fetch

enter image description here

7
  • I believe that you need to change this: – goodvibration Apr 1 '20 at 9:11
  • https://github.com/OpenZeppelin/openzeppelin-contracts/blob – goodvibration Apr 1 '20 at 9:11
  • To this: openzeppelin-contracts/tree – goodvibration Apr 1 '20 at 9:11
  • For sure you need to get rid of the https://github.com/ prefix. – goodvibration Apr 1 '20 at 9:12
  • @goodvibration: I'm sorry, not in that sense :) just need to know that you are suggesting in this way? import "openzeppelin-contracts/tree/contracts/token/ERC721/ERC721Full.sol"; – Div Apr 1 '20 at 9:25
1

To import from a tag or branch use /blob/<tag>

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.4.0/contracts/math/SafeMath.sol";

It is not mentioned explicitly in the documentation https://remix-ide.readthedocs.io/en/latest/import.html but it works.

1
  • Thanks! the issue is weird, it is working fine as shown in the question, previously it was showing an error. – Div Apr 2 '20 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.