Allow beneficiary allocation registry specification to accept an instance or filepath

pull/805/head
Kieran R. Prasch 2019-01-30 19:14:46 -08:00 committed by Kieran Prasch
parent 4073614229
commit 9a00a84f4c
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
2 changed files with 7 additions and 4 deletions

View File

@ -228,7 +228,8 @@ class Deployer(NucypherTokenActor):
def deploy_beneficiary_contracts(self,
allocations: List[Dict[str, Union[str, int]]],
allocation_outfile: str = None
allocation_outfile: str = None,
allocation_registry: AllocationRegistry = None,
) -> None:
"""
@ -238,6 +239,9 @@ class Deployer(NucypherTokenActor):
{'address': '0xabced120', 'amount': 133432, 'duration': 31540000*2},
{'address': '0xf7aefec2', 'amount': 999, 'duration': 31540000*3}]
"""
if allocation_registry and allocation_outfile:
raise self.ActorError("Pass either allocation registry or allocation_outfile, not both.")
if allocation_registry is None:
allocation_registry = AllocationRegistry(registry_filepath=allocation_outfile)
for allocation in allocations:
deployer = self.deploy_user_escrow(allocation_registry=allocation_registry)

View File

@ -43,7 +43,6 @@ def test_rapid_deployment():
origin, *everyone = blockchain.interface.w3.eth.accounts
deployer = Deployer(blockchain=blockchain,
allocation_registry=allocation_registry,
deployer_address=origin)
deployer_address, *all_yall = deployer.blockchain.interface.w3.eth.accounts
@ -73,4 +72,4 @@ def test_rapid_deployment():
random_allocation = {'address': beneficiary_address, 'amount': amount, 'duration': duration}
allocation_data.append(random_allocation)
deployer.deploy_beneficiary_contracts(allocations=allocation_data)
deployer.deploy_beneficiary_contracts(allocations=allocation_data, allocation_registry=allocation_registry)