-
Notifications
You must be signed in to change notification settings - Fork 0
/
prize-distribution.html
371 lines (332 loc) · 10.4 KB
/
prize-distribution.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><text y='14'>☀️</text></svg>">
<title>Prize Distribution Calculator</title>
<style>
body {
margin: 0;
padding: 20px;
font-family: 'Maven Pro', monospace;
background-color: #262626;
color: #eee;
}
.container {
max-width: 800px;
width: 100%;
height: auto;
margin: auto;
background: #333;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
h1 {
color: #a7ffea;
text-align: center;
}
label {
display: block;
margin: 10px 0 5px;
}
input {
padding: 10px;
margin: 10px 0;
width: 200px;
border: none;
border-radius: 4px;
background: #444;
color: #fff;
}
button {
padding: 10px;
margin: 10px 0;
width: 200px;
border: none;
border-radius: 4px;
background: #a7ffea;
color: #333;
cursor: pointer;
}
button:hover {
background: #88e0e0;
}
h2 {
text-align: center;
}
p {
text-align: center;
color: #ccc;
max-width: 600px;
margin: 10px auto;
}
table {
margin: 20px auto;
width: auto;
min-width: 300px;
max-width: 600px;
border-collapse: collapse;
background: #444;
}
th, td {
padding: 10px 20px;
text-align: center;
border: 1px solid #666;
}
th {
background: #555;
}
.total {
font-weight: bold;
background: #666;
}
.formula {
text-align: center;
margin: 20px 0;
font-size: 1.2em;
}
.vault-value {
color: #a7ffea;
font-size: 1.2em;
}
.prize-label {
font-size: 1em;
color: #eee;
}
.prize-value {
color: #ffa500;
font-size: 1.4em;
margin-top: 10px;
}
.nav-links {
text-align: center;
margin: 20px 0;
}
.nav-links a {
color: #a7ffea;
text-decoration: none;
font-family: 'Maven Pro', monospace;
font-size: 16px;
display: inline-block;
margin: 0 10px;
}
.nav-links a:hover {
text-decoration: underline;
}
.nav-links span {
color: #666;
margin: 0 5px;
}
.error-message {
color: #ff0000;
font-size: 14px;
margin-left: 10px;
display: inline-block;
}
@media screen and (max-width: 768px) {
body {
padding: 10px;
}
.container {
padding: 10px;
}
h1 {
font-size: 20px;
margin: 10px 0;
}
input {
padding: 8px;
margin: 5px 0;
width: 180px;
font-size: 14px;
}
button {
padding: 8px;
margin: 5px 0;
width: 180px;
font-size: 14px;
}
table {
min-width: 200px;
margin: 10px auto;
}
th, td {
padding: 6px 10px;
font-size: 14px;
}
.formula {
font-size: 1em;
margin: 10px 0;
}
.vault-value {
font-size: 1em;
}
.prize-value {
font-size: 1.2em;
}
.nav-links {
margin: 10px 0;
}
.nav-links a {
font-size: 14px;
margin: 0 5px;
}
.error-message {
font-size: 12px;
margin-left: 5px;
}
p {
font-size: 14px;
margin: 8px auto;
}
h3 {
font-size: 16px;
margin: 10px 0;
}
}
@media screen and (max-width: 480px) {
body {
padding: 5px;
}
.container {
padding: 8px;
}
input, button {
width: 160px;
font-size: 12px;
}
table {
min-width: 180px;
}
th, td {
padding: 4px 8px;
font-size: 12px;
}
}
</style>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
</head>
<body>
<div class="nav-links">
<a href="index.html">Pyramid</a>
<span>•</span>
<a href="about.html">About</a>
<span>•</span>
<a href="tracker.html">Asset manager</a>
<span>•</span>
<a href="My_Assets.html">My Assets</a>
</div>
<div class="container">
<h1>Prize Distribution Calculator</h1>
<label for="range">Combination Range:</label>
<input type="number" id="range" placeholder="Enter combination range" min="1" max="77">
<span id="rangeError" class="error-message"></span>
<button id="checkVaultValue">Check MS Vault Value</button>
<p>NOTE: atm value is static as of Dec 21, 2024. Later on the "Check MS Vault value" button will fetch presice value from ASASTATS API.</p>
<p id="vaultValueResult" class="vault-value"></p>
<button id="calculatePrize">Calculate Prize</button>
<h2 class="prize-label">You won vault contents worth:</h2>
<p id="result" class="prize-value"></p>
<table>
<thead>
<tr>
<th>Range</th>
<th>Unique Ranges</th>
</tr>
</thead>
<tbody>
<tr>
<td>3</td>
<td>75</td>
</tr>
<tr>
<td>7</td>
<td>71</td>
</tr>
<tr>
<td>11</td>
<td>67</td>
</tr>
<tr>
<td>13</td>
<td>65</td>
</tr>
<tr class="total">
<td>Total</td>
<td>278</td>
</tr>
</tbody>
</table>
<h3>How prizes are calculated</h3>
<p>278 unique ranges can be created with factors of 3003. The formula:</p>
<div class="formula">
Prize = (Range/278) × Vault Value
</div>
<p>Winners can claim tokens from the vault up to the value of their calculated prize.</p>
</div>
<script>
// Function to fetch the vault value from the API
// async function fetchVaultValue() {
// try {
// const response = await fetch('https://www.asastats.com/api/vault-value'); // Replace with actual API endpoint
// const data = await response.json();
// return data.vaultValue; // Adjust based on actual API response structure
// } catch (error) {
// console.error('Error fetching vault value:', error);
// return null; // Handle error appropriately
// }
// }
// Set a constant for the vault value
const vaultValue = 240; // Set the vault value to 240 Algo
// Update the event listener for the Check MS Vault Value button
document.getElementById('checkVaultValue').addEventListener('click', function() {
document.getElementById('vaultValueResult').innerText = `Total Prize Pool: ${vaultValue} Algo`;
document.getElementById('result').innerText = '';
});
// Update the prize calculation logic
document.getElementById('calculatePrize').addEventListener('click', function() {
const range = parseFloat(document.getElementById('range').value);
const validRanges = [3, 7, 11, 13];
if (!validRanges.includes(range)) {
return;
}
const prize = (range / 278) * vaultValue;
document.getElementById('result').innerText = `${prize.toFixed(2)} Algo`;
// Add confetti effect with theme colors and flame colors
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.4, x: 0.5 }, // y: 0.4 means 40% down from the top of the page
// x: 0.5 means center of the page horizontally
colors: [
'#a7ffea', // Theme cyan
'#ffa500', // Theme orange
'#ffffd0', // Very light yellow
'#ffd700', // Gold
'#ffa500', // Orange
'#ff4500', // Red-orange
'#ff0000', // Red
'#8B008B', // Dark Magenta
'#3DED97' // Seafoam
]
});
});
document.getElementById('range').addEventListener('input', function() {
const range = parseFloat(this.value);
const validRanges = [3, 7, 11, 13];
const errorElement = document.getElementById('rangeError');
if (!validRanges.includes(range)) {
errorElement.textContent = 'Range must be a factor of 3003 (3, 7, 11, or 13)';
} else {
errorElement.textContent = '';
}
});
</script>
</body>
</html>