def self_vote_producers(self, a_accounts, num_accounts=10000000): i = 0 for a in a_accounts: if i < num_accounts: cmd = self.teclos_dir + ' --url %s system voteproducer approve ' + a.name + ' ' + a.name run_retry(cmd % self.host_address) i = i + 1
def post_sys_create(self, a, net, cpu, ram, creator='eosio'): cmd = self.teclos + ' --url %s system newaccount %s --transfer %s %s --stake-net \"%s\" --stake-cpu \"%s\" --buy-ram \"%s\"' net = Asset(net) cpu = Asset(cpu) ram = Asset(ram) run_retry(cmd % (self.host_address, creator, a.name, a.keypair.public, net, cpu, ram)) a.amount += cpu + net + ram
def vote_producers(self, a_accounts, b_accounts, minimum=10, maximum=30): for a in a_accounts: cmd = self.teclos_dir + ' --url %s system voteproducer prods ' + a.name + ' ' i = 0 for t in b_accounts: if a.name != t.name and i < randint(minimum, maximum): cmd += t.name + " " i = i + 1 run_retry(cmd % self.host_address)
def push_action(self, target, action_name, json): run_retry(self.teclos_dir + ' --url %s push action %s %s %s' % (self.host_address, target, action_name, json))
def set_contract(self, account_name, path, p=""): print(self.host_address) cmd = self.teclos_dir + ' --url %s set contract %s %s' if p != "": cmd += ' -p %s' % p run_retry(cmd % (self.host_address, account_name, path))
def transfer(host_address, sender, receipient, amount, memo=""): cmd = 'teclos --url %s transfer %s %s \"%s\" \"%s\"' run_retry(cmd % (host_address, sender, receipient, amount, memo))