I don't run an Ethereum framework like Truffle and I want to deploy a smart contract using infura node.
The smart contract is very simple:
pragma solidity ^0.5.2;
import "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";
/**
* @title ACoin is basic ERC20 Token
*/
contract ACoin is ERC20, ERC20Detailed, Ownable{
uint256 public initialSupply = 100000000000;
/**
* @dev assign totalSupply to account creating this contract
*/
constructor() public ERC20Detailed("ACoin", "ACO", 7) {
_mint(msg.sender, initialSupply);
}
}
My compile script should be working fine:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const ACoinpath= path.resolve(__dirname, 'contracts', 'ACoin.sol');
const source = fs.readFileSync(ACoinpath, 'utf8');
console.log(solc.compile(source, 1).errors);
module.exports = solc.compile(source, 1).contracts[':ACoin'];
The issue is that solc " doesn't know what import means" and I'm getting this error:
[ ':3:1: ParserError: Source "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol" not found: File not supplied initially.\nimport "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";\r\n^--------------------------------------------------------------------------------------------^\n', ':4:1: ParserError: Source "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol" not found: File not supplied initially.\nimport "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol";\r\n^--------------------------------------------------------------------------------------------^\n', ':5:1: ParserError: Source "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol" not found: File not supplied initially.\nimport "http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";\r\n^----------------------------------------------------------------------------------------------------^\n' ]
I looked into OpenZeppelin repo where I'm told the solution to my problem. An npm install openzeppelin-solidity & import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol" later, the problem still persists:
[ ':3:1: ParserError: Source "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol" not found: File not supplied initially.\nimport "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";\r\n^-------------------------------------------------------------^\n',
Is there anything I can do without using Truffle?
Important to mention: the smart contract provided will work in Remix