def __init__(self, name, source_code, init_bytecode, runtime_bytecode, srcmap, srcmap_runtime, hashes, abi, warnings):
self.name = name<EOL>if isinstance(source_code, bytes):<EOL><INDENT>source_code = source_code.decode()<EOL><DEDENT>self.source_code = source_code<EOL>self._init_bytecode = init_bytecode<EOL>self._runtime_bytecode = runtime_bytecode<EOL>self._function_signatures_by_selector = {bytes.fromhex(sel): sig for sig, sel in hashes.items()}<EOL>fallback_selector = b'<STR_LIT>'<EOL>while fallback_selector in self._function_signatures_by_selector:<EOL><INDENT>fallback_selector = (int.from_bytes(fallback_selector, '<STR_LIT>') + <NUM_LIT:1>).to_bytes(<NUM_LIT:4>, '<STR_LIT>')<EOL><DEDENT>self._fallback_function_selector = fallback_selector<EOL>self._constructor_abi_item = None<EOL>self._fallback_function_abi_item = None<EOL>function_items = {}<EOL>event_items = {}<EOL>for item in abi:<EOL><INDENT>type = item['<STR_LIT:type>']<EOL>if type == '<STR_LIT>':<EOL><INDENT>signature = self.function_signature_for_name_and_inputs(item['<STR_LIT:name>'], item['<STR_LIT>'])<EOL>function_items[signature] = item<EOL><DEDENT>elif type == '<STR_LIT>':<EOL><INDENT>signature = self.function_signature_for_name_and_inputs(item['<STR_LIT:name>'], item['<STR_LIT>'])<EOL>event_items[signature] = item<EOL><DEDENT>elif type == '<STR_LIT>':<EOL><INDENT>assert not self._constructor_abi_item, "<STR_LIT>"<EOL>self._constructor_abi_item = item<EOL><DEDENT>elif type == '<STR_LIT>':<EOL><INDENT>assert not self._fallback_function_abi_item, "<STR_LIT>"<EOL>self._fallback_function_abi_item = item<EOL><DEDENT><DEDENT>self._function_abi_items_by_signature = function_items<EOL>self._event_abi_items_by_signature = event_items<EOL>self.warnings = warnings<EOL>self.srcmap_runtime = self.__build_source_map(self.runtime_bytecode, srcmap_runtime)<EOL>self.srcmap = self.__build_source_map(self.init_bytecode, srcmap)<EOL>
Contract metadata for Solidity-based contracts