Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save livinginformation/2972063984025d69193c4711485a4735 to your computer and use it in GitHub Desktop.
Save livinginformation/2972063984025d69193c4711485a4735 to your computer and use it in GitHub Desktop.
ASD
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