def test_get_chain_definition(web3): block_0 = web3.eth.getBlock(0) chain_definition = get_chain_definition(web3) assert remove_0x_prefix(block_0['hash']) in chain_definition assert '0x' not in chain_definition _, _, anchor_block_hash = chain_definition.rpartition('/') anchor_block = web3.eth.getBlock(anchor_block_hash) assert anchor_block['hash'] == add_0x_prefix(anchor_block_hash)
def set_contract_address(self, instance_identifier, address): registrar_data = self.registrar_data chain_definition = get_chain_definition(self.chain.web3) set_nested_key( registrar_data, 'deployments.{0}.{1}'.format(chain_definition, instance_identifier), {address: {'timestamp': epoc_time_now()}}, ) with open(self.registrar_path, 'w') as registrar_file: json.dump( registrar_data, registrar_file, sort_keys=True, indent=2, separators=(',', ': '), )
def set_contract_address(self, instance_identifier, address): registrar_data = self.registrar_data chain_definition = get_chain_definition(self.chain.web3) set_nested_key( registrar_data, 'deployments.{0}.{1}'.format(chain_definition, instance_identifier), address, ) with open(self.registrar_path, 'w') as registrar_file: json.dump( registrar_data, registrar_file, sort_keys=True, indent=2, separators=(',', ': '), )