|
|
|
@ -125,15 +125,7 @@ class Flattening: |
|
|
|
|
exported.add(contract.name) |
|
|
|
|
list_contract.append(self._source_codes[contract]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def export(self, target=None): |
|
|
|
|
|
|
|
|
|
if not self.DEFAULT_EXPORT_PATH.exists(): |
|
|
|
|
self.DEFAULT_EXPORT_PATH.mkdir(parents=True) |
|
|
|
|
|
|
|
|
|
if target is None: |
|
|
|
|
for contract in self._slither.contracts_derived: |
|
|
|
|
ret = [] |
|
|
|
|
def _export(self, contract, ret): |
|
|
|
|
self._export_contract(contract, set(), ret) |
|
|
|
|
path = Path(self.DEFAULT_EXPORT_PATH, f'{contract.name}.sol') |
|
|
|
|
logger.info(f'Export {path}') |
|
|
|
@ -144,3 +136,20 @@ class Flattening: |
|
|
|
|
f.write('pragma experimental ABIEncoderV2;\n') |
|
|
|
|
f.write('\n'.join(ret)) |
|
|
|
|
f.write('\n') |
|
|
|
|
|
|
|
|
|
def export(self, target=None): |
|
|
|
|
|
|
|
|
|
if not self.DEFAULT_EXPORT_PATH.exists(): |
|
|
|
|
self.DEFAULT_EXPORT_PATH.mkdir(parents=True) |
|
|
|
|
|
|
|
|
|
ret = [] |
|
|
|
|
if target is None: |
|
|
|
|
for contract in self._slither.contracts_derived: |
|
|
|
|
self._export(contract, ret) |
|
|
|
|
else: |
|
|
|
|
contract = self._slither.get_contract_from_name(target) |
|
|
|
|
if contract is None: |
|
|
|
|
logger.error(f'{target} not found') |
|
|
|
|
else: |
|
|
|
|
self._export(contract, ret) |
|
|
|
|
|
|
|
|
|