Skip to content

Commit

Permalink
Allow publish to be specified during call to prepare_deployment. The …
Browse files Browse the repository at this point in the history
…kwargs can now be obtained from ApeDeploymentParameters (formerly DeploymentParameters)
  • Loading branch information
derekpierre committed Sep 20, 2023
1 parent ea252bf commit f35d14d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
18 changes: 7 additions & 11 deletions scripts/deploy_lynx.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ def main():
'Coordinator' deployed to: 0x4077ad1CFA834aEd68765dB0Cf3d14701a970a9a
"""

deployer, params = prepare_deployment(params_filepath=DEPLOYMENT_CONFIG_FILEPATH)
deployer, params = prepare_deployment(
params_filepath=DEPLOYMENT_CONFIG_FILEPATH, publish=PUBLISH
)

LynxRootApplication = deployer.deploy(
*params.get(project.LynxRootApplication, locals()),
publish=PUBLISH,
*params.get(project.LynxRootApplication, locals()), **params.get_kwargs()
)

LynxTACoChildApplication = deployer.deploy(
*params.get(project.LynxTACoChildApplication, locals()),
publish=PUBLISH,
*params.get(project.LynxTACoChildApplication, locals()), **params.get_kwargs()
)

LynxRootApplication.setChildApplication(
Expand All @@ -48,15 +48,11 @@ def main():
)

LynxRitualToken = deployer.deploy(
*params.get(project.LynxRitualToken, locals()),
publish=PUBLISH,
*params.get(project.LynxRitualToken, locals()), **params.get_kwargs()
)

# Lynx Coordinator
Coordinator = deployer.deploy(
*params.get(project.Coordinator, locals()),
publish=PUBLISH,
)
Coordinator = deployer.deploy(*params.get(project.Coordinator, locals()), **params.get_kwargs())

LynxTACoChildApplication.setCoordinator(Coordinator.address, sender=deployer)

Expand Down
14 changes: 10 additions & 4 deletions scripts/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
VARIABLE_PREFIX = "$"


def prepare_deployment(params_filepath: Path) -> typing.Tuple[AccountAPI, "DeploymentParameters"]:
def prepare_deployment(
params_filepath: Path, publish: bool
) -> typing.Tuple[AccountAPI, "ApeDeploymentParameters"]:
check_etherscan_plugin()
deployer = get_user_selected_account()

constructor_parameters = ConstructorParameters.from_file(params_filepath)
deployment_parameters = DeploymentParameters(constructor_parameters)
deployment_parameters = ApeDeploymentParameters(constructor_parameters, publish)

return deployer, deployment_parameters

Expand Down Expand Up @@ -96,9 +98,13 @@ def resolve(self, contract_name: str, context: typing.Dict[str, Any]) -> Ordered
return resolved_params


class DeploymentParameters:
def __init__(self, constructor_parameters: ConstructorParameters):
class ApeDeploymentParameters:
def __init__(self, constructor_parameters: ConstructorParameters, publish: bool):
self.constructor_parameters = constructor_parameters
self.publish = publish

def get_kwargs(self):
return {"publish": self.publish}

def get(self, *args, **kwargs):
return self.__resolve_deployment_parameters(*args, **kwargs)
Expand Down

0 comments on commit f35d14d

Please sign in to comment.