-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
250 lines (201 loc) · 8.96 KB
/
index.html
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<html>
<head>
<title>DEEPSPACE (DPS) What The Gas Client</title>
<meta http-equiv="Pragma" content="no-cache">
<base target="_blank">
<script src="https://d3js.org/d3.v7.min.js"></script>
<script>
let xhr = new XMLHttpRequest();
xhr.open('GET', "https://gas.deepspace.game/api");
xhr.send();
var respond;
var lastUpdated = "";
var totalBNBMonth = "";
var monthStart = "";
var monthEnd = "";
var totalBNBMonthPrev = "";
var monthStartPrev = "";
var monthEndPrev = "";
largeFormat = d3.format(",.0f");
largeFormatDecimal = d3.format(",.2f");
largeFormatPercentage = d3.format(",.4f");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
var data = xhr.response;
tokenData = JSON.parse(data);
console.log(tokenData);
totalBNBMonth = tokenData["total_bnb_month"];
document.getElementById('totalBNBMonth').innerHTML = "Total BNB Month: " + largeFormatDecimal(totalBNBMonth);
monthStart = tokenData["month_start"];
document.getElementById('monthStart').innerHTML = "Month Start: " + monthStart;
monthEnd = tokenData["month_end"];
document.getElementById('monthEnd').innerHTML = "Month End: " + monthEnd;
totalBNBMonthPrev = tokenData["total_bnb_prev_month"];
document.getElementById('totalBNBMonthPrev').innerHTML = "Previous Total BNB Month: " + largeFormatDecimal(totalBNBMonthPrev);
monthStartPrev = tokenData["prev_month_start"];
document.getElementById('monthStartPrev').innerHTML = "Previous Month Start: " + monthStartPrev;
monthEndPrev = tokenData["prev_month_end"];
document.getElementById('monthEndPrev').innerHTML = "Previous Month End: " + monthEndPrev;
contractsList = tokenData["contracts"];
document.getElementById('contractsList').innerHTML = "Contracts List:<br>";
lastUpdated = tokenData["last_updated"];
document.getElementById('lastUpdated').innerHTML = "Last Updated: " + lastUpdated;
// creates a <table> element and a <tbody> element
tbl = document.createElement("table");
tblBody = document.createElement("tbody");
row = document.createElement("tr");
cell = document.createElement("td");
cellText = document.createTextNode("Contract Count:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Contract Name:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Contract Address:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Previous Month:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Previous BNB Gas Used:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Previous BNB Reward Eligible:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Previous BNB Reward:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("Current Month:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("BNB Gas Used:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("BNB Reward Eligible:");
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode("BNB Reward:");
cell.appendChild(cellText);
row.appendChild(cell);
// add the row to the end of the table body
tblBody.appendChild(row);
y = 0;
for (let i = 0; i < contractsList.length; i++) {
y++;
contractCount = y;
contractName = contractsList[i]["contract_name"];
contractAddress = contractsList[i]["contract_address"];
previousMonth = contractsList[i]["previous_month"];
previousGasValue = contractsList[i]["prev_gas_value"];
prevBNBRewardEligible = contractsList[i]["prev_bnb_reward_eligible"];
prevBNBReward = contractsList[i]["prev_bnb_reward"];
currentMonth = contractsList[i]["current_month"];
currentGasValue = contractsList[i]["gas_value"];
currentGasValue = contractsList[i]["gas_value"];
bnbRewardEligible = contractsList[i]["bnb_reward_eligible"];
bnbReward = contractsList[i]["bnb_reward"];
var linkContractAddress = document.createElement('a');
linkContractAddress.href = "https://bscscan.com/token/" + contractAddress;
linkContractAddress.innerText = contractAddress;
// creates a table row
row = document.createElement("tr");
cell = document.createElement("td");
cellText = document.createTextNode(contractCount);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(contractName);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = linkContractAddress;
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(previousMonth);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(previousGasValue);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(prevBNBRewardEligible);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(prevBNBReward);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(currentMonth);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(currentGasValue);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(bnbRewardEligible);
cell.appendChild(cellText);
row.appendChild(cell);
cell = document.createElement("td");
cellText = document.createTextNode(bnbReward);
cell.appendChild(cellText);
row.appendChild(cell);
// add the row to the end of the table body
tblBody.appendChild(row);
}
// put the <tbody> in the <table>
tbl.appendChild(tblBody);
// appends <table> into <body>
document.getElementById('contractsList').appendChild(tbl);
// sets the border attribute of tbl to 2;
tbl.setAttribute("border", "2");
}
}
</script>
</head>
<body>
<h1>DEEPSPACE (DPS) What The Gas Client Stats</h1>
<h2>About DEEPSPACE</h2>
<p><b>Welcome to the DEEPSPACE Metaverse!</b><br/>
DEEPSPACE is a Play-to-Earn space multiverse exploration strategy game!<br/>
Earn passive income from holding $DPS, trading NFTs, and taking risks as you explore DEEPSPACE with your fleet of ships!<br/>
Prepare to explore, harvest, and fight your way through the DEEPSPACE universe!<br/>
Learn more at: <a href="https://deepspace.game">https://deepspace.game</a><br/>
Buy DEEPSPACE (DPS) at: <a href="https://app.deepspace.game">https://app.deepspace.game</a></br>
Mint/Buy/Sell/Trade Ships on the DEEPSPACE App at: <a href="https://app.deepspace.game">https://app.deepspace.game</a>
</p>
<p>This will display the monthly gas usage across the DEEPSPACE metaverse on the BNB Smart Chain network.
<br/>All contracts have been registered with <a href="https://www.binance.com/en/blog/all/introducing-the-buidl-reward-program-for-binance-smart-chain-421499824684901064">Binance BUILD Rewards</a> program
<br/>The official Binance leaderboard is here: <a href="https://www.bnbchain.world/en/leaderboard">https://www.bnbchain.world/en/leaderboard</a>
</p>
<p><i>Tip: Check the console log for the full JSON response from the token stat server</i></p>
<p>Pro Tip: DEEPSPACE (DPS) Gas API Endpoint: <a href="https://gas.deepspace.game/api">https://gas.deepspace.game/api</a></p>
<br/>
<br><div id="totalBNBMonthPrev">Previous Total BNB Month: N/A</div>
<br><div id="monthStartPrev">Previous Month Start: N/A</div>
<br><div id="monthEndPrev">Previous Month End: N/A</div>
<br>
<br><div id="totalBNBMonth">Total BNB Month: N/A</div>
<br><div id="monthStart">Month Start: N/A</div>
<br><div id="monthEnd">Month End: N/A</div>
<br>
<br><div id="contractsList">Contracts List: - N/A</div>
<br>
<br><div id="lastUpdated">Last Updated: N/A</div>
<br>
</body>
</html>