eth-owned

EIP-173 interface and tools for chainlib-eth
git clone git://holbrook.no/eth-owned.git
Log | Files | Refs

void.py (1406B)


      1 # standard imports
      2 import logging
      3 import json
      4 import os
      5 
      6 # external imports
      7 from chainlib.eth.tx import (
      8         TxFactory,
      9         TxFormat,
     10         )
     11 from chainlib.eth.contract import (
     12         ABIContractEncoder,
     13         ABIContractDecoder,
     14         ABIContractType,
     15         abi_decode_single,
     16         )
     17 from chainlib.eth.constant import ZERO_ADDRESS
     18 from chainlib.eth.error import RequestMismatchException
     19 from hexathon import (
     20         add_0x,
     21         strip_0x,
     22         )
     23 
     24 logg = logging.getLogger()
     25 
     26 moddir = os.path.dirname(__file__)
     27 datadir = os.path.join(moddir, 'data')
     28 
     29 
     30 class VoidOwner(TxFactory):
     31 
     32     __abi = None
     33     __bytecode = None
     34 
     35     @staticmethod
     36     def abi():
     37         if VoidOwner.__abi == None:
     38             f = open(os.path.join(datadir, 'VoidOwner.json'), 'r')
     39             VoidOwner.__abi = json.load(f)
     40             f.close()
     41         return VoidOwner.__abi
     42 
     43 
     44     @staticmethod
     45     def bytecode():
     46         if VoidOwner.__bytecode == None:
     47             f = open(os.path.join(datadir, 'VoidOwner.bin'))
     48             VoidOwner.__bytecode = f.read()
     49             f.close()
     50         return VoidOwner.__bytecode
     51 
     52 
     53     @staticmethod
     54     def gas(code=None):
     55         return 500000
     56 
     57 
     58     def constructor(self, sender_address):
     59         code = VoidOwner.bytecode()
     60         tx = self.template(sender_address, None, use_nonce=True)
     61         tx = self.set_code(tx, code)
     62         return self.build(tx)