-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
380 lines (373 loc) · 12.7 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
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
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Revnet Simulator</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="help-bar"></div>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about.html">About</a></li>
<li><a href="https://t.me/revnet_eth">Community</a></li>
<li><a href="https://www.revnet.app/">Make a Revnet</a></li>
</ul>
</nav>
<div id="inputs">
<section>
<h2>Revnet</h2>
<label for="priceCeilingIncreaseFrequencyInDays"
>Price Ceiling – Increase Frequency (Days)</label
>
<input
type="number"
id="priceCeilingIncreaseFrequencyInDays"
value="1"
step="1"
min="0"
data-help="Increase Frequency: How long it takes for the price ceiling to increase. The price ceiling is the price to create new tokens."
/>
<label for="priceCeilingIncreasePercentage"
>Price Ceiling – Increase Percentage</label
>
<input
type="range"
id="priceCeilingIncreasePercentage"
value="0.02"
step="0.002"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="Increase Percentage: How much the price ceiling increases. The price ceiling is the price to create new tokens."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">2.0%</span>
<span class="max-value">100%</span>
</div>
<label for="priceFloorTaxIntensity">Price Floor – Tax Intensity</label>
<input
type="range"
id="priceFloorTaxIntensity"
value="0.33"
step="0.005"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="Tax Intensity: How much ETH stays in the revnet when people destroy their tokens to get back ETH. Higher taxes keep more ETH in the revnet."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">33.0%</span>
<span class="max-value">100%</span>
</div>
<label for="boostPercent">Boost – Percent</label>
<input
type="range"
id="boostPercent"
value="0.1"
step="0.005"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="Percent: The percentage of purchased tokens to send to the boost operator."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">10.0%</span>
<span class="max-value">100%</span>
</div>
<label for="boostDurationInDays">Boost – Duration (Days)</label>
<input
type="number"
id="boostDurationInDays"
value="30"
min="0"
step="1"
data-help="Duration: How long the boost lasts."
/>
<label for="premintAmount">Boost – Premint Amount</label>
<input
type="number"
id="premintAmount"
value="5"
min="0"
data-help="Premint Amount: How many tokens to pre-mint to the boost operator."
/>
</section>
<section>
<h2>Liquidity Pool</h2>
<label for="dayDeployed">Deploy Day</label>
<input
type="number"
id="dayDeployed"
min="0"
step="1"
value="0"
data-help="Deploy Day: The day the liquidity pool is deployed. Before this day, token purchases and sales go through the revnet."
/>
<label for="eth">Initial ETH in Pool</label>
<input
type="number"
id="eth"
value="0"
min="0"
data-help="Initial ETH in Pool: The amount of ETH the liquidity pool starts out with."
/>
<label for="revnetToken">Initial Tokens in Pool</label>
<input
type="number"
id="revnetToken"
value="0"
min="0"
data-help="Initial Tokens in Pool: The number of tokens the liquidity pool starts out with."
/>
<label for="revnetTokenLiquidityRatio">Token Liquidity Ratio</label>
<input
type="range"
id="revnetTokenLiquidityRatio"
value="0.1"
step="0.005"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="Token Liquidity Ratio: The percentage of tokens people provide to the liquidity pool after purchasing them."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">10.0%</span>
<span class="max-value">100%</span>
</div>
<label for="ethLiquidityRatio">ETH Liquidity Ratio</label>
<input
type="range"
id="ethLiquidityRatio"
value="0.1"
step="0.005"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="ETH Liquidity Ratio: The percentage of ETH people provide to the liquidity pool after selling their tokens."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">10.0%</span>
<span class="max-value">100%</span>
</div>
<label for="fee">Fee</label>
<input
type="range"
id="fee"
value="0.01"
step="0.001"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="Fee: The fee taken on trades in the liquidity pool. Fees go to liquidity providers. Fees are typically 0.05%, 0.30%, or 1%."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">1.0%</span>
<span class="max-value">100%</span>
</div>
</section>
<section>
<h2>Simulation</h2>
<label for="daysToCalculate">Simulation Length (Days)</label>
<input
type="number"
id="daysToCalculate"
value="100"
min="0"
step="1"
data-help="Simulation Length: The number of days to simulate."
/>
<label for="randomnessSeed">Seed</label>
<input
type="number"
id="randomnessSeed"
value="1"
min="1"
data-help="Seed: A seed for the random number generators used for token purchases and sales."
/>
<label for="dailyPurchasesLambda">Average Purchases Per Day</label>
<input
type="number"
id="dailyPurchasesLambda"
value="5"
min="0"
step="1"
data-help="Average Purchases Per Day: The typical number of purchases per day. This is a lambda of a poisson function."
/>
<label for="purchaseAmountMean">Purchase Size Mean</label>
<input
type="number"
id="purchaseAmountMean"
value="0"
data-help="Purchase Size Mean: The lognorm mean purchase size. This is the mu of a lognorm distribution."
/>
<label for="purchaseAmountDeviation">Purchase Size Deviation</label>
<input
type="number"
id="purchaseAmountDeviation"
value="1.5"
step="0.1"
data-help="Purchase Size Deviation: The lognorm deviation of purchase sizes. This is the sigma of a lognorm distribution."
/>
<label for="minimumDaysHeld">Minimum Days to Hold Tokens</label>
<input
type="number"
id="minimumDaysHeld"
value="10"
min="0"
step="1"
data-help="Minimum Days to Hold Tokens: The minimum number of days a trader must hold their tokens before selling them."
/>
<label for="saleProbability">Daily Sale Probability</label>
<input
type="range"
id="saleProbability"
value="0.01"
step="0.01"
min="0"
max="1"
oninput="updateSliderPercent(this)"
data-help="Daily Sale Probability: The likelihood any given trader will sell their tokens in a day."
/>
<div class="slider-values">
<span class="min-value">0%</span>
<span class="current-value">1.0%</span>
<span class="max-value">100%</span>
</div>
</section>
<section>
<h2>Miscellaneous</h2>
<button
onclick="resetInputs()"
data-help="Reset All Inputs: Set all settings to their default values."
>
Reset All Inputs
</button>
<button
onclick="exportSettings()"
data-help="Export Settings: Download a .json file containing the current simulation settings."
>
Export Settings
</button>
<button
onclick="importSettings()"
data-help="Apply Settings: Apply the settings from a .json file uploaded below."
>
Apply Settings (Upload Below)
</button>
<input
type="file"
id="settingsUpload"
accept=".json"
data-help="Upload a settings .json file here."
/>
</section>
</div>
<div id="dashboard"></div>
<script>
function updateSliderPercent(slider) {
const currentValueSpan =
slider.nextElementSibling.querySelector(".current-value");
currentValueSpan.textContent = `${(slider.value * 100).toFixed(1)}%`;
}
const renderEvent = new CustomEvent("render", {
bubbles: true,
});
function resetInputs() {
const inputs = document.querySelectorAll("input");
inputs.forEach((i) => {
i.value = i.defaultValue;
if (i.type === "range") updateSliderPercent(i);
});
document.dispatchEvent(renderEvent);
}
const helpTextElements = document.querySelectorAll("[data-help]");
const helpBar = document.getElementById("help-bar");
helpTextElements.forEach((e) => {
e.addEventListener("mouseenter", function (event) {
helpBar.textContent = event.target.getAttribute("data-help");
helpBar.style.display = "block";
});
e.addEventListener("mouseleave", function () {
helpBar.style.display = "none";
});
});
function exportSettings() {
const ids = [
"priceCeilingIncreasePercentage",
"priceCeilingIncreaseFrequencyInDays",
"priceFloorTaxIntensity",
"premintAmount",
"boostPercent",
"boostDurationInDays",
"eth",
"revnetToken",
"dayDeployed",
"fee",
"daysToCalculate",
"randomnessSeed",
"dailyPurchasesLambda",
"purchaseAmountMean",
"purchaseAmountDeviation",
"revnetTokenLiquidityRatio",
"ethLiquidityRatio",
"saleProbability",
"minimumDaysHeld",
];
const jsonString = JSON.stringify(
ids.reduce((obj, id) => {
obj[id] = Number(document.getElementById(id).value);
return obj;
}, {}),
null,
4
);
const blob = new Blob([jsonString], { type: "application/json" });
const url = URL.createObjectURL(blob);
const downloadElem = document.createElement("a");
downloadElem.href = url;
downloadElem.download = "revnet.json";
document.body.appendChild(downloadElem);
downloadElem.click();
document.body.removeChild(downloadElem);
}
function importSettings() {
const fileInput = document.getElementById("settingsUpload");
const file = fileInput.files[0];
if (!file) {
alert('Upload a .json file by clicking "Choose File"');
return;
}
const reader = new FileReader();
reader.onload = function (event) {
try {
const data = JSON.parse(event.target.result);
for (let key in data) {
let input = document.getElementById(key);
if (input && input.tagName === "INPUT") {
input.value = data[key];
if (input.type === "range") updateSliderPercent(input);
}
}
document.dispatchEvent(renderEvent);
} catch (e) {
alert(`Could not parse JSON: ${e}`);
}
};
reader.onerror = function () {
alert("Error reading the file.");
};
reader.readAsText(file);
}
</script>
<script type="module" src="/main.js"></script>
</body>
</html>