-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1472 lines (1261 loc) · 79.6 KB
/
index.html
File metadata and controls
1472 lines (1261 loc) · 79.6 KB
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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<title>Thena Strategy</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="description" content="Every trade buys veTHE. veTHE rewards buy and burn theSTRAT. Built on Thena.">
<meta property="og:title" content="Thena Strategy">
<meta property="og:description" content="Every trade buys veTHE. veTHE rewards buy and burn theSTRAT. Built on Thena.">
<meta property="og:image" content="https://eliteness.network/tasty/thenastrat_banner_1.png">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Thena Strategy">
<meta name="twitter:description" content="Every trade buys veTHE. veTHE rewards buy and burn THESTRAT. Built on Thena.">
<meta name="twitter:image" content="https://eliteness.network/tasty/thenastrat_banner_1.png">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ethers/6.13.2/ethers.umd.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;700;800&family=Courier+Prime:wght@400;700&display=swap" rel="stylesheet">
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
display: ['Outfit', 'sans-serif'],
mono: ['Courier Prime', 'monospace'],
},
colors: {
brand: {
bg: '#05010a',
card: '#12081f',
border: '#2d1b4e',
primary: '#8E24AA',
secondary: '#AB47BC',
accent: '#d946ef',
},
success: '#00E676',
danger: '#FF1744',
},
animation: {
'fade-in-up': 'fadeInUp 0.5s ease-out forwards',
'pulse-glow': 'pulseGlow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
},
keyframes: {
fadeInUp: {
'0%': { opacity: '0', transform: 'translateY(20px)' },
'100%': { opacity: '1', transform: 'translateY(0)' },
},
pulseGlow: {
'0%, 100%': { opacity: '1' },
'50%': { opacity: '.5' }
}
}
}
}
}
</script>
<style>
body {
background-color: #05010a;
background-image:
radial-gradient(circle at 0% 0%, rgba(142, 36, 170, 0.1), transparent 40%),
radial-gradient(circle at 100% 100%, rgba(217, 70, 239, 0.05), transparent 40%);
background-attachment: fixed;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.glass-panel {
background: rgba(18, 8, 31, 0.6);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}
.input-box {
background: #0a0510;
border: 1px solid transparent;
transition: all 0.3s ease;
}
.input-box:focus-within {
background: #0f0518;
border-color: #8E24AA;
}
.settings-container {
max-height: 0;
opacity: 0;
overflow: hidden;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
margin-bottom: 0;
}
.settings-container.open {
max-height: 120px;
opacity: 1;
margin-bottom: 1rem;
padding: 1rem;
border-width: 1px;
}
.rotate-gear {
transition: transform 0.4s ease;
}
.rotate-gear.active {
transform: rotate(90deg);
}
.route-path-container {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
}
.route-line-bg {
position: absolute;
left: 20px; right: 20px; top: 50%;
height: 2px;
background: #2d1b4e;
z-index: 0;
}
.route-line-active {
position: absolute;
left: 20px; right: 20px; top: 50%;
height: 2px;
background: linear-gradient(90deg, #8E24AA, #d946ef);
box-shadow: 0 0 10px rgba(217, 70, 239, 0.5);
z-index: 0;
opacity: 0.8;
}
.route-dot {
position: relative;
z-index: 10;
background: #12081f;
border: 1px solid #8E24AA;
border-radius: 50%;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 15px rgba(142, 36, 170, 0.3);
}
.route-pill {
position: relative;
z-index: 10;
background: #05010a;
border: 1px solid #373a45;
padding: 4px 10px;
border-radius: 20px;
font-size: 10px;
font-weight: 700;
color: #d946ef;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #05010a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar {
width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: rgba(142, 36, 170, 0.3);
border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: rgba(142, 36, 170, 0.6);
}
</style>
</head>
<body class="text-white antialiased min-h-screen flex flex-col relative overflow-x-hidden selection:bg-brand-primary selection:text-white">
<header class="sticky top-0 z-50 w-full border-b border-white/5 bg-[#05010a]/90 backdrop-blur-xl">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-20 flex items-center justify-between">
<div class="flex items-center gap-2 sm:gap-3">
<img src="thenastrat_token_logo_white_gradient.png" alt="Icon" class="h-8 w-8 sm:h-10 sm:w-10">
<span class="font-display font-bold text-lg sm:text-2xl tracking-tight bg-gradient-to-r from-white to-purple-200 bg-clip-text text-transparent">
Thena Strategy
</span>
</div>
<button id="connectBtn" onclick="connectWallet()"
class="px-4 py-2 sm:px-6 sm:py-2.5 bg-gradient-to-r from-brand-primary to-brand-secondary rounded-xl font-bold text-xs sm:text-sm shadow-lg shadow-purple-900/20 hover:scale-105 hover:shadow-purple-900/40 transition-all duration-300 whitespace-nowrap">
CONNECT WALLET
</button>
</div>
</header>
<main class="w-full px-4 sm:px-6 lg:px-8 py-6 sm:py-8 relative z-10">
<div class="flex justify-center mb-8 sm:mb-12">
<div class="flex p-1 bg-white/5 border border-white/5 rounded-full backdrop-blur-md relative">
<button onclick="switchTab('swap')" id="tab-swap" class="relative px-6 sm:px-10 py-2 sm:py-2.5 rounded-full text-xs sm:text-sm font-display font-bold transition-all duration-300 overflow-hidden bg-brand-primary text-white shadow-lg z-10">
Swap
</button>
<button onclick="switchTab('dashboard')" id="tab-dashboard" class="relative px-6 sm:px-10 py-2 sm:py-2.5 rounded-full text-xs sm:text-sm font-display font-bold transition-all duration-300 text-gray-400 hover:text-white z-10">
Dashboard
</button>
</div>
</div>
<div class="relative w-full max-w-7xl mx-auto">
<div id="swap-view" class="relative transition-all duration-500 ease-[cubic-bezier(0.4,0,0.2,1)] opacity-100 translate-x-0 scale-100 z-10 origin-top">
<div class="flex flex-col lg:flex-row justify-center items-start gap-7 mx-auto">
<div class="w-full lg:w-[460px] flex flex-col gap-7">
<div class="glass-panel rounded-[24px] p-4 sm:p-5 relative">
<div class="flex justify-between items-center mb-4 sm:mb-5">
<h2 class="text-lg sm:text-xl font-display font-bold text-white">Swap</h2>
<button onclick="toggleSettings()" class="text-gray-400 hover:text-white transition-colors">
<svg id="settingsGear" class="w-5 h-5 rotate-gear" fill="none" stroke="currentColor" viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"></circle><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
</button>
</div>
<div id="settingsPanel" class="settings-container bg-black/40 rounded-xl border-white/5 border-0">
<label class="text-[10px] text-gray-400 font-medium mb-2 block uppercase tracking-wide">Slippage Tolerance</label>
<div class="flex gap-2">
<button class="slip-option flex-1 py-2 rounded-lg text-xs font-bold border border-brand-border hover:bg-brand-primary/20 transition-colors" onclick="setSlip(12.0)">12%</button>
<button class="slip-option flex-1 py-2 rounded-lg text-xs font-bold border border-brand-border hover:bg-brand-primary/20 transition-colors" onclick="setSlip(13.0)">13%</button>
<input type="number" id="customSlip" placeholder="Custom %" class="flex-1 bg-transparent border border-brand-border rounded-lg text-center text-xs text-white focus:outline-none focus:border-brand-secondary transition-colors" oninput="setCustomSlip()">
</div>
</div>
<div class="input-box rounded-2xl p-3.5 mb-1 relative group">
<div class="flex justify-between mb-2 text-xs">
<span class="text-gray-400 font-medium ml-1">Sell</span>
<span class="text-gray-400">Bal: <span id="sBal" class="text-white font-mono">0.00</span> <span onclick="setMax()" class="cursor-pointer text-brand-accent hover:text-white ml-2 font-bold transition-colors">MAX</span></span>
</div>
<div class="flex items-center gap-3">
<div class="flex-shrink-0 flex items-center gap-2 bg-white/5 px-3 py-1.5 rounded-full border border-white/5 hover:bg-white/10 transition-colors cursor-pointer">
<img src="fBOMB_token_whiteblue_blackcircle.png" id="sIcon" class="w-5 h-5 sm:w-6 sm:h-6 rounded-full">
<span id="sSym" class="font-display font-bold text-sm sm:text-base">fBOMB</span>
</div>
<button id="helpBtnSell" onclick="toggleAds()" class="sm:hidden flex items-center justify-center w-5 h-5 rounded-full bg-brand-primary/20 border border-brand-primary text-brand-secondary text-xs font-bold hover:bg-brand-primary hover:text-white transition-colors animate-pulse-glow" style="display: none;">
?
</button>
<input type="number" id="inpAmt" placeholder="0" oninput="calc()" class="flex-1 w-0 bg-transparent text-right font-display text-2xl sm:text-3xl font-bold placeholder-gray-700 focus:outline-none">
</div>
<div class="text-right text-[11px] text-gray-500 mt-2 font-mono pr-1" id="sUsd">$0.00</div>
</div>
<div class="relative h-2 flex items-center justify-center z-10">
<button id="swapArrowBtn" onclick="toggleSwap()" class="absolute bg-[#12081f] border border-[#2d1b4e] p-2 rounded-lg text-brand-primary hover:text-white hover:bg-brand-primary hover:border-brand-primary transition-all duration-300 shadow-xl">
<svg class="w-5 h-5" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path d="M12 5v14M5 12l7 7 7-7"/></svg>
</button>
</div>
<div class="input-box rounded-2xl p-3.5 mt-1">
<div class="flex justify-between mb-2 text-xs">
<span class="text-gray-400 font-medium ml-1">Buy</span>
<span class="text-gray-400">Bal: <span id="bBal" class="text-white font-mono">0.00</span></span>
</div>
<div class="flex items-center gap-3">
<div class="flex-shrink-0 flex items-center gap-2 bg-white/5 px-3 py-1.5 rounded-full border border-white/5 hover:bg-white/10 transition-colors cursor-pointer">
<img src="thenastrat_token_logo_white_gradient.png" id="bIcon" class="w-5 h-5 sm:w-6 sm:h-6 rounded-full">
<span id="bSym" class="font-display font-bold text-sm sm:text-base">theSTRAT</span>
</div>
<button id="helpBtnBuy" onclick="toggleAds()" class="sm:hidden flex items-center justify-center w-5 h-5 rounded-full bg-brand-primary/20 border border-brand-primary text-brand-secondary text-xs font-bold hover:bg-brand-primary hover:text-white transition-colors animate-pulse-glow" style="display: none;">
?
</button>
<input type="text" id="outAmt" placeholder="0" readonly class="flex-1 w-0 bg-transparent text-right font-display text-2xl sm:text-3xl font-bold placeholder-gray-700 focus:outline-none cursor-default">
</div>
<div class="text-right text-[11px] text-gray-500 mt-2 font-mono pr-1" id="bUsd">$0.00</div>
</div>
<div class="mt-6 space-y-2 px-2">
<div class="flex justify-between text-xs font-medium">
<span class="text-gray-500">Transfer Tax</span>
<span class="text-brand-accent font-bold">10%</span>
</div>
<div class="flex justify-between text-xs font-medium">
<span class="text-gray-500">Rate</span>
<span id="rateTxt" class="text-white">---</span>
</div>
<div class="flex justify-between text-xs font-medium">
<span class="text-gray-500">Minimum Output</span>
<span id="quoteTxt" class="text-white">---</span>
</div>
</div>
<button id="mainActionBtn" class="w-full mt-6 py-3.5 sm:py-4 bg-brand-primary hover:bg-brand-secondary rounded-xl font-display font-bold text-base sm:text-lg text-white shadow-lg shadow-brand-primary/30 hover:shadow-brand-primary/50 hover:translate-y-[-2px] active:translate-y-[0px] transition-all disabled:opacity-50 disabled:cursor-not-allowed">
CONNECT WALLET
</button>
</div>
</div>
<div class="w-full lg:w-[500px] flex flex-col gap-7">
<div class="glass-panel rounded-[24px] p-5 sm:p-6 h-full flex flex-col justify-between">
<div>
<div class="mb-6">
<h3 class="text-gray-400 font-display font-bold text-base sm:text-lg mb-1 tracking-wide">
<span id="cardPair">theSTRAT / fBOMB<span>
<span id="cardChange" class="mb-1 px-2 py-0.5 rounded text-xs font-bold bg-danger/10 text-danger border border-danger/20">-0.00%</span>
</h3>
<div class="flex items-end gap-3">
<div id="cardPrice" class="text-4xl sm:text-5xl font-display font-extrabold text-white tracking-tight leading-none">
$-.--
</div>
</div>
<div class="flex items-end gap-1">
<div id="cardPriceInTokens" class="text-xl sm:text-xl font-display font-extrabold text-white tracking-tight leading-none">
-.-- fBOMB
</div>
</div>
</div>
<div class="grid grid-cols-2 gap-3 sm:gap-4 mb-6">
<div class="bg-black/30 p-3 sm:p-4 rounded-2xl border border-white/5">
<div class="text-[10px] uppercase tracking-wider text-gray-500 font-bold mb-1">Market Cap</div>
<div id="cardFdv" class="text-lg sm:text-xl font-display font-bold text-white">$0</div>
</div>
<div class="bg-black/30 p-3 sm:p-4 rounded-2xl border border-white/5">
<div class="text-[10px] uppercase tracking-wider text-gray-500 font-bold mb-1">Liquidity</div>
<div id="cardLiq" class="text-lg sm:text-xl font-display font-bold text-white">$0</div>
</div>
</div>
<div class="bg-[#0a0510] border border-white/5 rounded-2xl p-4 sm:p-5 mb-4">
<div class="flex items-center justify-between mb-4">
<div class="text-[10px] uppercase tracking-widest text-gray-400 font-bold">Pool Composition</div>
<div id="poolDonut" class="w-8 h-8 rounded-full" style="background: conic-gradient(#8E24AA 0% 50%, #ffffff 50% 100%); box-shadow: 0 0 15px rgba(142,36,170,0.3);">
<div class="w-5 h-5 bg-[#0a0510] rounded-full absolute top-1.5 left-1.5"></div>
</div>
</div>
<div class="flex flex-col gap-3">
<div class="bg-[#0a0510] rounded-xl p-3 border border-white/5 flex flex-col gap-2">
<div class="flex justify-between items-center">
<div class="flex items-center gap-2">
<img src="thenastrat_token_logo_white_gradient.png" class="w-5 h-5">
<span class="text-xs font-bold text-gray-300">theSTRAT</span>
</div>
<span id="cVal1" class="font-mono text-xs text-white font-bold">---</span>
</div>
<div class="h-1 bg-gray-800 rounded-full overflow-hidden">
<div id="bar1" class="h-full bg-brand-primary w-[50%] transition-all duration-500 shadow-[0_0_8px_#8E24AA]"></div>
</div>
</div>
<div class="bg-[#0a0510] rounded-xl p-3 border border-white/5 flex flex-col gap-2">
<div class="flex justify-between items-center">
<div class="flex items-center gap-2">
<img src="fBOMB_token_whiteblue_blackcircle.png" class="w-5 h-5">
<span class="text-xs font-bold text-gray-300">fBOMB</span>
</div>
<span id="cVal2" class="font-mono text-xs text-white font-bold">---</span>
</div>
<div class="h-1 bg-gray-800 rounded-full overflow-hidden">
<div id="bar2" class="h-full bg-white w-[50%] transition-all duration-500 shadow-[0_0_8px_white]"></div>
</div>
</div>
</div>
</div>
</div>
<div class="w-full bg-[#0a0510] border border-white/10 rounded-2xl p-4 mt-auto relative overflow-visible">
<div class="absolute -top-2.5 left-5 bg-[#0a0510] px-2 text-[9px] text-gray-500 font-bold uppercase tracking-widest z-20 border border-white/5 rounded-full">Smart Route</div>
<div class="route-path-container h-8 mt-1">
<div class="route-line-bg"></div>
<div class="route-line-active animate-pulse-glow"></div>
<div class="route-dot w-7 h-7">
<img src="thenastrat_token_logo_white_gradient.png" class="w-3.5 h-3.5 rounded-full">
</div>
<div class="route-pill shadow-[0_0_10px_rgba(217,70,239,0.3)] text-[9px] py-1 px-3">
THENA
</div>
<div class="route-dot w-7 h-7" style="border-color: #d946ef; box-shadow: 0 0 15px rgba(217, 70, 239, 0.3);">
<img src="fBOMB_token_whiteblue_blackcircle.png" class="w-3.5 h-3.5 rounded-full">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="dashboard-view" class="hidden absolute inset-0 transition-all duration-500 ease-[cubic-bezier(0.4,0,0.2,1)] opacity-0 translate-x-[20px] scale-95 pointer-events-none z-0">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 h-full pb-8">
<div class="lg:col-span-2 flex flex-col gap-6">
<div class="glass-panel rounded-[24px] p-4 sm:p-6 min-h-[350px] lg:min-h-[450px] relative flex flex-col">
<div class="flex justify-between items-start mb-4">
<div>
<h2 class="font-display font-bold text-base sm:text-lg text-white">Price Performance</h2>
<span class="text-xs text-gray-500">Last 30 Days</span>
</div>
<div class="text-right">
<div id="dashPriceVal" class="text-xl sm:text-2xl font-bold font-display">$0.00</div>
<div id="dashPriceChg" class="text-sm text-danger font-medium">-0.00%</div>
</div>
</div>
<div class="flex-grow w-full relative min-h-[450px] mt-2 rounded-xl overflow-hidden border border-white/5">
<iframe
src="https://dexscreener.com/bsc/0x3d63abc40402d0f7291917A85E0E4c46Fb1A37b4?embed=1&theme=dark&trades=0&info=0&interval=30D"e=fBOMB"
style="position:absolute;width:100%;height:100%;top:0;left:0;border:0;"
></iframe>
</div>
</div>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="bg-brand-card border border-white/5 p-4 rounded-xl hover:bg-white/5 transition-colors">
<div class="text-[10px] uppercase tracking-wider text-gray-500 font-bold mb-1">Market Cap</div>
<div id="barMC" class="text-white font-bold font-display text-sm sm:text-base">---</div>
</div>
<div class="bg-brand-card border border-white/5 p-4 rounded-xl hover:bg-white/5 transition-colors">
<div class="text-[10px] uppercase tracking-wider text-gray-500 font-bold mb-1">Volume (24h)</div>
<div id="barVol" class="text-white font-bold font-display text-sm sm:text-base">---</div>
</div>
<div class="bg-brand-card border border-white/5 p-4 rounded-xl hover:bg-white/5 transition-colors">
<div class="text-[10px] uppercase tracking-wider text-gray-500 font-bold mb-1">Burned</div>
<div id="barBurn" class="text-white font-bold font-display text-sm sm:text-base">---</div>
</div>
<div class="bg-brand-card border border-white/5 p-4 rounded-xl hover:bg-white/5 transition-colors">
<div class="text-[10px] uppercase tracking-wider text-gray-500 font-bold mb-1">Change</div>
<div id="barChg" class="text-white font-bold font-display text-sm sm:text-base">---</div>
</div>
</div>
</div>
<div class="flex flex-col gap-6">
<div class="bg-gradient-to-br from-brand-card to-[#2e1045] border border-brand-primary/30 rounded-[24px] p-5 sm:p-6 relative overflow-hidden group">
<div class="absolute top-[-50%] right-[-50%] w-64 h-64 bg-brand-accent/20 rounded-full blur-3xl group-hover:bg-brand-accent/30 transition-all duration-700"></div>
<div class="relative z-10">
<div class="text-[10px] uppercase tracking-widest text-gray-400 font-bold mb-2">Protocol Treasury</div>
<div id="repTotalValue" class="text-3xl sm:text-4xl font-display font-extrabold text-success mb-1 drop-shadow-lg">$0.00</div>
<div class="text-xs text-brand-secondary mb-6 font-medium">Estimated Intrinsic Value</div>
<div class="border-t border-white/10 pt-4 space-y-3">
<div id="rowFbombLp" class="flex justify-between items-center text-sm hidden">
<span class="text-gray-400">fBOMB (in LP)</span>
<span id="repFbombLp" class="font-mono font-bold text-white">0</span>
</div>
<div id="rowEthenaHeld" class="flex justify-between items-center text-sm hidden">
<span class="text-gray-400">eTHENA (Held)</span>
<span id="repEthenaHeld" class="font-mono font-bold text-white">0</span>
</div>
<div id="rowEthenaStaked" class="flex justify-between items-center text-sm hidden">
<span class="text-gray-400">eTHENA (Staked)</span>
<span id="repEthenaStaked" class="font-mono font-bold text-white">0</span>
</div>
<div id="rowStakeThe" class="flex justify-between items-center text-sm hidden">
<span class="text-gray-400">stakeTHENA</span>
<span id="repStakeThe" class="font-mono font-bold text-white">0</span>
</div>
<div id="rowVeThe" class="flex justify-between items-center text-sm hidden">
<span class="text-gray-400">veTHE</span>
<span id="repVeThe" class="font-mono font-bold text-white">0</span>
</div>
</div>
</div>
</div>
<div class="glass-panel rounded-[24px] p-5 sm:p-6">
<div class="flex justify-between items-center mb-4">
<span class="text-[10px] uppercase tracking-widest text-gray-400 font-bold">User Holdings</span>
<span id="statusBadge" class="text-[10px] px-2 py-0.5 rounded bg-white/5 text-gray-400 font-medium border border-white/10">Not Connected</span>
</div>
<div class="bg-black/30 p-1 rounded-lg flex gap-1 mb-4">
<button id="tabWallet" onclick="setQueryMode(false)" class="flex-1 py-1.5 text-xs font-semibold rounded-md bg-brand-primary text-white shadow-sm transition-all">My Wallet</button>
<button id="tabQuery" onclick="setQueryMode(true)" class="flex-1 py-1.5 text-xs font-semibold rounded-md text-gray-400 hover:text-white hover:bg-white/5 transition-all">Query Mode</button>
</div>
<div id="queryWrap" class="relative mb-4 hidden animate-fade-in-up">
<svg class="absolute left-3 top-3 w-4 h-4 text-gray-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
<input type="text" id="queryInput" placeholder="Search 0xAddress..." oninput="handleQuery()" class="w-full bg-black/40 border border-white/10 rounded-lg py-2.5 pl-10 pr-3 text-xs font-mono text-white focus:border-brand-secondary focus:outline-none transition-colors">
</div>
<div class="flex flex-col gap-6 my-4">
<div class="flex flex-col items-center justify-center">
<div class="text-[10px] uppercase tracking-widest text-gray-500 font-bold mb-1">theSTRAT Balance</div>
<div class="flex items-center gap-3">
<span id="userWallet" class="text-4xl font-display font-bold text-white tracking-tight drop-shadow-[0_0_15px_rgba(142,36,170,0.5)]">0.00</span>
<div class="flex items-center gap-1.5 bg-white/5 border border-white/10 px-2 py-1 rounded-lg">
<img src="thenastrat_token_logo_white_gradient.png" class="w-5 h-5 rounded-full">
<span class="text-[10px] font-bold text-brand-secondary">theSTRAT</span>
</div>
</div>
<div id="userWalletUsd" class="text-sm font-mono text-gray-400 mt-2">$0.00 USD</div>
</div>
<div class="w-2/3 mx-auto h-px bg-gradient-to-r from-transparent via-white/10 to-transparent"></div>
</div>
<button onclick="copyAddress()" class="w-full mt-2 flex items-center justify-between px-4 py-3 bg-white/5 border border-dashed border-white/20 rounded-xl hover:bg-brand-primary/20 hover:border-brand-primary/50 hover:text-white text-gray-400 transition-all group">
<span id="userAddrDisplay" class="font-mono text-xs">0x...</span>
<svg class="w-3.5 h-3.5 group-hover:scale-110 transition-transform" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
</button>
</div>
<div class="glass-panel rounded-[24px] p-5 sm:p-6 mt-6 flex flex-col h-[500px]">
<div class="flex justify-between items-center mb-4">
<div>
<span class="text-[10px] uppercase tracking-widest text-gray-400 font-bold">Trade History</span>
<div class="text-[9px] text-brand-secondary">Showing All Records</div>
</div>
<span id="txCountBadge" class="text-[10px] px-2 py-0.5 rounded bg-success/10 text-success font-bold border border-success/20">0 Trades</span>
</div>
<div id="txHistoryList" class="flex-grow overflow-y-auto space-y-3 pr-2 custom-scrollbar">
<div class="text-center py-20 text-gray-600 text-xs italic">Connect wallet to view history</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<footer class="relative z-10 mt-auto py-12 border-t border-white/5 bg-[#05010a]">
<div class="flex justify-center gap-8 mb-8">
<a href="https://x.com/ThenaStrategy" class="text-gray-500 hover:text-brand-accent hover:-translate-y-1 transition-all"><svg class="w-6 h-6 fill-current" viewBox="0 0 24 24"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg></a>
<a href="https://thenastrategy.gitbook.io/thena-strategy/" class="text-gray-500 hover:text-brand-accent hover:-translate-y-1 transition-all"><svg class="w-6 h-6 fill-current" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg></a>
<a href="https://t.me/ThenaStrategy" class="text-gray-500 hover:text-brand-accent hover:-translate-y-1 transition-all"><svg class="w-6 h-6 fill-current" viewBox="0 0 24 24"><path d="M21.93 3.53c-.36-.45-1.03-.54-1.55-.34L3.43 10.15c-.68.27-.69 1.14-.02 1.41l4.5 1.77 1.48 4.79c.14.47.74.55 1.01.16l2.12-3.08 4.4 3.39c.5.39 1.25.13 1.38-.5l2.67-13.5c.09-.46-.39-.92-.94-1.06zm-4.32 2.62l-7.6 6.8-.75-3.3 8.35-3.5z"/></svg></a>
</div>
<div class="flex justify-center items-center gap-2 text-xs text-gray-500 opacity-80 mt-4 mb-4">
<span class="font-bold tracking-wide text-xs sm:text-xs">Powered by</span>
</div>
<div class="flex justify-center items-center gap-2 text-l text-gray-500 opacity-80">
<img onclick="window.open('https://mclb.org')" src="mclb.svg" alt="Thena" class="w-4 h-4 hover:scale-110 transition-transform">
<span onclick="window.open('https://mclb.org')" class="font-bold tracking-wide">Millennium Club</span>
<img onclick="window.open('https://thena.fi')" src="https://thena.fi/favicon/apple-touch-icon.png" alt="Thena" class="w-4 h-4 hover:scale-110 transition-transform">
<span onclick="window.open('https://thena.fi')" class="font-bold tracking-wide">THENA.fi</span>
<img onclick="window.open('https://eliteness.network')" src="https://ftm.guru/icons/eliteness.png" alt="Thena" class="w-4 h-4 hover:scale-110 transition-transform">
<span onclick="window.open('https://eliteness.network')" class="font-bold tracking-wide">Eliteness Network</span>
</div>
</footer>
<div id="toastContainer" class="fixed top-24 right-5 z-[100] flex flex-col gap-3 pointer-events-none max-w-sm w-full"></div>
<div id="swapModal" class="fixed inset-0 z-[999] bg-black/80 backdrop-blur-sm hidden flex justify-center items-center opacity-0 transition-opacity duration-300">
<div class="bg-[#1a0b2e] border border-brand-primary w-[90%] max-w-sm p-8 rounded-3xl text-center shadow-[0_0_50px_rgba(142,36,170,0.3)] transform scale-95 transition-transform duration-300 relative">
<div id="modalSpinner" class="w-12 h-12 border-4 border-white/10 border-t-brand-primary rounded-full animate-spin mx-auto mb-6"></div>
<svg id="modalSuccess" class="hidden w-16 h-16 text-success mx-auto mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
<svg id="modalError" class="hidden w-16 h-16 text-danger mx-auto mb-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>
<div class="text-xl font-display font-bold text-white mb-2" id="modalTitle">Processing...</div>
<div class="text-sm text-gray-400 mb-6" id="modalDesc">Please confirm transaction in your wallet</div>
<button id="modalCloseBtn" class="hidden bg-white/5 border border-white/10 text-white px-6 py-2 rounded-lg hover:bg-white/10 transition-colors" onclick="hideModal()">Close</button>
</div>
</div>
<div id="leftAdBox" class="hidden sm:block fixed bottom-5 left-5 w-64 bg-brand-card/95 backdrop-blur-xl border border-brand-primary/20 rounded-2xl p-4 shadow-[0_0_30px_rgba(0,0,0,0.5)] z-50 transition-all hover:-translate-y-1">
<button class="absolute top-2 right-2 text-gray-500 hover:text-white text-xs" onclick="toggleAds()">✕</button>
<div class="flex gap-3 items-center mb-3">
<img src="fBOMB_token_whiteblue_blackcircle.png" class="w-10 h-10 rounded-full bg-white/10">
<div class="font-bold text-sm leading-tight text-white">Need<br>fBOMB?</div>
</div>
<div class="space-y-2">
<a href="https://thena.fi/swap?outputCurrency=0x74ccbe53F77b08632ce0CB91D3A545bF6B8E0979" target="_blank" class="block text-center text-[10px] font-bold bg-white/5 hover:bg-brand-primary text-white py-2 rounded-lg transition-colors">Buy on THENA</a>
<a href="https://mclb.org/bridge" target="_blank" class="block text-center text-[10px] font-bold bg-white/5 hover:bg-brand-secondary text-white py-2 rounded-lg transition-colors">Bridge from MCLB.org</a>
</div>
</div>
<div id="mobileInfoBtn" class="hidden" onclick="toggleAds()"></div>
<script>
let allTransactions = [];
async function loadTransactionsCSV() {
try {
const response = await fetch('pasttransactions.csv');
const csvText = await response.text();
const lines = csvText.trim().split('\n');
allTransactions = lines.slice(1).map(line => {
const values = line.split(',');
if (values.length < 8) return null;
return {
date: values[0], time: values[1], type: values[2],
usdVolume: values[3], tokenAmount: values[4], price: values[5],
maker: values[6].toLowerCase(), link: values[7]
};
}).filter(t => t !== null);
const localTrades = JSON.parse(localStorage.getItem('my_new_trades') || "[]");
allTransactions = [...localTrades, ...allTransactions];
console.log("Total Transactions Loaded:", allTransactions.length);
} catch (e) {
console.error("Error loading CSV:", e);
}
}
function displayUserHistory(address) {
const listContainer = document.getElementById('txHistoryList');
const badge = document.getElementById('txCountBadge');
if (!address) {
listContainer.innerHTML = `<div class="text-center py-20 text-gray-600 text-xs italic">Connect wallet to view history</div>`;
badge.innerText = "0 Trades";
return;
}
const userTrades = allTransactions.filter(t => t.maker === address.toLowerCase());
badge.innerText = `${userTrades.length} Trade${userTrades.length === 1 ? '' : 's'}`;
if (userTrades.length === 0) {
listContainer.innerHTML = `<div class="text-center py-20 text-gray-600 text-[11px]">No transactions found for this address.</div>`;
return;
}
userTrades.sort((a,b) => new Date(b.date + " " + b.time) - new Date(a.date + " " + a.time));
const currentPrice = pair && pair.priceUsd ? parseFloat(pair.priceUsd) : 0;
listContainer.innerHTML = userTrades.map(tx => {
const usdPrice = parseFloat(tx.price);
const totalUsd = parseFloat(tx.usdVolume);
const tokenAmt = parseFloat(tx.tokenAmount);
const isSell = tx.type.toLowerCase() === 'sell';
const typeColor = isSell ? 'text-danger' : 'text-success';
const typeBg = isSell ? 'bg-danger/10' : 'bg-success/10';
let currentValueHtml = '';
if (currentPrice > 0) {
const currentUsdValue = tokenAmt * currentPrice;
if (!isSell) {
const diff = currentUsdValue - totalUsd;
const pnlPercent = totalUsd > 0 ? (diff / totalUsd) * 100 : 0;
const pnlColor = diff >= 0 ? 'text-success' : 'text-danger';
const sign = diff >= 0 ? '+' : '';
currentValueHtml = `
<div class="flex justify-between items-center text-[10px] pt-1">
<span class="text-gray-400 font-medium text-[9px] uppercase tracking-tighter">Current Value</span>
<div class="text-right">
<span class="text-white font-bold">$${currentUsdValue.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})}</span>
<span class="${pnlColor} ml-1 font-bold text-[9px]">(${sign}${pnlPercent.toFixed(2)}%)</span>
</div>
</div>`;
} else {
currentValueHtml = `
<div class="flex justify-between items-center text-[10px] pt-1">
<span class="text-gray-400 font-medium text-[9px] uppercase tracking-tighter">Value (If Held)</span>
<span class="text-white font-bold">$${currentUsdValue.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})}</span>
</div>`;
}
}
return `
<div class="bg-black/40 border border-white/5 rounded-xl p-3 hover:border-brand-primary/40 transition-all group">
<div class="flex justify-between items-start mb-2">
<div class="flex flex-col">
<div class="flex items-center gap-2">
<span class="text-white text-[11px] font-bold">${tx.date}</span>
<span class="text-[9px] px-1.5 py-0.5 rounded ${typeBg} ${typeColor} font-bold uppercase">${tx.type}</span>
</div>
<span class="text-gray-500 text-[9px]">${tx.time}</span>
</div>
<a href="${tx.link}" target="_blank" class="text-brand-primary hover:text-white transition-colors">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</a>
</div>
<div class="space-y-1.5">
<div class="flex justify-between items-center text-[11px]">
<span class="text-gray-400">Execution Price</span>
<div class="text-right">
<div class="${typeColor} font-bold">$${usdPrice.toFixed(6)}</div>
</div>
</div>
<div class="flex justify-between text-[11px]">
<span class="text-gray-400">Amount</span>
<span class="text-white font-mono">${tokenAmt.toLocaleString()} theSTRAT</span>
</div>
<div class="flex justify-between items-center text-[10px] pt-2 mt-1 border-t border-white/5">
<span class="text-gray-500 font-medium text-[9px] uppercase tracking-tighter">${isSell ? 'Total Received' : 'Total Spent'}</span>
<span class="text-brand-secondary font-bold">$${totalUsd.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})} USD</span>
</div>
${currentValueHtml}
</div>
</div>
`;
}).join('');
}
const ADDR_ROUTER = "0xd4ae6eca985340dd434d38f470accce4dc78d109";
const ADDR_THESTRAT = "0x31fCA0083A2b0b99aB044EB21625ACC6Ed87e4fe";//"0x28da45415B602B69b97DE6CF6aA75458358e270c";//"0x0e5eb3a3c1cf4d46fDedAD88D481A284b0496B4C";
const ADDR_FBOMB = "0x74ccbe53F77b08632ce0CB91D3A545bF6B8E0979";
const ADDR_WBNB = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
const ADDR_TREASURY = "0x28aa4f9ffe21365473b64c161b566c3cdead0108";
const ADDR_MSIG = "0x5053776B2111809AA4b308F1F6417E65f8aABa1E";
const ADDR_GAUGE = "0xce6b9bae3c330e0455d1af0ae3996f496cdbf1f1";//ethena/wbnb gauge
const ADDR_LP_PAIR = "0x3d63abc40402d0f7291917A85E0E4c46Fb1A37b4";//"0x54d67ef39ad989debc4dd73f0f9115c651a5c994";//"0x7309c3e4c48327E24f6641625afb5e4636704b80";//"0x7245D36825acFE58dE64E1b4A5F6d95662628faA";
const ADDR_ETHENA = "0xafbe3b8b0939a5538DE32f7752A78e08C8492295";
const ADDR_THE = "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11";
const ADDR_VETHE = "0xfBBF371C9B0B994EebFcC977CEf603F7f31c070D";
const ADDR_STAKETHENA = "0x5b8ce6d591c914a56cb019b3decb63ede22708c8";
const ADDR_MANUAL_STAKE = "0x90cda9b619b124d321111fe240f8191a72e93297";
let VETHE_RATIO = 2.50;
const BSC_RPC = "https://bsc-dataseed.binance.org/";
const IMG_BOMB = "fBOMB_token_whiteblue_blackcircle.png";
const IMG_THESTRAT = "thenastrat_token_logo_white_gradient.png";
const MINIMAL_STRAT_ABI = ["function approve(address spender, uint256 amount) external returns (bool)","function allowance(address owner, address spender) external view returns (uint256)","function decimals() external view returns (uint8)","function balanceOf(address account) external view returns (uint256)","function totalSupply() external view returns (uint256)"];
const ROUTER_ABI = ["function getAmountsOut(uint amountIn, tuple(address from, address to, bool stable)[] memory routes) public view returns (uint[] memory amounts)","function swapExactTokensForTokensSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, tuple(address from, address to, bool stable)[] calldata routes, address to, uint deadline) external"];
const ERC20_ABI = ["function approve(address spender, uint256 amount) external returns (bool)","function allowance(address owner, address spender) external view returns (uint256)","function decimals() external view returns (uint8)","function balanceOf(address account) external view returns (uint256)"];
const STAKING_ABI = ["function balanceOf(address account) external view returns (uint256)","function earned(address account, address _rewardsToken) external view returns (uint256)","function totalSupply() external view returns (uint256)"];
const PAIR_ABI = [
"function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)",
"function totalSupply() external view returns (uint256)",
"function token0() external view returns (address)",
"function token1() external view returns (address)",
"function balanceOf(address account) external view returns (uint256)"
];
const STAKETHENA_VAULT_ABI = [
"function balanceOf(address account) external view returns (uint256)",
"function convertToAssets(uint256 shares) external view returns (uint256)"
];
const GAUGE_ABI = [
"function balanceOf(address account) external view returns (uint256)",
"function earned(address account, address _rewardsToken) external view returns (uint256)"
];
const VETHE_ABI = ["function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function locked(uint256 id) external view returns (int128 amount, uint256 end)","function balanceOf(address owner) external view returns (uint256)"];
let provider, signer, userAddr;
let pair = null;
let isBuy = true;
let slippage = 12.0;
let quoteTimeout = null;
let chartInstance = null;
let queryTimeout = null;
let isQueryMode = false;
function switchTab(t) {
const swapBtn = document.getElementById('tab-swap');
const dashBtn = document.getElementById('tab-dashboard');
const swapView = document.getElementById('swap-view');
const dashView = document.getElementById('dashboard-view');
const activeBtn = ['bg-brand-primary', 'text-white', 'shadow-lg'];
const inactiveBtn = ['text-gray-400', 'hover:text-white'];
if (t === 'swap') {
swapBtn.classList.add(...activeBtn);
swapBtn.classList.remove(...inactiveBtn);
dashBtn.classList.remove(...activeBtn);
dashBtn.classList.add(...inactiveBtn);
dashView.classList.replace('relative', 'absolute');
dashView.classList.add('opacity-0', 'translate-x-[20px]', 'scale-95', 'pointer-events-none');
dashView.classList.remove('opacity-100', 'translate-x-0', 'scale-100', 'pointer-events-auto');
swapView.classList.replace('absolute', 'relative');
swapView.classList.remove('opacity-0', 'translate-x-[-20px]', 'scale-95', 'pointer-events-none', 'hidden');
swapView.classList.add('opacity-100', 'translate-x-0', 'scale-100', 'pointer-events-auto');
} else {
dashBtn.classList.add(...activeBtn);
dashBtn.classList.remove(...inactiveBtn);
swapBtn.classList.remove(...activeBtn);
swapBtn.classList.add(...inactiveBtn);
swapView.classList.replace('relative', 'absolute');
swapView.classList.add('opacity-0', 'translate-x-[-20px]', 'scale-95', 'pointer-events-none');
swapView.classList.remove('opacity-100', 'translate-x-0', 'scale-100', 'pointer-events-auto');
dashView.classList.replace('absolute', 'relative');
dashView.classList.remove('opacity-0', 'translate-x-[20px]', 'scale-95', 'pointer-events-none', 'hidden');
dashView.classList.add('opacity-100', 'translate-x-0', 'scale-100', 'pointer-events-auto');
updateDashboard();
fetchUserStats();
updateAllUI();
}
}
function toggleSettings() {
const panel = document.getElementById('settingsPanel');
const gear = document.getElementById('settingsGear');
panel.classList.toggle('open');
gear.classList.toggle('active');
}
function setSlip(val) {
slippage = val;
document.getElementById('customSlip').value = "";
updateSlipUI();
}
function setCustomSlip() {
const val = parseFloat(document.getElementById('customSlip').value);
if(!isNaN(val)) slippage = val;
updateSlipUI();
}
function updateSlipUI() {
document.querySelectorAll('.slip-option').forEach(b => {
const isActive = parseFloat(b.innerText) === slippage && document.getElementById('customSlip').value === "";
if(isActive) {
b.classList.add('bg-brand-primary', 'text-white', 'border-transparent');
b.classList.remove('border-brand-border');
} else {
b.classList.remove('bg-brand-primary', 'text-white', 'border-transparent');
b.classList.add('border-brand-border');
}
});
calc();
}
function copyAddress() {
if(!userAddr) return alert("Connect Wallet first");
navigator.clipboard.writeText(userAddr);
showToast("Address Copied", "success");
}
function setQueryMode(enabled) {
isQueryMode = enabled;
const wrap = document.getElementById('queryWrap');
const tabW = document.getElementById('tabWallet');
const tabQ = document.getElementById('tabQuery');
if(enabled) {
wrap.classList.remove('hidden');
tabW.classList.remove('bg-brand-primary', 'text-white');
tabW.classList.add('text-gray-400', 'hover:text-white');
tabQ.classList.add('bg-brand-primary', 'text-white');
tabQ.classList.remove('text-gray-400');
document.getElementById('balanceLabel').innerText = "Query Balance";
document.getElementById('userWallet').innerText = "0.00";
} else {
wrap.classList.add('hidden');
tabW.classList.add('bg-brand-primary', 'text-white');
tabQ.classList.remove('bg-brand-primary', 'text-white');
tabQ.classList.add('text-gray-400');
document.getElementById('queryInput').value = "";
document.getElementById('balanceLabel').innerText = "Balance";
fetchUserStats();
}
}
function handleQuery() {
clearTimeout(queryTimeout);
queryTimeout = setTimeout(() => { fetchUserStats(); }, 500);
}
function showToast(msg, type = 'info') {
const container = document.getElementById('toastContainer');
const toast = document.createElement('div');
let borderColor = type === 'success' ? 'border-success' : (type === 'error' ? 'border-danger' : 'border-brand-primary');
toast.className = `bg-[#140a1e] border-l-4 ${borderColor} text-white px-5 py-3 rounded-md shadow-2xl flex items-center gap-3 transform transition-all duration-300 translate-x-full opacity-0`;
let icon = type === 'success' ? '✓' : (type === 'error' ? '✕' : 'ℹ');
toast.innerHTML = `<span class="font-bold text-lg">${icon}</span> <span class="text-sm font-medium">${msg}</span>`;
container.appendChild(toast);
requestAnimationFrame(() => {
toast.classList.remove('translate-x-full', 'opacity-0');
});
setTimeout(() => {
toast.classList.add('translate-x-full', 'opacity-0');
setTimeout(() => toast.remove(), 300);
}, 4000);
}
function showModal(title, desc) {
const modal = document.getElementById('swapModal');
document.getElementById('modalSpinner').style.display = 'block';
document.getElementById('modalSuccess').classList.add('hidden');
document.getElementById('modalError').classList.add('hidden');
document.getElementById('modalCloseBtn').classList.add('hidden');
document.getElementById('modalTitle').innerText = title;
document.getElementById('modalDesc').innerText = desc;
modal.classList.remove('hidden');
setTimeout(() => {
modal.classList.remove('opacity-0');
modal.querySelector('div').classList.remove('scale-95');
modal.querySelector('div').classList.add('scale-100');
}, 10);
}
function setModalError(errMsg) {
document.getElementById('modalSpinner').style.display = 'none';
document.getElementById('modalError').classList.remove('hidden');
document.getElementById('modalTitle').innerText = "Failed";
document.getElementById('modalDesc').innerText = errMsg;
document.getElementById('modalCloseBtn').classList.remove('hidden');
document.getElementById('modalCloseBtn').style.display = 'inline-block';
}
function setModalSuccess(txHash) {
document.getElementById('modalSpinner').style.display = 'none';
document.getElementById('modalSuccess').classList.remove('hidden');
document.getElementById('modalTitle').innerText = "Success";
document.getElementById('modalDesc').innerText = "Transaction confirmed";
document.getElementById('modalCloseBtn').classList.remove('hidden');
document.getElementById('modalCloseBtn').style.display = 'inline-block';
}
function hideModal() {
const modal = document.getElementById('swapModal');
modal.classList.add('opacity-0');
modal.querySelector('div').classList.remove('scale-100');
modal.querySelector('div').classList.add('scale-95');
setTimeout(() => modal.classList.add('hidden'), 300);
}
async function connectWallet() {
if(!window.ethereum) return showToast("Install MetaMask", "error");
try {
provider = new ethers.BrowserProvider(window.ethereum);
signer = await provider.getSigner();
userAddr = await signer.getAddress();
const net = await provider.getNetwork();
if(net.chainId !== 56n) {
try { await window.ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0x38' }] }); }
catch(e) { return showToast("Switch to BSC", "error"); }
provider = new ethers.BrowserProvider(window.ethereum);
signer = await provider.getSigner();
}
document.getElementById('connectBtn').innerHTML = `${userAddr.substring(0,6)}...${userAddr.substring(38)}`;
document.getElementById('mainActionBtn').innerText = "SWAP";
const badge = document.getElementById('statusBadge');
badge.innerText = "Connected";
badge.className = "text-[10px] px-2 py-0.5 rounded bg-success/20 text-success font-medium border border-success/30";
document.getElementById('userAddrDisplay').innerText = userAddr.substring(0,8) + "..." + userAddr.substring(36);
showToast("Wallet Connected", "success");
calc();
updateDashboard();
fetchSwapBalances();
if(isQueryMode) handleQuery(); else fetchUserStats();
} catch (e) { console.error(e); showToast("Connection failed", "error"); }
}
async function init() {
await loadTransactionsCSV();
try {
if(!provider) provider = new ethers.JsonRpcProvider(BSC_RPC);
updateSlipUI();
updateDashboard();
} catch(e) { console.log("Init RPC error:", e); }
try {
const res = await fetch("https://api.dexscreener.com/latest/dex/pairs/bsc/" + ADDR_LP_PAIR);
const data = await res.json();
if(data.pairs && data.pairs.length) {
pair = data.pairs[0];
pair.baseToken.symbol = "theSTRAT";
updateAllUI();
}
} catch(e) {}
// TRIGGER THE MOCK TEST
// console.log("Running Mock Test for address...");
// displayUserHistory("0x6Efee96287B5e1a2Ef966E25baE15a54BDE9b83E");
}
async function updateDashboard() {
if (!provider) return;
// console.log("--- START DASHBOARD UPDATE ---");
// console.log("Multisig Address:", ADDR_MSIG);
try {
const stakeTheContract = new ethers.Contract(ADDR_STAKETHENA, STAKETHENA_VAULT_ABI, provider);
const gaugeContract = new ethers.Contract(ADDR_GAUGE, GAUGE_ABI, provider);