-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy patherc1155.py
78 lines (52 loc) · 1.75 KB
/
erc1155.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
66
67
68
69
70
71
72
73
74
75
76
77
78
import re
import common
variations = {
"OZ": "OpenZeppelin",
"Solmate": "Solmate",
}
# Methods to format .gas-snapshot line to an object with relevant info
deploy_regex = re.compile("deploy.+gas:\s(\d+)")
def deploy(line):
match = re.search(deploy_regex, line)
return {
"gas": match.group(1)
}
mint_regex = re.compile("test_mint.+gas:\s(\d+)")
def mint(line):
match = re.search(mint_regex, line)
return {
"gas": match.group(1)
}
mintBatch_regex = re.compile("test_mintBatch_(\d+).+gas:\s(\d+)")
def mintBatch(line):
match = re.search(mintBatch_regex, line)
return {
"key": match.group(1),
"gas": match.group(2)
}
safeTransferFrom_regex = re.compile("test_safeTransferFrom.+gas:\s(\d+)")
def safeTransferFrom(line):
match = re.search(safeTransferFrom_regex, line)
return {
"gas": match.group(1)
}
safeBatchTransferFrom_regex = re.compile(
"test_safeBatchTransferFrom_(\d+).+gas:\s(\d+)")
def safeBatchTransferFrom(line):
match = re.search(safeBatchTransferFrom_regex, line)
return {
"key": match.group(1),
"gas": match.group(2)
}
def group(lines):
methods = common.group_methods_and_variant(lines)
def rows_for_method(method_name, method_fn):
return common.rows_for_method(methods, variations, method_name, method_fn)
methods["deploy"] = rows_for_method("deploy", deploy)
methods["mint"] = rows_for_method("mint", mint)
methods["mintBatch"] = rows_for_method("mintBatch", mintBatch)
methods["safeTransferFrom"] = rows_for_method(
"safeTransferFrom", safeTransferFrom)
methods["safeBatchTransferFrom"] = rows_for_method(
"safeBatchTransferFrom", safeBatchTransferFrom)
return methods