Skip to content

Instantly share code, notes, and snippets.

@veox
Created July 9, 2016 12:42
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 veox/b783b98acc8fbc503806a900e88a3938 to your computer and use it in GitHub Desktop.
Save veox/b783b98acc8fbc503806a900e88a3938 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import math
# round precision
rp = 3
# vote weight - square
def vws (stake, duration):
return round(stake * duration * duration, rp)
# vote weight - root
def vwr (stake, duration):
return round(stake * math.sqrt(duration), rp)
stakes = [1, 10, 100, 1000]
durations = list(range(1,8))
print("Square:")
for d in durations:
print([vws(s,d) for s in stakes])
print()
print("Root:")
for d in durations:
print([vwr(s,d) for s in stakes])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment