Openzeppelin-contracts: Unable to import "github/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol": File not found

Created on 19 Jul 2019  ·  6Comments  ·  Source: OpenZeppelin/openzeppelin-contracts

🧐 Motivation
Yes, the problem is related to how the contract interacts with the remix ide

📝 Details

find a way to import the contracts into the chosen smart contract without issues

question

Most helpful comment

Note that you should only use code published in an official release, but Remix pulls from master directly. You can take a look at our Getting Started guide for information on how to setup a development environment.

All 6 comments

Hi @nsingh3905

You can import OpenZeppelin Contracts with Remix using the prefix https://github.com/OpenZeppelin

Using the example ERC20 contract from the OpenZeppelin documentation you can import OpenZeppelin as follows:

pragma solidity ^0.5.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.3.0/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.3.0/contracts/token/ERC20/ERC20Detailed.sol";

contract GLDToken is ERC20, ERC20Detailed {
    constructor(uint256 initialSupply) ERC20Detailed("Gold", "GLD", 18) public {
        _mint(msg.sender, initialSupply);
    }
}

Updated to specify version of contracts to import.

For support questions you can ask in the community forum: https://forum.zeppelin.solutions/

Note that you should only use code published in an official release, but Remix pulls from master directly. You can take a look at our Getting Started guide for information on how to setup a development environment.

Hi I've looked into this method and the transaction on the ethereum ropsten
testnet has failed due to exceeding the gas limit

On Fri, 19 Jul 2019 at 14:32, Nicolás Venturo notifications@github.com
wrote:

Note that you should only use code published in an official release, but
Remix pulls from master directly. You can take a look at our Getting
Started https://docs.openzeppelin.org/v2.3.0/get-started guide for
information on how to setup a development environment.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/OpenZeppelin/openzeppelin-solidity/issues/1824?email_source=notifications&email_token=AMVDMQ35MY6UMH432MA6KBTQAIXFVA5CNFSM4IFLNPD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2M2DRQ#issuecomment-513384902,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AMVDMQ3DAXV5RYF6XQQGAY3QAIXFVANCNFSM4IFLNPDQ
.

@nsingh3905
I was getting a gas estimation failed error message until I logged into MetaMask.
I updated my sample contract to specify versions of the contract to import. (Thanks @nventuro for the reminder).

For support questions you can ask in the community forum: https://forum.openzeppelin.com/

@nventuro

Note that you should only use code published in an official release, but Remix pulls from master directly. You can take a look at our Getting Started guide for information on how to setup a development environment.

When I click your recommending Getting Started guide, it shows Page Not Found, so maybe we should correct it to https://docs.openzeppelin.com/contracts/2.x/

You're correct @Skyge, thanks! I've updated the link in my original comment to https://docs.openzeppelin.com/contracts/2.x/.

I think we can close this now since the original issue has been resolved, and the forum is the preferred medium for support.

Was this page helpful?
0 / 5 - 0 ratings