2021-07-28 09:10:59 -07:00

50 lines
1.2 KiB
Python

from subprocess import check_call
import click
@click.command()
@click.option("-b", required=False, is_flag=True)
def start(b: str):
"""if d is present background compose"""
if b:
check_call(["docker", "compose", "up", "-d"])
click.echo("docker running in the background...")
else:
check_call(["docker", "compose", "up"])
def stop():
check_call(["docker", "compose", "down"])
def build():
check_call(["docker", "compose", "build"])
def attach():
check_call(["docker", "exec", "-it", "mev-inspect-py_mev-inspect_1", "bash"])
@click.command()
@click.option(
"-s", "--script", help="inspect script", default="./examples/uniswap_inspect.py"
)
@click.option("-b", "--block-num", help="block number to inspect", default="11931271")
@click.option("-r", "--rpc", help="rpc address", default="http://111.11.11.111:8545")
def inspect(script: str, block_num: str, rpc: str):
"""Runs mev-inspect scripts through docker services"""
check_call(
[
"docker",
"compose",
"exec",
"mev-inspect",
"python",
script,
"-block_number",
block_num,
"-rpc",
rpc,
]
)