Created
March 29, 2018 21:12
-
-
Save livinginformation/2972063984025d69193c4711485a4735 to your computer and use it in GitHub Desktop.
ASD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_votes_cards(address): | |
votes = 0 | |
balances = get_balances(address) | |
if len(balances) == 0: | |
return | |
# Tally up votes for indivisibles | |
if len(balances) < len(indivisibles): | |
for asset in indivisibles: | |
if asset in balances: | |
# Address has a Pepe asset, give proportional votes | |
#print(str(balances[asset]) + "/" + str(indivisibles[asset]['quantity']) + " held of " + asset) | |
card_votes = float(balances[asset])/float(indivisibles[asset]['quantity'])*1000 | |
votes += math.floor(card_votes) | |
else: | |
for asset in balances: | |
if asset in indivisibles: | |
# Address has a Pepe asset, give proportional votes | |
#print(str(balances[asset]) + "/" + str(indivisibles[asset]['quantity']) + " held of " + asset) | |
card_votes = float(balances[asset])/float(indivisibles[asset]['quantity'])*1000 | |
votes += math.floor(card_votes) | |
# Tally up votes for divisibles | |
for asset in divisibles: | |
if asset in balances: | |
#print(str(balances[asset]) + "/" + str(divisibles[asset]['quantity']) + " held of " + asset) | |
card_votes = float(balances[asset])/float(divisibles[asset]['quantity']*100000000)*1000 | |
votes += math.floor(card_votes) | |
return votes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment