-
Notifications
You must be signed in to change notification settings - Fork 11
/
stat_TokenInfo.py
65 lines (50 loc) · 1.58 KB
/
stat_TokenInfo.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import zipfile
fileDir = "./"
files = [
"ERC20TokenInfo",
"ERC721TokenInfo"
]
def ToInt(str):
return None if str=="None" else int(str)
erc20_line_count = 0
erc721_line_count = 0
# ERC20TokenInfo
file = files[0]
theZIP = zipfile.ZipFile(fileDir+file+".zip", 'r')
theCSV = theZIP.open(file+".csv")
head = theCSV.readline()
oneLine = theCSV.readline().decode("utf-8").strip()
while (oneLine!=""):
oneArray = oneLine.split(",")
# address,name,symbol,totalSupply,decimal
address = oneArray[0]
name = oneArray[1]
symbol = oneArray[2]
totalSupply = ToInt(oneArray[3])
decimal = ToInt(oneArray[4])
if erc20_line_count % 1000 == 0:
print(erc20_line_count, address, name)
erc20_line_count += 1
oneLine = theCSV.readline().decode("utf-8").strip()
theCSV.close()
theZIP.close()
# ERC721TokenInfo
file = files[1]
theZIP = zipfile.ZipFile(fileDir+file+".zip", 'r')
theCSV = theZIP.open(file+".csv")
head = theCSV.readline()
oneLine = theCSV.readline().decode("utf-8").strip()
while (oneLine!=""):
oneArray = oneLine.split(",")
# address,name,symbol,totalSupply
address = oneArray[0]
name = oneArray[1]
symbol = oneArray[2]
totalSupply = ToInt(oneArray[3])
if erc721_line_count % 1000 == 0:
print(erc721_line_count, address, name)
erc721_line_count += 1
oneLine = theCSV.readline().decode("utf-8").strip()
theCSV.close()
theZIP.close()
print(erc20_line_count, erc721_line_count) # 1113526 243854