forked from mindstyle85/pops-network-validators-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
188 lines (176 loc) · 5.63 KB
/
app.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
from flask import Flask, abort, jsonify
import json
app = Flask(__name__)
#defining static data at first
datas = [
{
"ID": "1",
"Name": "Harmony",
"price": "0.20",
"APY": "10-12",
"Fees" : "5",
"Info": "Harmony insert decription",
"Total_delegagation" : "1111",
"Project_website" : "https://www.harmony.one",
"Project_documentations" : ["https://github.com/harmony", "https://medium.com/harmony"],
"Validators": [
{
"Address": "one1kf42rl6yg2avkjsu34ch2jn8yjs64ycn4n9wdj",
"Name": "P-OPS Validator",
"Fees": "5",
"Delegation": "250000000",
"Stake_link": "https://staking.harmony.one/validators/mainnet/one1kf42rl6yg2avkjsu34ch2jn8yjs64ycn4n9wdj"
},
{
"Address": "one19ugus2az5a9m8tcgeq2pazcdht5kn3pe86434u",
"Name": "Stakehere",
"Fees": "10",
"Delegation": "15000000",
"Stake_link": "https://staking.harmony.one/validators/mainnet/one19ugus2az5a9m8tcgeq2pazcdht5kn3pe86434u"
}
]
},
{
"ID": "2",
"Name": "Solana",
"price": "20",
"Fees" : "5",
"APY": "15",
"Info": "Solana insert decription",
"Total_delegagation" : "1111",
"Project_website" : "https://www.solana.com",
"Project_documentations" : ["github.com/solana", "medium.com/solana"],
"Validators": [
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Soph",
"Fees": "5",
"Delegation": "250000000",
"Stake_link": "https://stake_link_to_be_filled_up"
},
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Mindstyle",
"Fees": "10",
"Delegation": "15000000",
"Stake_link": "https://stake_link_to_be_filled_up"
}
]
},
{
"ID": "3",
"Name": "Avalanche",
"price": "0.2",
"APY": "32",
"Fees" : "5",
"Info": "Avalanche insert description",
"Total_delegagation" : "1111",
"Project_website" : "https://www.avalabs.org/",
"Project_documentations" : ["github.com/avalabs", "medium.com/avalabs"],
"Validators": [
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Soph",
"Fees": "5",
"Delegation": "250000000",
"Stake_link": "https://stake_link_to_be_filled_up"
},
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Mindstyle",
"Fees": "10",
"Delegation": "15000000",
"Stake_link": "https://stake_link_to_be_filled_up"
}
]
},
{
"ID": "4",
"Name": "The Graph",
"price": "2",
"APY": "15",
"Fees" : "5",
"Info": "The Graph insert description",
"Total_delegagation" : "1111",
"Project_website" : "https://thegraph.com/",
"Project_documentations" : ["github.com/thegraph", "medium.com/thegraph"],
"Validators": [
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Soph",
"Fees": "5",
"Delegation": "250000000",
"Stake_link": "https://stake_link_to_be_filled_up"
},
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Mindstyle",
"Fees": "10",
"Delegation": "15000000",
"Stake_link": "https://stake_link_to_be_filled_up"
}
]
},
{
"ID": "5",
"Name": "Stafi",
"price": "4",
"APY": "15",
"Fees" : "5",
"Info": "Stafi insert description",
"Total_delegagation" : "1111",
"Project_website" : "https://www.stafi.io",
"Project_documentations" : ["github.com/stafi", "medium.com/stafi"],
"Validators": [
{
"Address": "D8P3w7GQ4zTYbJfEGgfdQWQ1vrL6umGYAUrMz4hBJjrN",
"Name": "Soph",
"Fees": "5",
"Delegation": "250000000",
"Stake_link": "https://stake_link_to_be_filled_up"
}
]
}
]
@app.errorhandler(404)
def resource_not_found(e):
return jsonify(error=str(e)), 404
@app.route('/')
def hello_world():
return 'Hello to POPS Validator data API endpoint!'
@app.route('/networks/harmony')
def harmony_data():
try:
return datas[0]
except:
abort(404, description="Harmony ressource not found")
@app.route('/networks/solana')
def solana_data():
try:
return datas[1]
except:
abort(404, description="Solana ressource not found")
@app.route('/networks/avalanche')
def avalanche_data():
try:
return datas[2]
except:
abort(404, description="Avalanche ressource not found")
@app.route('/networks/thegraph')
def thegraph_data():
try:
return datas[3]
except:
abort(404, description="The Graph ressource not found")
@app.route('/networks/stafi')
def stafi_data():
try:
return datas[4]
except:
abort(404, description="Stafi ressource not found")
@app.route('/networks')
def all():
try:
return jsonify(datas)
except:
abort(404, description="Solana ressource not found")