Solidity ERC-20 – Fixing Compilation Error with OpenZeppelin

erc-20solidity

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.

Best Answer

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

Related Topic