mirror of https://github.com/nucypher/nucypher.git
Slightly more informative and comfortable deployment of contracts
parent
9ac51f1abd
commit
f9336f267a
|
@ -269,7 +269,8 @@ class DeployerActor(NucypherTokenActor):
|
||||||
return user_escrow_deployer
|
return user_escrow_deployer
|
||||||
|
|
||||||
def deploy_network_contracts(self,
|
def deploy_network_contracts(self,
|
||||||
secrets: dict, interactive: bool = True,
|
secrets: dict,
|
||||||
|
interactive: bool = True,
|
||||||
emitter: StdoutEmitter = None) -> dict:
|
emitter: StdoutEmitter = None) -> dict:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -286,6 +287,9 @@ class DeployerActor(NucypherTokenActor):
|
||||||
gas_limit = None # TODO: Gas management
|
gas_limit = None # TODO: Gas management
|
||||||
|
|
||||||
# NuCypherToken
|
# NuCypherToken
|
||||||
|
if emitter:
|
||||||
|
emitter.echo(f"\nDeploying {NUCYPHER_TOKEN_CONTRACT_NAME} ...")
|
||||||
|
|
||||||
token_receipts, token_deployer = self.deploy_contract(contract_name=NUCYPHER_TOKEN_CONTRACT_NAME,
|
token_receipts, token_deployer = self.deploy_contract(contract_name=NUCYPHER_TOKEN_CONTRACT_NAME,
|
||||||
gas_limit=gas_limit)
|
gas_limit=gas_limit)
|
||||||
|
|
||||||
|
@ -296,10 +300,14 @@ class DeployerActor(NucypherTokenActor):
|
||||||
emitter=emitter)
|
emitter=emitter)
|
||||||
|
|
||||||
deployment_receipts[NUCYPHER_TOKEN_CONTRACT_NAME] = token_receipts
|
deployment_receipts[NUCYPHER_TOKEN_CONTRACT_NAME] = token_receipts
|
||||||
|
|
||||||
|
for contract_deployer in self.upgradeable_deployer_classes:
|
||||||
if interactive:
|
if interactive:
|
||||||
click.pause(info="Press any key to continue")
|
click.pause(info="Press any key to continue")
|
||||||
|
|
||||||
for contract_deployer in self.upgradeable_deployer_classes:
|
if emitter:
|
||||||
|
emitter.echo(f"\nDeploying {contract_deployer.contract_name} ...")
|
||||||
|
|
||||||
receipts, deployer = self.deploy_contract(contract_name=contract_deployer.contract_name,
|
receipts, deployer = self.deploy_contract(contract_name=contract_deployer.contract_name,
|
||||||
plaintext_secret=secrets[contract_deployer.contract_name],
|
plaintext_secret=secrets[contract_deployer.contract_name],
|
||||||
gas_limit=gas_limit)
|
gas_limit=gas_limit)
|
||||||
|
@ -310,8 +318,6 @@ class DeployerActor(NucypherTokenActor):
|
||||||
contract_address=deployer.contract_address,
|
contract_address=deployer.contract_address,
|
||||||
emitter=emitter)
|
emitter=emitter)
|
||||||
deployment_receipts[contract_deployer.contract_name] = receipts
|
deployment_receipts[contract_deployer.contract_name] = receipts
|
||||||
if interactive:
|
|
||||||
click.pause(info="Press any key to continue")
|
|
||||||
|
|
||||||
return deployment_receipts
|
return deployment_receipts
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,9 @@ def deploy(action,
|
||||||
|
|
||||||
# Verify Address & collect password
|
# Verify Address & collect password
|
||||||
if not deployer_address:
|
if not deployer_address:
|
||||||
deployer_address = select_client_account(emitter=emitter, blockchain=blockchain)
|
prompt = "Select deployer account"
|
||||||
|
deployer_address = select_client_account(emitter=emitter, blockchain=blockchain, prompt=prompt)
|
||||||
|
|
||||||
if not force:
|
if not force:
|
||||||
click.confirm("Selected {} - Continue?".format(deployer_address), abort=True)
|
click.confirm("Selected {} - Continue?".format(deployer_address), abort=True)
|
||||||
|
|
||||||
|
@ -166,6 +168,8 @@ def deploy(action,
|
||||||
return # Exit
|
return # Exit
|
||||||
|
|
||||||
elif action == 'rollback':
|
elif action == 'rollback':
|
||||||
|
if not contract_name:
|
||||||
|
raise click.BadArgumentUsage(message="--contract-name is required when using --rollback")
|
||||||
existing_secret = click.prompt('Enter existing contract upgrade secret', hide_input=True)
|
existing_secret = click.prompt('Enter existing contract upgrade secret', hide_input=True)
|
||||||
new_secret = click.prompt('Enter new contract upgrade secret', hide_input=True, confirmation_prompt=True)
|
new_secret = click.prompt('Enter new contract upgrade secret', hide_input=True, confirmation_prompt=True)
|
||||||
DEPLOYER.rollback_contract(contract_name=contract_name,
|
DEPLOYER.rollback_contract(contract_name=contract_name,
|
||||||
|
|
|
@ -337,4 +337,3 @@ def paint_deployment_delay(emitter, delay: int = 3) -> None:
|
||||||
for i in range(delay)[::-1]:
|
for i in range(delay)[::-1]:
|
||||||
emitter.echo(f"{i}...", color='yellow')
|
emitter.echo(f"{i}...", color='yellow')
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
emitter.echo(f"Deploying...", bold=True)
|
|
||||||
|
|
Loading…
Reference in New Issue