-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
26 lines (17 loc) · 647 Bytes
/
app.py
File metadata and controls
26 lines (17 loc) · 647 Bytes
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
from flask import Flask, request, send_file
from utils.saving import save_contract
from utils.scan_api import EVMScan
app = Flask(__name__, static_folder="contracts")
with open("templates/index.html") as f:
html = f.read()
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == "POST":
api_key = request.form.get("api-key")
contract = request.form.get("address")
endpoint = request.form.get("endpoint")
file = save_contract(EVMScan(api_key, endpoint), contract.lower())
return send_file(file, as_attachment=True)
return html
if __name__ == "__main__":
app.run()