def run_test_fund(self): # if deployment did not already happen do it now if not self.dao_addr: self.run_test_deploy() else: print( "WARNING: Running the funding scenario with a pre-deployed " "DAO contract. Closing time is {} which is approximately {} " "seconds from now.".format( datetime.fromtimestamp(self.closing_time).strftime( '%Y-%m-%d %H:%M:%S' ), self.closing_time - ts_now() ) ) sale_secs = self.closing_time - ts_now() self.total_supply = self.min_value + random.randint(1, 100) self.token_amounts = constrained_sum_sample_pos( len(self.accounts), self.total_supply ) self.create_js_file( 'fund', { "dao_abi": self.dao_abi, "dao_address": self.dao_addr, "wait_ms": (sale_secs-3)*1000, "amounts": arr_str(self.token_amounts) } ) print( "Notice: Funding period is {} seconds so the test will wait " "as much".format(sale_secs) ) output = self.run_script('fund.js') eval_test('fund', output, { "dao_funded": True, "total_supply": self.total_supply, "balances": self.token_amounts, "user0_after": self.token_amounts[0], })
def remaining_time(self): return self.closing_time - ts_now()