Пример #1
0
 def set_whitelist(self, address):
     print('==== record start ====')
     tx_hash = self._contract_inst.functions.SetWhitelist(address) \
                                            .transact({'from': self._w3.eth.accounts[0],
                                                       'gas': my_config.GAS_SPENT})
     wait_miner(self._w3, tx_hash)
     if check_transaction_meet_assert(self._w3, tx_hash):
         raise IOError('assert encounter..')
     print('==== record finish ====')
Пример #2
0
    def record(self, input_hash):
        print('==== record start ====')
        tx_hash = self._contract_inst.functions.Record(convert_to_bytes(input_hash)) \
                                               .transact({'from': self._w3.eth.accounts[0],
                                                          'gas': GAS_SPENT})

        wait_miner(self._w3, tx_hash)
        if check_transaction_meet_assert(self._w3, tx_hash):
            raise IOError('assert encounter..')
        print('==== record finish ====')
    def delete(self, key):
        print('==== deletestart ====')
        tx_hash = self._contract_inst.functions.Delete(str(key)) \
                                               .transact({'from': self._w3.eth.accounts[0],
                                                          'gas': my_config.GAS_SPENT})

        wait_miner(self._w3, tx_hash)
        if check_transaction_meet_assert(self._w3, tx_hash):
            raise IOError('assert encounter..')

        print('==== delete finish ====')
    def finalise(self, hash_sum):
        print('==== finalise start ====')
        hash_arg = convert_to_bytes(hash_sum)
        tx_hash = self._contract_inst.functions.Finalise(hash_arg) \
                                               .transact({'from': self._w3.eth.accounts[0],
                                                         'gas': my_config.GAS_SPENT})

        wait_miner(self._w3, tx_hash)
        if check_transaction_meet_assert(self._w3, tx_hash):
            raise IOError('assert encounter..')

        print('==== dfinalise finish ====')
Пример #5
0
    def set_multiple_register(self, name_dict):
        print('==== record start ====')
        tx_hashs = []
        for name, address in name_dict.items():
            tx_hash = self._contract_inst.functions.SetInst(name, address) \
                                                   .transact({'from': self._w3.eth.accounts[0],
                                                              'gas': my_config.GAS_SPENT})
            tx_hashs.append(tx_hash)

        wait_miner(self._w3, tx_hashs)
        if check_transaction_meet_assert(self._w3, tx_hashs):
            raise IOError('assert encounter..')
        print('==== record finish ====')