0

I installed Openzeppelin framework and created a simple token sol file.

pragma solidity ^0.4.24;

import "node_modules/openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";

contract SToken is MintableToken {
    string public constant name = "SS Token";
    string public constant symbol = "SKS";
    uint8 public constant decimals = 2;
}

When I tried compiling i am getting following error.

node_modules/openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol:3:1: ParserError: Source "node_modules/openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol" not found: File import callback not supported import "./BasicToken.sol";

Any idea/thoughts what can be possible reason.

2

Most probably, you failed to install node modules properly. I tried using Remix online browser and could easily deploy your contract just changing from local node modules to point github repository of zeppelin.

pragma solidity ^0.4.4;

import "github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";

contract SToken is MintableToken {
    string public constant name = "SS Token";
    string public constant symbol = "SKS";
    uint8 public constant decimals = 2;
}

Deployment transaction : https://rinkeby.etherscan.io/tx/0xe31ee332fca077398f562558fc43e1ee02eb9ba909c3be533593fff61539e613

Contract address : https://rinkeby.etherscan.io/address/0xb60f82f7c0967a54cd937f28014ea1614f931782

  • Thanks Mehmet. Its working for me too using Remix. I had just run these commands : truffle init , npm init -y npm install -E openzeppelin-solidity Any idea if I missed anything – sumit Aug 14 '18 at 13:53
  • I have free time for now and tried to run your code on my local. Now I understand what you have missed because I faced the same issue. You place your contract under contracts folder. Therefore, you must also set relative path for node modules. It will be resolved, if you import zeppelin contract as follows: ``` import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol"; ``` – Mehmet Doğan Aug 14 '18 at 15:52

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.