Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperski95 committed Aug 3, 2022
1 parent 575316d commit b2a9122
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions protostar/compiler/compiled_contract_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,25 @@ def save(self, output_dir: Path) -> None:
def save_compiled_contract(self, output_dir: Path) -> None:
self._create_output_dir(output_dir)
serialized_contract = self._contract.Schema().dump(self._contract)
self._save_as_json(data=serialized_contract, path=output_dir)
self._save_as_json(
data=serialized_contract, path=output_dir / f"{self._contract_name}.json"
)

def save_compiled_contract_abi(self, output_dir: Path) -> None:
if not self._contract.abi:
return
self._create_output_dir(output_dir)
self._save_as_json(data=self._contract.abi, path=output_dir)
self._save_as_json(
data=self._contract.abi, path=output_dir / f"{self._contract_name}_abi.json"
)

@staticmethod
def _create_output_dir(output_dir: Path):
output_dir.mkdir(parents=True, exist_ok=True)

@staticmethod
def _save_as_json(data: Any, path: Path):
assert path.suffix == ".json"
with open(
path,
mode="w",
Expand Down

0 comments on commit b2a9122

Please sign in to comment.