def find_sol(job_user, job_id, author, text): usrdat = cobj.m_userdata.call(job_user) for i in range(usrdat[1]): sol = cobj.getSolution.call((job_user), i) ovlg().data(sol, job_user=job_user, job_id=job_id, author=author, text=text) if (mycon.no0_suffix(sol[0]) == mycon.addr_noprefix(author)) and (sol[1] == job_id) and (mycon.no0_suffix(sol[2]) == text): return i
def compile(): compiled = compile_internal(open(MainStore.in_root('app/sol/{}.sol'.format(ConName)))) ovlg().data('heres the compiled stuff', compiled) code = compiled[ConName]['code'] abi = abi_to_ascii(compiled[ConName]['info']['abiDefinition']) ovlg().data(code, abi) print '---- ABI ---- %< ----' print json.dumps(abi, indent=None) return ContractInfo(abi=abi, code=code, name=ConName)
def find_sol(job_user, job_id, author, text): usrdat = cobj.m_userdata.call(job_user) for i in range(usrdat[1]): sol = cobj.getSolution.call((job_user), i) ovlg().data(sol, job_user=job_user, job_id=job_id, author=author, text=text) if (mycon.no0_suffix(sol[0]) == mycon.addr_noprefix(author)) and ( sol[1] == job_id) and (mycon.no0_suffix(sol[2]) == text): return i
def compile(): compiled = compile_internal( open(MainStore.in_root('app/sol/{}.sol'.format(ConName)))) ovlg().data('heres the compiled stuff', compiled) code = compiled[ConName]['code'] abi = abi_to_ascii(compiled[ConName]['info']['abiDefinition']) ovlg().data(code, abi) print '---- ABI ---- %< ----' print json.dumps(abi, indent=None) return ContractInfo(abi=abi, code=code, name=ConName)
def deploy(ci): # actual deployment res = eth.sendTransaction(data=ci.code, from_=prim_acc, gas=1800000) tx = eth.poll(eth.getTransactionReceipt, [res]) ovlg().data(tx=tx) ci.addr = addr_noprefix(tx['contractAddress']) # ok now deployed, save it ci.register_with_store(MainStore) print '---- ADDR ---- %< ----' print ci.addr register(ConName, ci.addr) print 'Registered as ', ConName, ' deployed from', prim_acc return ci
def deploy(ci): # actual deployment res = eth.sendTransaction(data=ci.code, from_=prim_acc, gas=1800000) tx = eth.poll(eth.getTransactionReceipt, [res]) ovlg().data( tx=tx ) ci.addr = addr_noprefix(tx['contractAddress']) # ok now deployed, save it ci.register_with_store(MainStore) print '---- ADDR ---- %< ----' print ci.addr register(ConName, ci.addr) print 'Registered as ', ConName, ' deployed from', prim_acc return ci
def _call(self, method, params=None, _id=0): if params is None: params = [] data = json.dumps({ 'jsonrpc': '2.0', 'method': method, 'params': params, 'id': _id }) response = None ovlg().data('RPC _call', method=method, params=params, data=data) try: response = requests.post("http://{}:{}".format(self.host, self.port), data=data).json() return response['result'] except: ovlocal() print response raise
def _call(self, method, params=None, _id=0): if params is None: params = [] data = json.dumps({ 'jsonrpc': '2.0', 'method': method, 'params': params, 'id': _id }) response = None ovlg().data('RPC _call', method=method, params=params, data=data) try: response = requests.post("http://{}:{}".format( self.host, self.port), data=data).json() return response['result'] except: ovlocal() print response raise
def load(self): if not os.path.exists(self.path): return with open(self.path, 'rb') as inf: self.data = cPickle.load(inf) self.data['contracts'] = list(self.data['contracts']) ovlg().data(self.data)