I am new to ethereum block-chain. I created a ERC20 smart-contract with help of open-zeppelin framework. I used py-solc package for solidity compilation with python. I imported compile_files function form solc. And use the function to compile solidity files. I got error when I intelize solidity file to compile.
So, my source code of python files is:-
import json
from web3 import Web3, HTTPProvider,TestRPCProvider
from solc import compile_source, compile_files
from web3.contract import ConciseContract
#Intelize solidity files to compile
compiled_sol = compile_files(["/home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol"])
print(compiled_sol.keys())
# Compiled solidity code
contract_interface = compiled_sol['/home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol:DappToken']
# web3.py instance
w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:7545"))
# Instantiate and deploy contract
contract = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin'])
print(contract)
# Get transaction hash from deployed contract
tx_hash = contract.transact({'from': w3.eth.accounts[0]})
print(tx_hash)
Source Code of ERC20 Solidity file is:-
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol";
import "openzeppelin-solidity/contracts/token/ERC20/MintableToken.sol";
import "openzeppelin-solidity/contracts/token/ERC20/PausableToken.sol";
/**
* The contractName contract does this and that...
*/
contract DappToken is MintableToken,PausableToken,DetailedERC20 {
constructor(string _name, string _symbol, uint8 _decimals)
DetailedERC20(_name, _symbol, _decimals)
public
{
}
}
I got error like this:-
Traceback (most recent call last):
File "/home/anupam/Documents/workspace/DjangoProject/ico_application/users/common/ERC20.py", line 7, in <module>
compiled_sol = compile_files(["/home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol"])
File "/home/anupam/Documents/envs/py_eth/lib/python3.7/site-packages/solc/main.py", line 135, in compile_files
stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
File "/home/anupam/Documents/envs/py_eth/lib/python3.7/site-packages/solc/utils/string.py", line 85, in inner
return force_obj_to_text(fn(*args, **kwargs))
File "/home/anupam/Documents/envs/py_eth/lib/python3.7/site-packages/solc/wrapper.py", line 169, in solc_wrapper
stderr_data=stderrdata,
solc.exceptions.SolcError: An error occurred during execution
> command: `solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc /home/anupam/Documents/workspace/DjangoProject/ico_application/users/contracts/old_type_contracts/DappToken.sol`
> return code: `1`
> stderr:
> stdout:
Invalid option to --combined-json: clone-bin
Query 1:- Why this error came??
Quary 2:- Where I do mistakes in a code??
Please resolve my query as soon as.
solc
binary version?