Commit 1153fd9a authored by obscuren's avatar obscuren

Added Douglas and Einstan

parent a56f78af
...@@ -7,13 +7,15 @@ import ( ...@@ -7,13 +7,15 @@ import (
// The different number of units // The different number of units
var ( var (
Ether = BigPow(10, 18) Douglas = BigPow(10, 42)
Finney = BigPow(10, 15) Einstein = BigPow(10, 21)
Szabo = BigPow(10, 12) Ether = BigPow(10, 18)
Shannon = BigPow(10, 9) Finney = BigPow(10, 15)
Babbage = BigPow(10, 6) Szabo = BigPow(10, 12)
Ada = BigPow(10, 3) Shannon = BigPow(10, 9)
Wei = big.NewInt(1) Babbage = BigPow(10, 6)
Ada = BigPow(10, 3)
Wei = big.NewInt(1)
) )
// Currency to string // Currency to string
...@@ -21,6 +23,10 @@ var ( ...@@ -21,6 +23,10 @@ var (
// Returns a string representing a human readable format // Returns a string representing a human readable format
func CurrencyToString(num *big.Int) string { func CurrencyToString(num *big.Int) string {
switch { switch {
case num.Cmp(Douglas) >= 0:
return fmt.Sprintf("%v Douglas", new(big.Int).Div(num, Douglas))
case num.Cmp(Einstein) >= 0:
return fmt.Sprintf("%v Einstein", new(big.Int).Div(num, Einstein))
case num.Cmp(Ether) >= 0: case num.Cmp(Ether) >= 0:
return fmt.Sprintf("%v Ether", new(big.Int).Div(num, Ether)) return fmt.Sprintf("%v Ether", new(big.Int).Div(num, Ether))
case num.Cmp(Finney) >= 0: case num.Cmp(Finney) >= 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment