Ejemplo n.º 1
0
 def test_accountvotes(self):
     bts = self.bts
     utc = pytz.timezone('UTC')
     limit_time = utc.localize(datetime.utcnow()) - timedelta(days=7)
     votes = AccountVotes(self.voter, start=limit_time, steem_instance=bts)
     self.assertTrue(len(votes) > 0)
     self.assertTrue(isinstance(votes[0], Vote))
Ejemplo n.º 2
0
 def test_accountvotes(self, node_param):
     if node_param == "non_appbase":
         bts = self.bts
     else:
         bts = self.appbase
     votes = AccountVotes(self.author, steem_instance=bts)
     self.assertTrue(len(votes) > 0)
     self.assertTrue(isinstance(votes[0], Vote))
Ejemplo n.º 3
0
 def test_accountvotes(self, node_param):
     if node_param == "non_appbase":
         bts = self.bts
     else:
         bts = self.appbase
     utc = pytz.timezone('UTC')
     limit_time = utc.localize(datetime.utcnow()) - timedelta(days=7)
     votes = AccountVotes(self.author, start=limit_time, steem_instance=bts)
     self.assertTrue(len(votes) > 0)
     self.assertTrue(isinstance(votes[0], Vote))
Ejemplo n.º 4
0
                member_data[m]["first_cycle_at"] = datetime(
                    1970, 1, 1, 0, 0, 0)
                member_data[m][
                    "balance_rshares"] = total_share_days * rshares_per_cycle * 10
                member_data[m][
                    "earned_rshares"] = total_share_days * rshares_per_cycle * 10
                member_data[m]["rewarded_rshares"] = 0
                member_data[m][
                    "subscribed_rshares"] = total_share_days * rshares_per_cycle * 10
                member_data[m]["delegation_rshares"] = 0
                member_data[m]["curation_rshares"] = 0

            for acc_name in accounts:
                acc = Account(acc_name, steem_instance=stm)

                a = AccountVotes(acc_name, steem_instance=stm)
                print(acc_name)
                for vote in a:
                    author = vote["author"]
                    if author in member_data:
                        member_data[author]["rewarded_rshares"] += int(
                            vote["rshares"])
                        member_data[author]["balance_rshares"] -= int(
                            vote["rshares"])

        if True:
            b = Blockchain(steem_instance=stm)
            wallet = Wallet(steem_instance=stm)
            accountTrx = {}
            for acc_name in accounts:
                print(acc_name)
import dataset

if __name__ == "__main__":
    config_file = 'config.json'
    try:
        with open(config_file) as json_data_file:
            config_data = json.load(json_data_file)
    except FileNotFoundError:
        raise FileNotFoundError("config.json is missing!")

    # datetime object must be localized. Assuming Eastern Time
    yesterday = datetime.now() - timedelta(days=1)
    tz = pytz.timezone('US/Eastern')
    start_date = tz.localize(yesterday)

    votes = AccountVotes('hivewatchers', start=start_date)

    # Down Votes have a weight of 0.
    down_voted_accounts = set()
    for vote in votes:
        if vote.weight == 0:
            down_voted_accounts.add(vote.votee)

    sbi_database_connector = config_data["databaseConnector2"]
    sbi_database = dataset.connect(sbi_database_connector)
    member_table = sbi_database['member']
    pending_blacklist_table = sbi_database['pending_blacklist']

    for down_voted_account in down_voted_accounts:
        if member_table.find_one(account=down_voted_account, hivewatchers=0) is not None:
            try: