-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
41 lines (30 loc) · 1.21 KB
/
main.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
from core.contracts import Contracts
from core.dependency_graph.dependency_graph import DependencyGraph
from core.select_solc_compiler import set_version
def main(contract_dir, contract_name):
"""
ReceiverPays does not show owner.
WETH9 does not show requires.
Ballot does not show requires.
"""
# constructs the data dependency graph.
# if a file contains multiple contracts, DDG will be constructed for each.
contracts = Contracts(contract_dir)
# getting the contract object by name.
contract = contracts.get_contract_by_name(contract_name)
print(contract.summary)
# Graph generation
DG = DependencyGraph(contract)
f = open(f'./_graphs/{contract_name}.html', 'w')
f.write(DG.html)
f.close()
if __name__ == '__main__':
try:
contracts = ["Purchase", "Ballot", "ReceiverPays", "SimpleAuction", "BlindAuction", "Token", "Example",
"CryptoHands", "CryptoMinerToken", "lothlor", "HoloToken", "WETH9", "Exchange"]
for contract in contracts:
source_dir = f'./_sample_contracts/{contract}.sol'
set_version(source_dir)
main(source_dir, contract)
except KeyboardInterrupt:
pass