lib/eth/solidity.rb
def compile(contract)
      raise Errno::ENOENT, "Contract file not found: #{contract}" unless File.exist? contract
      command = "#{@compiler} --optimize --combined-json bin,abi #{contract}"
      output, error, status = Open3.capture3 command
      raise SystemCallError, "Unable to run solc compiler!" if status.exitstatus === 127
      raise CompilerError, error unless status.success?
      json = JSON.parse output
      result = {}
      json["contracts"].each do |key, value|
        _file, name = key.split ":"
        result[name] = {}
        result[name]["abi"] = value["abi"]
        result[name]["bin"] = value["bin"]
      end
      return result
    end
# Use the bound Solidity executable to compile the given contract.
#
# @param contract [String] path of the contract to compile.
# @return [Array] JSON containing the compiled contract and ABI for all contracts.
Use the bound Solidity executable to compile the given contract.
Use the bound Solidity executable to compile the given contract .
def compile(contract)
      raise Errno::ENOENT, "Contract file not found: #{contract}" unless File.exist? contract
      command = "#{@compiler} --optimize --combined-json bin,abi #{contract}"
      output, error, status = Open3.capture3 command
      raise SystemCallError, "Unable to run solc compiler!" if status.exitstatus === 127
      raise CompilerError, error unless status.success?
      json = JSON.parse output
      result = {}
      json["contracts"].each do |key, value|
        _file, name = key.split ":"
        result[name] = {}
        result[name]["abi"] = value["abi"]
        result[name]["bin"] = value["bin"]
      end
      return result
    end
def compile ( contract ) raise Errno :: ENOENT , "Contract file not found: #{contract}" unless File . exist? contract command = "#{@compiler} --optimize --combined-json bin,abi #{contract}" output , error , status = Open3 . capture3 command raise SystemCallError , "Unable to run solc compiler!" if status . exitstatus === 127 raise CompilerError , error unless status . success? json = JSON . parse output result = { } json [ "contracts" ] . each do | key , value | _file , name = key . split ":" result [ name ] = { } result [ name ] [ "abi" ] = value [ "abi" ] result [ name ] [ "bin" ] = value [ "bin" ] end return result end
Use the bound Solidity executable to compile the given contract.
Use the bound Solidity executable to compile the given contract .
JSON containing the compiled contract and ABI for all contracts.
JSON containing the compiled contract and ABI for all contracts .
Array
contract
path of the contract to compile.
path of the contract to compile .