Skip to content

Commit

Permalink
Utility functions for deployment scripting initilization functons and…
Browse files Browse the repository at this point in the history
… proxying
  • Loading branch information
KPrasch committed Sep 27, 2023
1 parent 2856a3b commit 6164188
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 31 deletions.
10 changes: 10 additions & 0 deletions deployment/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,13 @@ def deploy(self, container: ContractContainer) -> ContractInstance:
args, kwargs = self._get_args(container), self._get_kwargs()
instance = deployer_account.deploy(*args, **kwargs)
return instance

def transact(self, method, *args):
print(f"Transacting {method} with \n\t{args}")
result = method(*args, sender=self.get_account())
return result

@staticmethod
def proxy(contract: ContractContainer, proxy_contract: ContractInstance) -> ContractInstance:
print(f"Wrapping {contract} in proxy at {proxy_contract.address}.")
return contract.at(proxy_contract.address)
19 changes: 3 additions & 16 deletions scripts/lynx/deploy_child.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,11 @@ def main():
proxy_admin = deployer.deploy(OZ_DEPENDENCY.ProxyAdmin)
taco_implementation = deployer.deploy(project.LynxTACoChildApplication)
proxy = deployer.deploy(OZ_DEPENDENCY.TransparentUpgradeableProxy)

print("\nWrapping TACoChildApplication in proxy")
taco_child_application = project.TACoChildApplication.at(proxy.address)

print(f"\nSetting TACoChildApplication proxy ({taco_child_application.address})"
f" as child application on MockPolygonChild ({mock_polygon_child.address})")
mock_polygon_child.setChildApplication(
taco_child_application.address,
sender=deployer.get_account(),
)

taco_child_application = deployer.proxy(project.TACoChildApplication, proxy)
deployer.transact(mock_polygon_child.setChildApplication, taco_child_application.address)
ritual_token = deployer.deploy(project.LynxRitualToken)
coordinator = deployer.deploy(project.Coordinator)

print(f"\nInitializing TACoChildApplication proxy ({taco_child_application.address}) "
f"with Coordinator ({coordinator.address})")
taco_child_application.initialize(coordinator.address, sender=deployer.get_account())

deployer.transact(taco_child_application.initialize, coordinator.address)
global_allow_list = deployer.deploy(project.GlobalAllowList)

deployments = [
Expand Down
19 changes: 4 additions & 15 deletions scripts/lynx/deploy_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,11 @@ def main():
proxy_admin = deployer.deploy(OZ_DEPENDENCY.ProxyAdmin)
_ = deployer.deploy(project.TACoApplication)
proxy = deployer.deploy(OZ_DEPENDENCY.TransparentUpgradeableProxy)

print("\nWrapping TACoApplication in proxy")
taco_application = project.TACoApplication.at(proxy.address)

print(f"\nSetting TACoApplication proxy ({taco_application.address}) on "
f"ThresholdStakingMock ({mock_threshold_staking.address})")
mock_threshold_staking.setApplication(taco_application.address, sender=deployer.get_account())

print("\nInitializing TACoApplication proxy")
taco_application.initialize(sender=deployer.get_account())

taco_application = deployer.proxy(project.TACoApplication, proxy)
deployer.transact(mock_threshold_staking.setApplication, taco_application.address)
deployer.transact(taco_application.initialize)
mock_polygon_root = deployer.deploy(project.MockPolygonRoot)

print(f"\nSetting child application on TACoApplication proxy "
f"({taco_application.address}) to MockPolygonChild ({mock_polygon_root.address})")
taco_application.setChildApplication(mock_polygon_root.address, sender=deployer)
deployer.transact(taco_application.setChildApplication, mock_polygon_root.address)

deployments = [
reward_token,
Expand Down

0 comments on commit 6164188

Please sign in to comment.