mirror of https://github.com/nucypher/nucypher.git
Allow beneficiary allocation registry specification to accept an instance or filepath
parent
4073614229
commit
9a00a84f4c
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue