-
Notifications
You must be signed in to change notification settings - Fork 4
/
decimalData.py
33 lines (31 loc) · 1.35 KB
/
decimalData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def getTokenDecimal(decimal):
decimal = int("1" + str("0" * decimal))
decimalsDict = {"wei": 1,
"kwei": 1000,
"babbage": 1000,
"femtoether": 1000,
"mwei": 1000000,
"lovelace": 1000000,
"picoether": 1000000,
"gwei": 1000000000,
"shannon": 1000000000,
"nanoether": 1000000000,
"nano": 1000000000,
"szabo": 1000000000000,
"microether": 1000000000000,
"micro": 1000000000000,
"finney": 1000000000000000,
"milliether": 1000000000000000,
"milli": 1000000000000000,
"ether": 1000000000000000000,
"kether": 1000000000000000000000,
"grand": 1000000000000000000000,
"mether": 1000000000000000000000000,
"gether": 1000000000000000000000000000,
"tether": 1000000000000000000000000000000}
# list out keys and values separately
key_list = list(decimalsDict.keys())
val_list = list(decimalsDict.values())
# print key with val 100
position = val_list.index(decimal)
return key_list[position]