def spawn_random_miners(self, addresses: list) -> list: """ Deposit and lock a random amount of tokens in the miner escrow from each address, "spawning" new Miners. """ from nucypher.blockchain.eth.actors import Miner miners = list() for address in addresses: miner = Miner(miner_agent=self, address=address) miners.append(miner) # stake a random amount min_stake, balance = self.min_allowed_locked, miner.token_balance() amount = random.randint(min_stake, balance) # for a random lock duration min_locktime, max_locktime = self.min_locked_periods, self.max_minting_periods periods = random.randint(min_locktime, max_locktime) miner.stake(amount=amount, lock_periods=periods) return miners
def spawn_random_miners(self, addresses: list) -> list: """ Deposit and lock a random amount of tokens in the miner escrow from each address, "spawning" new Miners. """ from nucypher.blockchain.eth.actors import Miner miners = list() for address in addresses: miner = Miner(miner_agent=self, ether_address=address) miners.append(miner) # stake a random amount min_stake, balance = constants.MIN_ALLOWED_LOCKED, miner.token_balance amount = random.randint(min_stake, balance) # for a random lock duration min_locktime, max_locktime = constants.MIN_LOCKED_PERIODS, constants.MAX_MINTING_PERIODS periods = random.randint(min_locktime, max_locktime) miner.stake(amount=amount, lock_periods=periods) return miners