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: Commented Apr 1, 2020 at 9:11
  • https://github.com/OpenZeppelin/openzeppelin-contracts/blob Commented Apr 1, 2020 at 9:11
  • To this: openzeppelin-contracts/tree Commented Apr 1, 2020 at 9:11
  • For sure you need to get rid of the https://github.com/ prefix. Commented Apr 1, 2020 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
    Commented Apr 1, 2020 at 9:25

1 Answer 1

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
    Commented Apr 2, 2020 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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