Ejemplo n.º 1
0
        current_cycle = last_cycle + timedelta(seconds=60 * share_cycle_min)

        print("Update member database, new cycle: %s" % str(new_cycle))
        # memberStorage.wipe(True)
        member_accounts = memberStorage.get_all_accounts()

        #print(key_list)
        nodes = NodeList()
        nodes.update_nodes()
        stm = Steem(node=nodes.get_nodes())

        member_data = {}
        n_records = 0
        share_age_member = {}
        for m in member_accounts:
            member_data[m] = Member(memberStorage.get(m))

        if True:
            print("reward voted steembasicincome post and comments")
            # account = Account("steembasicincome", steem_instance=stm)

            if last_paid_post is None:
                last_paid_post = datetime(2018, 8, 9, 3, 36, 48)
            new_paid_post = last_paid_post
            if last_paid_comment is None:
                last_paid_comment = datetime(2018, 8, 9, 3, 36, 48)
            # elif (datetime.utcnow() - last_paid_comment).total_seconds() / 60 / 60 / 24 < 6.5:
            #    last_paid_comment = datetime.utcnow() - timedelta(days=7)
            new_paid_comment = last_paid_comment

            for account in accounts:
Ejemplo n.º 2
0
         "RemovedDelegation", "Delegation", "DelegationLeased",
         "Mgmt", "MgmtTransfer"
 ]:
     continue
 sponsor = op["sponsor"]
 sponsee = json.loads(op["sponsee"])
 shares = op["shares"]
 share_age = 0
 if isinstance(op["timestamp"], str):
     timestamp = formatTimeString(op["timestamp"])
 else:
     timestamp = op["timestamp"]
 if shares == 0:
     continue
 if sponsor not in member_data:
     member = Member(sponsor, shares, timestamp)
     member.append_share_age(timestamp, shares)
     member_data[sponsor] = member
 else:
     member_data[sponsor]["latest_enrollment"] = timestamp
     member_data[sponsor]["shares"] += shares
     member_data[sponsor].append_share_age(timestamp, shares)
 if len(sponsee) == 0:
     continue
 for s in sponsee:
     shares = sponsee[s]
     if s not in member_data:
         member = Member(s, shares, timestamp)
         member.append_share_age(timestamp, shares)
         member_data[s] = member
     else:
        created = post_list[authorperm]["created"]
        if (datetime.utcnow() - created).total_seconds() > 3 * 24 * 60 * 60:
            continue
        if (start_timestamp > created):
            continue
        author = post_list[authorperm]["author"]
        if author not in member_accounts:
            continue
        if upvote_counter[author] > 0:
            continue
        if post_list[authorperm]["main_post"] == 0 and (
                datetime.utcnow() -
                created).total_seconds() > comment_vote_timeout_h * 60 * 60:
            postTrx.update_comment_to_old(author, created, True)

        member = Member(memberStorage.get(author))
        if member["comment_upvote"] == 0 and post_list[authorperm][
                "main_post"] == 0:
            continue
        if member["blacklisted"]:
            continue
        elif member["blacklisted"] is None and (member["steemcleaners"]
                                                or member["buildawhale"]):
            continue

        rshares = member["balance_rshares"] / comment_vote_divider
        if post_list[authorperm][
                "main_post"] == 1 and rshares < minimum_vote_threshold:
            continue
        elif post_list[authorperm][
                "main_post"] == 0 and rshares < minimum_vote_threshold * 2:
Ejemplo n.º 4
0
        #print(key_list)
        nodes = NodeList()
        nodes.update_nodes()
        stm = Steem(keys=keys_list, node=nodes.get_nodes(hive=hive_blockchain))
        
        if memo_transfer_acc is not None:
            try:
                memo_transfer_acc = Account(memo_transfer_acc, steem_instance=stm)
            except:
                print("%s is not a valid steem account! Will be able to send transfer memos..." % memo_transfer_acc)
        
        member_data = {}
        n_records = 0
        share_age_member = {}    
        for m in member_accounts:
            member_data[m] = Member(memberStorage.get(m))

        mngt_shares_assigned = False
        mngt_shares = 0
        delegation = {}
        delegation_timestamp = {}
        # clear shares
        for m in member_data:
            member_data[m]["shares"] = 0
            member_data[m]["bonus_shares"] = 0
            delegation[m] = 0
            delegation_timestamp[m] = None
            member_data[m].reset_share_age_list()
        
        shares_sum = 0
        latest_share = trxStorage.get_lastest_share_type("Mgmt")