|
|
@ -133,27 +133,33 @@ class SolidityContract(EVMContract): |
|
|
|
super().__init__(code, creation_code, name=name) |
|
|
|
super().__init__(code, creation_code, name=name) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def get_solc_indices(data: Dict) -> Dict: |
|
|
|
def get_sources(indices_data: Dict, source_data: Dict) -> None: |
|
|
|
""" |
|
|
|
""" |
|
|
|
Returns solc file indices |
|
|
|
Get source indices mapping |
|
|
|
""" |
|
|
|
""" |
|
|
|
indices = {} |
|
|
|
if "generatedSources" not in source_data: |
|
|
|
has_sources = True |
|
|
|
return |
|
|
|
for contract_data in data["contracts"].values(): |
|
|
|
sources = source_data["generatedSources"] |
|
|
|
for source_data in contract_data.values(): |
|
|
|
|
|
|
|
if "generatedSources" not in source_data["evm"]["deployedBytecode"]: |
|
|
|
|
|
|
|
has_sources = False |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
sources = source_data["evm"]["deployedBytecode"]["generatedSources"] |
|
|
|
|
|
|
|
for source in sources: |
|
|
|
for source in sources: |
|
|
|
full_contract_src_maps = SolidityContract.get_full_contract_src_maps( |
|
|
|
full_contract_src_maps = SolidityContract.get_full_contract_src_maps( |
|
|
|
source["ast"] |
|
|
|
source["ast"] |
|
|
|
) |
|
|
|
) |
|
|
|
indices[source["id"]] = SolidityFile( |
|
|
|
indices_data[source["id"]] = SolidityFile( |
|
|
|
source["name"], source["contents"], full_contract_src_maps |
|
|
|
source["name"], source["contents"], full_contract_src_maps |
|
|
|
) |
|
|
|
) |
|
|
|
if has_sources is False: |
|
|
|
|
|
|
|
break |
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def get_solc_indices(data: Dict) -> Dict: |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
Returns solc file indices |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
indices: Dict = {} |
|
|
|
|
|
|
|
for contract_data in data["contracts"].values(): |
|
|
|
|
|
|
|
for source_data in contract_data.values(): |
|
|
|
|
|
|
|
SolidityContract.get_sources(indices, source_data["evm"]["bytecode"]) |
|
|
|
|
|
|
|
SolidityContract.get_sources( |
|
|
|
|
|
|
|
indices, source_data["evm"]["deployedBytecode"] |
|
|
|
|
|
|
|
) |
|
|
|
for source in data["sources"].values(): |
|
|
|
for source in data["sources"].values(): |
|
|
|
full_contract_src_maps = SolidityContract.get_full_contract_src_maps( |
|
|
|
full_contract_src_maps = SolidityContract.get_full_contract_src_maps( |
|
|
|
source["ast"] |
|
|
|
source["ast"] |
|
|
|