Beispiel #1
0
    def create_payment(self, from_address, to_address, amount, color):
        role = BaseRole(env.host)
        balances = role.getaddressbalance(from_address)
        if not balances.has_key(str(color)) or not balances.has_key("1") or int(balances[color]) < amount:
            # insufficient funds
            return

        role.send_coins(from_address, to_address, amount, color)
        msg = "{from_addr} send {amount} of color: {color} TO {to_addr}".format(from_addr=from_address,
                                                                                amount=amount,
                                                                                color=color,
                                                                                to_addr=to_address)
        print green(msg)
Beispiel #2
0
    def create_payment(self, from_address, to_address, amount, color):
        role = BaseRole(env.host)
        balances = role.getaddressbalance(from_address)
        if not balances.has_key(str(color)) or not balances.has_key("1") or int(balances[color]) < amount:
            f = open(env.host.split('_')[0] + env.host.split('_')[1] + '.txt','a')
            if not balances.has_key("1"):
                f.write('color 1 not enough\n')
            else :
                f.write('color ' + str(color) + ' not enough\n')
            f.close()
            # insufficient funds
            return

        role.send_coins(from_address, to_address, amount, color, False)
        msg = "{from_addr} send {amount} of color: {color} TO {to_addr}".format(from_addr=from_address,
                                                                                amount=amount,
                                                                                color=color,
                                                                                to_addr=to_address)
        print green(msg)