2021-10-09 18:50:43 +02:00
|
|
|
# standard imports
|
|
|
|
import logging
|
2021-10-09 19:56:29 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
# local imports
|
2022-03-01 09:17:17 +01:00
|
|
|
from cic.contract.components.proof import Proof
|
|
|
|
from cic.contract.components.meta import Meta
|
|
|
|
from cic.contract.components.attachment import Attachment
|
2022-03-01 09:31:22 +01:00
|
|
|
from cic.contract.network import Network
|
2022-03-01 09:17:17 +01:00
|
|
|
from cic.contract.components.token import Token
|
2021-10-10 14:49:22 +02:00
|
|
|
|
2021-10-09 18:50:43 +02:00
|
|
|
logg = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def process_args(argparser):
|
2022-03-01 09:31:22 +01:00
|
|
|
argparser.add_argument(
|
|
|
|
"--target",
|
|
|
|
action="append",
|
|
|
|
type=str,
|
|
|
|
default=[],
|
|
|
|
help="initialize network specification file with target",
|
|
|
|
)
|
|
|
|
argparser.add_argument("--name", type=str, help="token name")
|
|
|
|
argparser.add_argument("--symbol", type=str, help="token symbol")
|
|
|
|
argparser.add_argument("--precision", type=str, help="token unit precision")
|
|
|
|
argparser.add_argument("directory", help="directory to initialize")
|
2021-10-09 18:50:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
def validate_args(args):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def execute(config, eargs):
|
2022-03-01 09:31:22 +01:00
|
|
|
logg.info("initializing in {}".format(eargs.directory))
|
2021-12-05 08:12:36 +01:00
|
|
|
|
2021-10-09 19:56:29 +02:00
|
|
|
os.makedirs(eargs.directory)
|
|
|
|
|
2022-03-01 09:31:22 +01:00
|
|
|
ct = Token(
|
|
|
|
eargs.directory, name=eargs.name, symbol=eargs.symbol, precision=eargs.precision
|
|
|
|
)
|
2021-10-09 19:56:29 +02:00
|
|
|
cp = Proof(eargs.directory)
|
|
|
|
cm = Meta(eargs.directory)
|
|
|
|
ca = Attachment(eargs.directory)
|
2021-10-09 21:45:07 +02:00
|
|
|
cn = Network(eargs.directory, targets=eargs.target)
|
2021-10-09 19:56:29 +02:00
|
|
|
|
2021-10-10 14:49:22 +02:00
|
|
|
ct.start()
|
2021-10-09 19:56:29 +02:00
|
|
|
cp.start()
|
|
|
|
cm.start()
|
|
|
|
ca.start()
|
2021-10-09 20:37:54 +02:00
|
|
|
cn.start()
|