aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-06 18:12:27 +0800
committerobscuren <geffobscura@gmail.com>2014-06-06 18:12:27 +0800
commit1153fd9a0c9310ab70f9b20914071e0184e8020a (patch)
tree49d4e22e48f7d96e019a95b74154d74ccb8013f1 /ethutil/common.go
parenta56f78af67ba2b515f396d7a150ac86f6a75335f (diff)
downloaddexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.tar
dexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.tar.gz
dexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.tar.bz2
dexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.tar.lz
dexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.tar.xz
dexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.tar.zst
dexon-1153fd9a0c9310ab70f9b20914071e0184e8020a.zip
Added Douglas and Einstan
Diffstat (limited to 'ethutil/common.go')
-rw-r--r--ethutil/common.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/ethutil/common.go b/ethutil/common.go
index 771dfc723..c7973eb92 100644
--- a/ethutil/common.go
+++ b/ethutil/common.go
@@ -7,13 +7,15 @@ import (
// The different number of units
var (
- Ether = BigPow(10, 18)
- Finney = BigPow(10, 15)
- Szabo = BigPow(10, 12)
- Shannon = BigPow(10, 9)
- Babbage = BigPow(10, 6)
- Ada = BigPow(10, 3)
- Wei = big.NewInt(1)
+ Douglas = BigPow(10, 42)
+ Einstein = BigPow(10, 21)
+ Ether = BigPow(10, 18)
+ Finney = BigPow(10, 15)
+ Szabo = BigPow(10, 12)
+ Shannon = BigPow(10, 9)
+ Babbage = BigPow(10, 6)
+ Ada = BigPow(10, 3)
+ Wei = big.NewInt(1)
)
// Currency to string
@@ -21,6 +23,10 @@ var (
// Returns a string representing a human readable format
func CurrencyToString(num *big.Int) string {
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:
return fmt.Sprintf("%v Ether", new(big.Int).Div(num, Ether))
case num.Cmp(Finney) >= 0: