コード例 #1
0
ファイル: test_payout.py プロジェクト: Quiark/Roboth.web3
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
コード例 #2
0
ファイル: contract.py プロジェクト: Quiark/Roboth.web3
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)
コード例 #3
0
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
コード例 #4
0
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)
コード例 #5
0
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
コード例 #6
0
ファイル: contract.py プロジェクト: Quiark/Roboth.web3
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
コード例 #7
0
ファイル: contract.py プロジェクト: Quiark/Roboth.web3
	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
コード例 #8
0
 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
コード例 #9
0
ファイル: store.py プロジェクト: iamyu/Roboth.web3
	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)