Skip to content

Commit

Permalink
Add --from option to vm.py, to generate Vm.sol from a local json file
Browse files Browse the repository at this point in the history
  • Loading branch information
Tudmotu committed Oct 4, 2024
1 parent 4e5f46a commit ae19ced
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/vm.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env python3

import argparse
import copy
import json
import re
import subprocess
from enum import Enum as PyEnum
from pathlib import Path
from typing import Callable
from urllib import request

Expand All @@ -26,7 +28,16 @@


def main():
json_str = request.urlopen(CHEATCODES_JSON_URL).read().decode("utf-8")
parser = argparse.ArgumentParser(
description="This script generates the Vm interface based on the cheatcodes json generated in Foundry")
parser.add_argument(
"--from",
metavar="PATH",
dest="path",
required=False,
help="path to a json file containing the Vm interface, as generated by Foundry")
args = parser.parse_args()
json_str = Path(args.path).read_text() if args.path is not None else request.urlopen(CHEATCODES_JSON_URL).read().decode("utf-8")
contract = Cheatcodes.from_json(json_str)

ccs = contract.cheatcodes
Expand Down

0 comments on commit ae19ced

Please sign in to comment.