-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2726 lines (2543 loc) · 114 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
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">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>BitBay Swap</title>
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<link rel="stylesheet" type="text/css" href="./assets/css/chartist.min.css">
<link rel="stylesheet" href="./assets/css/nouislider.min.css">
<!-- <link rel="stylesheet" href="./assets/css/line.css"> -->
<link rel="stylesheet" href="./assets/css/style.css">
</head>
<body>
<div class="wrap" id="wrap">
<!-- top menu -->
<!--
<div class="main">
<div class="align1">
<a href="https://www.w3docs.com/learn-html.html"><a href="index.html"><img src="icon.png" class="header_logo"></a></a>
</div>
<div class="align2">
<div class="select-menu" id="swap_network">
<div class="select-btn">
<span class="sBtn-text"><button><i class="icon uil uil-globe"></i> Network <i class="icon arrow uil uil-arrow-down"></i></button></span>
<i class="bx bx-chevron-down"></i>
</div>
<ul class="options">
<li class="option">
<i class="bx bxl-github" style="color: #171515;"></i>
<span class="option-text">Ethereum (Sepolia Testnet)</span>
</li>
</ul>
</div>
</div>
<div class="align3">
<div class="sec-center">
<input class="dropdown" type="checkbox" id="dropdown" name="dropdown"/>
<label class="for-dropdown" for="dropdown">Menu <i class="uil uil-arrow-down"></i></label>
<div class="section-dropdown">
<a href="./information.html">FAQ about the Bridge <i class="uil uil-arrow-right"></i></a>
<a href="https://www.bitbay.market" target="_blank">Learn more about BitBay <i class="uil uil-arrow-right"></i></a>
<a href="https://github.com/dzimbeck/BitBay-Solidity" target="_blank">Open source code on Github <i class="uil uil-arrow-right"></i></a>
<input class="dropdown-sub" type="checkbox" id="dropdown-sub" name="dropdown-sub"/>
<label class="for-dropdown-sub" for="dropdown-sub">Help <i class="uil uil-plus"></i></label>
<div class="section-dropdown-sub">
<a href="#">Documentation <i class="uil uil-arrow-right"></i></a>
<a href="#">Dropdown Link <i class="uil uil-arrow-right"></i></a>
</div>
</div>
</div>
</div>
</div>
-->
<div class="top_menu " >
<div class="top_menu_content_left">
<a href="index.html"><img src="icon.png" class="header_logo"></a>
</div>
<div class="top_menu_content_center">
<!-- <button><i class="icon uil uil-link"></i> Connect Wallet</button>
<button><i class="icon uil uil-wallet"></i> Balance</button> -->
<div class="select-menu" id="swap_network">
<div class="select-btn">
<span class="sBtn-text">
<span class="btn swapSelector"><img class="icon network" src="./assets/images/network.svg"> Network <img class="icon uil uil-arrow-down" src="./assets/images/arrow-down.svg"></span></span>
<i class="bx bx-chevron-down"></i>
</div>
<ul class="options">
<li class="option">
<i class="bx bxl-github" style="color: #171515;"></i>
<span class="option-text">Ethereum (Sepolia Testnet)</span>
</li>
</ul>
</div>
</div>
<div class="top_menu_content_right">
<div class="sec-center">
<!-- <button>?</button> !-->
<input class="dropdown" type="checkbox" id="dropdown" name="dropdown"/>
<label class="for-dropdown" for="dropdown">Menu <img class="icon uil uil-arrow-down" src="./assets/images/arrow-down.svg"></label>
<div class="section-dropdown">
<a href="./information.html">FAQ about the Bridge</a>
<a href="https://www.bitbay.market" target="_blank">Learn more about BitBay</a>
<a href="https://github.com/dzimbeck/BitBay-Solidity" target="_blank">Open source code on Github</a>
<input class="dropdown-sub" type="checkbox" id="dropdown-sub" name="dropdown-sub"/>
<label class="for-dropdown-sub" for="dropdown-sub">Help →</label>
<div class="section-dropdown-sub">
<a href="https://t.me/bitbayofficial" target="_blank">BitBay Telegram</a>
<a href="https://nighttrader.exchange/" target="_blank">NightTrader Exchange</a>
</div>
</div>
</div>
</div>
</div>
<!--PEN HEADER-->
<div class="header">
<img src="assets/images/bitbay-logo-medium.png" class="main_logo">
</div>
<!--PEN CONTENT-->
<div class="content">
<!--content title-->
<h2 class="content__title">
<!-- <button onclick="login()" class="not-logged-in login_btn"><i class="uil uil-link"></i> Connect Wallet</button> -->
<div class=" swapSelector btn not-logged-in login_btn" onclick="login()">
<img class="swapSelectorLogo uil uil-link" src="./assets/images/link.svg">
<div class="swapSelectorText">Connect Wallet</div>
</div>
</h2>
<div class="box">
<div class="callout callout-success logged-in hidden" id="balance_network">
</div>
</div>
<!--tabs-menu !-->
<div class="tabs_menu">
<!--tabs navigation-->
<div class="tabs__nav">
<ul class="tabs__nav-list">
<li class="tabs__nav-item js-active">Info</li>
<li class="tabs__nav-item">Swap</li>
<li class="tabs__nav-item">Liquidity</li>
<li class="tabs__nav-item">Bridge</li>
</ul>
</div>
</div>
<!--content inner-->
<div class="content__inner">
<!-- tabs-content !-->
<div class="tabs">
<!-- trade settings button -->
<div class="settingField hidden" id="slippageField">
<div class="boxTitle">
<small>Min/Max price fluctuation for swaps or deposits.</small>
</div>
<div class="input-group">
<div class="btn-inside btn-inside-start">Slippage</div>
<input type="number" id="CoinPercent" class="form_field buttons-inside" placeholder="10.00" value="10" required="">
<div class="btn-inside btn-inside-end">%</div>
</div>
</div>
<div class="settingField">
</div>
<!--tabs panels-->
<div class="tabs__panels">
<!--info panel-->
<div class="tabs__panel info_panel">
<div class="callout callout-no-border logged-in hidden">
Contract info:<hr>
<div id="contractinfo">
</div>
</div>
<hr class="logged-in hidden">
<div class="swapBody">
<div class="swapFields">
<div class="boxTitle ">
❄️ Frozen Coins
</div>
<div class="swapField">
<div class=" swapSelector btn" onclick="showFrozen()">
<img class="swapSelectorLogo" src="./icon.png">
<div class="swapSelectorText"> Frozen Coins Details</div>
</div>
<div class=" swapSelector btn" onclick="sendFrozen()">
<img class="swapSelectorLogo" src="./icon.png">
<div class="swapSelectorText">Release Frozen Funds</div>
</div>
</div>
<br>
<div class="boxTitle ">
📊 Show Liquid/Reserve Chart
</div>
<div class="swapField info_chart">
<span class="btn swapSelector" onclick="showPegChart()" id="showPegChart">Show Liquid/Reserve Chart 📊</span><br>
<div class="chart_inputs hidden" id="chartContainerInputs">
<div class="chart-slider-container">
<div class="style-2 wrapper m-b-50 p-l-r">
<div class="slider-keypress m-b-20"></div>
<input type="text" class="input-with-keypress-0" id="range1" required>
<input type="text" class="input-with-keypress-1" id="range2" required>
</div>
</div>
</div>
<div id="chartContainer" class=" hidden" style="height: 150px; border: 5px solid #d9dbda; border-radius: 10px"></div>
</div>
</div>
</div>
<br><hr class="logged-in hidden">
<br>
<div class="callout callout-success logged-in hidden">
Network info:<hr>
<div id="networkinfo">
</div>
</div>
</div>
<!--swap panel-->
<div class="tabs__panel">
<p id="exchangeImage"></p>
<p id="swapintro">
<div class="callout">
Decentralized exchange through Uniswap, Pancakeswap and more</p>
Please note: All deposits and withdraws must take place using the official BitBay router contract.
<br><a href="./information.html">See the FAQ to learn why.</a><br>
</div>
<br>
<!-- /*swap interface - start*/ -->
<select id="exchangeSelect" class="logged-in hidden">
</select>
<div class="swapBody">
<div class="swapFields">
<div class="boxTitle swapFirstCoinTxt">
Buy BitBay
</div>
<div class="swapField">
<div class="swapFirstCoin swapSelector btn">
<img class="swapSelectorLogo" src="./icon.png">
<div class="swapSelectorText" id="swapCoin1Text">BAY</div>
<div class="swapSelectorArrow">
<svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg" class="sc-33m4yg-8 khlnVY"><path d="M0.97168 1L6.20532 6L11.439 1" stroke="#AEAEAE"></path></svg>
</div>
</div>
<input class="swapTextInput" type="text" placeholder="0.0" id="SwapAmount">
</div>
<div class="swapArrow">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#6E727D" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><polyline points="19 12 12 19 5 12"></polyline></svg>
</div>
<div class="boxTitle swapSecondCoinTxt">
in exchange for
</div>
<div class="swapField">
<div class="swapSecondCoin swapSelector btn">
<img class="swapSelectorLogo" src="./assets/images/0xmnr.png">
<div class="swapSelectorText" id="swapCoin2Text">WALLY</div>
<div class="swapSelectorArrow">
<svg width="12" height="7" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg" class="sc-33m4yg-8 khlnVY"><path d="M0.97168 1L6.20532 6L11.439 1" stroke="#AEAEAE"></path></svg>
</div>
</div>
<input class="swapTextInput" type="text" placeholder="0.0" id="SwapAmount2">
</div>
</div>
<div class="callout swapInfoSummary logged-in hidden">
<div class="swapInfo">
<div class="swapInfoLine">
<span class="left">Order Summary</span>
<div class="right">
<span></span>
<span class="important-text"></span>
</div>
</div>
<div id="SwapSummary">
</div>
</div>
</div>
<a href="#" class="swapButton logged-in hidden" onclick="Swap()">Swap </a>
</div>
<!--
/*swap interface - end*/
-->
<select id="SwapCoin" >
<option value="0">Buy BitBay</option>
<option value="1">Buy BitBay Reserve</option>
<option value="2">Sell BitBay</option>
<option value="3">Sell BitBay Reserve</option>
</select>
<br>
<br>
</div>
<!--liquidity panel-->
<div class="tabs__panel liquidity_panel">
<div class="swapBody">
<div class="swapFields">
<div class="boxTitle swapFirstCoinTxt">Liquidity</div>
<div class="swapField swapFlexColumn">
<div class=" swapFlexColumn">
Amount to add:
<div class="input-group">
<input class="textBox form_field" id="Coin1amount" type="text" placeholder="0" required/>
<select id="Coin1" class="btn-inside"></select>
</div>
</div>
<br>
<div class=" swapFlexColumn">
Amount to add:
<div class="input-group">
<input class="textBox form_field" id="Coin2amount" type="text" placeholder="0" required/>
<select id="Coin2" class="btn-inside">
<option value="0">BitBay Liquid</option>
<option value="1">BitBay Reserve</option>
</select>
</div>
</div>
<div class=" swapFlexColumn">
<div class="callout hidden"><p id="addliquidtext"></p></div>
<br>
<div class="swapSelector swapFlexRow center btn" onclick="addLiquidity()">Add Liquidity</div>
<hr>
<div class="callout logged-in">
Additional info:<hr>
<div id="additionalCoins"></div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="boxTitle swapFirstCoinTxt">
Widthdraw LP tokens/coins
</div>
<div class="swapField swapFlexColumn withdraw">
<div class="swapField-child swapFlexRow">
<div class="swapFirstCoin swapSelector btn" onclick="CalculateBalance()">
Σ
<div class="swapSelectorText">Calculate Balance</div>
</div>
<input class="swapTextInput" type="text" placeholder="0.0" id="WithdrawAmount" required="">
</div>
<div class="swapFlexColumn">
<div class="swapSelector swapFlexRow center btn" onclick="withdrawLP()">💸 Withdraw LP tokens/coins</div>
</div>
<div class="swapFlexColumn">
<div class="callout logged-in">
Withdrawal Details:<hr>
<div id="LPdetails1"></div>
</div>
</div>
</div>
<br><br>
<div class="callout callout-success logged-in">
Pool Liquidity details:<hr>
<div id="LPdetails2"></div>
</div>
<br>
<!-- Liquidity charts -->
<div class="swapBody">
<div class="swapFields">
<div class="boxTitle ">
📊 Show Liquid/Reserve Chart
</div>
</div>
<div class="swapField info_chart">
<span class="btn swapSelector" onclick="showPegChart(9)" id="showPegChartLiquidity">Show Liquid/Reserve Chart 📊</span>
<br>
<div class="chart_inputs hidden" id="chartContainer2Inputs">
<div class="chart-slider-container">
<div class="style-2 wrapper m-b-50 p-l-r">
<div class="slider-keypress-liquidity m-b-20"></div>
<input type="text" class="input-with-keypress-3" id="range3" required>
<input type="text" class="input-with-keypress-4" id="range4" required>
</div>
</div>
</div>
<br>
<select id="ChartSelect">
<option value="0">Show chart for selected pair</option>
<option value="1">Show chart for my balance at the pool</option>
</select>
<br>
<div id="chartContainer2" class=" hidden" style="height: 150px; border: 5px solid #d9dbda; border-radius: 10px"></div>
</div>
</div>
<br>
</div>
<!--bridge panel-->
<div class="tabs__panel">
<div class="swapBody">
<div class="swapFields">
<div class="boxTitle swapFirstCoinTxt">
Mint/Redeem Coins from BitBay
</div>
<div class="swapField">
<div class="swapFirstCoin swapSelector btn" onclick="mintFromBitBay(document.getElementById('jsonproof').value)">
<img class="swapSelectorLogo" src="./icon.png">
<div class="swapSelectorText">Mint</div>
</div>
<input class="swapTextInput" type="text" placeholder="Merkle proof receipt" id="jsonproof" required>
</div>
<div class="boxTitle swapSecondCoinTxt">
Register BitBay address for burn(bridge)
</div>
<div class="swapField">
<div class="swapSecondCoin swapSelector btn" onclick="registerBitBay(document.getElementById('myBAYaddy').value)">
👨
<div class="swapSelectorText">Register</div>
</div>
<input class="swapTextInput" type="text" placeholder="BitBay Address" id="myBAYaddy" required>
</div>
<div class="boxTitle swapSecondCoinTxt">
Burn coins back to BitBay
</div>
<div class="swapField bridgeBurn">
<div class="swapField-child">
<div class="swapSecondCoin swapSelector btn" onclick="burnToBitBay(document.getElementById('myBAYamount').value)">
🔥
<div class="swapSelectorText">Burn</div>
</div>
</div>
<div class="swapField-child">
<input class="swapTextInput" type="text" placeholder="0.0" id="myBAYamount" required>
</div>
<div class="swapField-child">
<div class="switch-field">
<input type="radio" id="radio-burn-reserve" name="burn-liquid-reserve" value="Reserve Coins" checked/>
<label for="radio-burn-reserve">Reserve Coins</label>
<input type="radio" id="radio-burn-liquid" name="burn-liquid-reserve" value="Liquid Coins" />
<label for="radio-burn-liquid">Liquid Coins</label>
</div>
</div>
</div>
<select id="coinToBurn" class="hidden">
<option>Reserve Coins</option>
<option>Liquid Coins</option>
</select>
<br>
<hr>
<div class="boxTitle swapSecondCoinTxt">
Show my receipts/proofs for redeeming
</div>
<div class="swapField bridgeBurn show_receipt">
<div class="input-group">
<div id="merkleintro" class="swapSelector btn btn btn-inside btn-inside-start" onclick="showNonces()">→ Show next receipt</div>
<button type="button" class="swapSelector btn btn-inside" onclick="copyNonce()">📄 Copy</button>
</div>
<div id="merkletext" class="swapField-child callout hidden">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tabs tabs_overlay logged-in logged-in-remove hidden">
</div>
<div class="tabs tabs_overlay_message logged-in logged-in-remove ">
<div class="callout callout-warning">Please log in with Metamask. If you don't have the extension you can download it for your browser from the <a href="https://metamask.io/download/" target="_blank">official source</a>.</div>
</div>
</div>
</div>
</div>
<!-- partial -->
</div>
<!-- MODALS -->
<!-- Swap Buy Select -->
<div id="modal-swap-buy" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-small">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Select a token</h4>
</div>
<div class="modal-body">
<table class="table custom-table">
<tbody>
<tr scope="row" data-coin="BAY" data-cointext="Buy BitBay">
<td>
<i class="icon bay">
<img src="./icon.png" />
</i>
</td>
<td>Buy BitBay <small class="d-block">BitBay Liquid</small></td>
<td>
<label for="sdb1">
<input type="radio" id="sdb1" name="b-swap-group" checked value="0" />
</label>
</td>
</tr>
<tr class="activea" data-coin="BAYR" data-cointext="Buy BitBay Reserve">
<td>
<i class="icon bay">
<img src="./icon.png" />
</i>
</td>
<td>Buy BitBay Reserve <small class="d-block">BitBay Reserve</small></td>
<td>
<label for="sdb2">
<input type="radio" id="sdb2" name="b-swap-group" value="1" />
</label>
</td>
</tr>
<tr data-coin="BAY" data-cointext="Sell BitBay">
<td>
<i class="icon bay">
<img src="./icon.png" />
</i>
</td>
<td>Sell BitBay <small class="d-block">BitBay Liquid</small></td>
<td>
<label for="sdb3">
<input type="radio" id="sdb3" name="b-swap-group" value="2" />
</label>
</td>
</tr>
<tr data-coin="BAYR" data-cointext="Sell BitBay Reserve">
<td>
<i class="icon bay">
<img src="./icon.png" />
</i>
</td>
<td>Sell BitBay Reserve <small class="d-block">BitBay Reserve</small></td>
<td>
<label for="sdb4">
<input type="radio" id="sdb4" name="b-swap-group" value="3" />
</label>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Swap in exchange for Select -->
<div id="modal-swap-inexchange-for" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-dialog-small">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Select a token</h4>
</div>
<div class="modal-body">
<table class="table custom-table">
<tbody>
<tr scope="row">
<td>
<i class="icon bay">
<img src="./walrus.png" />
</i>
</td>
<td><br>In exchange for:
<select id="SwapCoin2" >
</select>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- scripts -->
<script type="text/javascript" src="./assets/js/nouislider.min.js"></script>
<script type="text/javascript" src="./assets/js/kane-modal.js"></script>
<script type="text/javascript" src="./assets/js/script.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/web3.min.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/merkletree.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/BAYL.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/BAYR.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/BAYF.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/BAYData.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/LiquidityPool.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/BAYAdmin.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/Router.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/ERC20.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/Factory.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/Pair.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/WETH.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/coin.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/crypto-sha256.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/jsbn.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/chartist.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/chartist-plugin-tooltip.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/purify.js"></script>
<script type="text/javascript" src="./assets/js/bridge-tools/sweetalert211.js"></script>
<style>
.swal2-popup {
background-color: #ededed; /* Background color */
color: #000000; /* Text color */
border: 2px solid #3d0064; /* Border color */
border-radius: 4px; /* Border radius */
font-size: 11px;
font-family: 'Courier New', monospace; /* Custom font */
font-weight: normal;
z-index: 1000;
}
.swal2-title {
color: #3d0064; /* Title text color */
}
.swal2-content {
color: #3d0064; /* Content text color */
}
.swal2-confirm,
.swal2-cancel {
background-color: #ededed; /* Confirm and cancel button background color */
color: #3d0064; /* Button text color */
}
/* Hover effect for buttons */
.swal2-confirm:hover,
.swal2-cancel:hover {
background-color: #0086e3;
}
/* Icon color */
.swal2-icon {
color: #3d0064;
}
.swal2-range {
background-color: #ededed; /* Set your desired background color */
border: 2px solid #3d0064;
}
</style>
<script type="text/javascript">
//For further security improvements to these tools it's possible to add a
//section which allows a custom approval where users can set manually or
//possibly have a dialog box move into focus when asked for the authorization
//which lets them specify the amount. Also in the security tab advise users
//on how to run the page locally.
function getQueryParam(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// Detect language
var merkleProof = getQueryParam('m') || ''; // Default to 'en' if not provided
if(merkleProof != '') {
document.getElementById("jsonproof").value = merkleProof;
Swal.fire({
icon: 'success',
title: 'Receipt pending',
text: 'The site has detected a merkle proof in the URL. The text was filled into the minting form. Once logged in, you can attempt to redeem it by clicking "Mint".',
});
}
var web3 = [];
var contractInst = [];
//web3[0] = new Web3("https://cloudflare-eth.com");
//web3[1] = new Web3("https://bsc-dataseed.binance.org");
//web3[2] = new Web3("https://api-goerli.etherscan.io/");
var isConnected = false;
window.addEventListener('ethereum#initialized', login, {
once: true,
});
window.addEventListener('keyup', calculateDeposit, {
});
window.addEventListener("load", async function() {
if (window.ethereum) {
// detect Metamask account change
window.ethereum.on('accountsChanged', async function (newaccounts) {
console.log('accountsChanges',newaccounts);
defaultvars();
await login();
});
// detect Network account change
window.ethereum.on('chainChanged', async function(thenetworkId){
console.log('chainChanged',thenetworkId);
defaultvars();
await login();
});
}
});
document.getElementById('Coin2').addEventListener('change', async function() {
autocompute = 0;
lastchecked = 0;
reservebayval3 = 0;
reservecoinval3 = 0;
LPtokens = 0;
mycurrentpair = '';
reserveatpool = [];
prevresult = [];
prevtime = 0;
prevselect = 10;
document.getElementById("LPdetails1").innerHTML = '';
document.getElementById("LPdetails2").innerHTML = '';
document.getElementById("WithdrawAmount").value = '';
await getMarketData();
document.getElementById("Coin1amount").value = '';
document.getElementById("Coin2amount").value = '';
document.getElementById("additionalCoins").innerHTML = '';
calculateDeposit();
});
document.getElementById('Coin1').addEventListener('change', async function() {
autocompute = 0;
lastchecked = 0;
reservebayval3 = 0;
reservecoinval3 = 0;
LPtokens = 0;
mycurrentpair = '';
reserveatpool = [];
prevresult = [];
prevtime = 0;
prevselect = 10;
document.getElementById("LPdetails1").innerHTML = '';
document.getElementById("LPdetails2").innerHTML = '';
document.getElementById("WithdrawAmount").value = '';
await getMarketData();
document.getElementById("Coin1amount").value = '';
document.getElementById("Coin2amount").value = '';
document.getElementById("additionalCoins").innerHTML = '';
calculateDeposit();
});
document.getElementById('SwapCoin').addEventListener('change', function() {
lastchecked2 = 0;
reservebayval2 = 0;
reservecoinval2 = 0;
document.getElementById("SwapAmount").value = '';
document.getElementById("SwapAmount2").value = '';
document.getElementById("SwapSummary").innerHTML = '';
calculateDeposit();
});
document.getElementById('SwapCoin2').addEventListener('change', function() {
lastchecked2 = 0;
reservebayval2 = 0;
reservecoinval2 = 0;
document.getElementById("SwapAmount").value = '';
document.getElementById("SwapAmount2").value = '';
document.getElementById("SwapSummary").innerHTML = '';
calculateDeposit();
});
document.getElementById('exchangeSelect').addEventListener('change', async function() {
autocompute = 0;
lastchecked = 0;
lastchecked2 = 0;
reservebayval2 = 0;
reservecoinval2 = 0;
reservebayval3 = 0;
reservecoinval3 = 0;
LPtokens = 0;
mycurrentpair = '';
reserveatpool = [];
prevresult = [];
prevtime = 0;
prevselect = 10;
document.getElementById("LPdetails1").innerHTML = '';
document.getElementById("LPdetails2").innerHTML = '';
document.getElementById("WithdrawAmount").value = '';
await getMarketData();
document.getElementById("Coin1amount").value = '';
document.getElementById("Coin2amount").value = '';
document.getElementById("SwapAmount").value = '';
document.getElementById("SwapAmount2").value = '';
document.getElementById("SwapSummary").innerHTML = '';
document.getElementById("additionalCoins").innerHTML = '';
calculateDeposit();
});
document.getElementById('ChartSelect').addEventListener('change', async function() {
prevresult = [];
prevtime = 0;
prevselect = 10;
});
async function login() {
if (window.ethereum) { //Note: for mobile this only works if the webpage has <head> tag
console.log("connecting");
await window.ethereum.request({method: 'eth_requestAccounts'});
web3 = new Web3(window.ethereum);
console.log("success");
var notLoggedinElements = document.querySelectorAll('.not-logged-in');
notLoggedinElements.forEach(el => {el.classList.add('hidden')});
var authElements = document.querySelectorAll('.logged-in');
authElements.forEach(el => {el.classList.remove('hidden');});
//remove elements like overlay on box when logged in
var authElementsRemove = document.querySelectorAll('.logged-in-remove');
authElementsRemove.forEach(el => {el.parentNode.removeChild(el);});
document.getElementById("merkletext").innerHTML = '';
document.getElementById("addliquidtext").innerHTML = '';
document.getElementById("Coin1amount").value = '';
document.getElementById("Coin2amount").value = '';
document.getElementById("SwapAmount").value = '';
document.getElementById("SwapAmount2").value = '';
document.getElementById("SwapSummary").innerHTML = '';
lastitem = 10000000;
isConnected = true;
await checkbalances();
makeFairRatio();
} else {
isConnected = false;
modalDialog('Error', "Please log in with Metamask. If you don't have the extension you can download it for your browser from the <a href='https://metamask.io/download/' target='_blank'>official source</a>.", "warning");
}
}
myaccounts = [];
baydatacontract = '';
baylcontract = '';
bayrcontract = '';
bayfcontract = '';
bayadmincontract = '';
liquiditypool = '';
networkvars = [];
reservetimelock = 2629800;
BAYAdmin = '';
currentChainId = '';
prevChainId = 0;
lastitem = 10000000;
pairs = [];
knowndecimals = [];
routers = [];
exchanges = [];
exchangenum = [];
exchangeImages = [];
BAYLaddy = '';
BAYRaddy = '';
fairRatio = [];
poolreserve = [];
lastchecked = 0;
lastchecked2 = 0;
lockthis = 0;
autocompute = 0;
reservebayval = 0;
reservecoinval = 0;
reservebayval2 = 0;
reservecoinval2 = 0;
reservebayval3 = 0;
reservecoinval3 = 0;
currentdecimals = 8;
currentdecimals2 = 8;
recommendedBAY = 0;
slippage = 0;
LPtokens = 0;
mycurrentpair = '';
reserveatpool = [];
prevresult = [];
prevtime = 0;
prevselect = 10;
precision = 5;
lastSelect = '';
lastMinMax = 0;
withdrawMin1 = 0;
withdrawMin2 = 0;
lastrun = 0;
document.getElementById("CoinPercent").value = '10';
function defaultvars() {
myaccounts = [];
baydatacontract = '';
baylcontract = '';
bayrcontract = '';
bayfcontract = '';
bayadmincontract = '';
liquiditypool = '';
networkvars = [];
reservetimelock = 2629800;
BAYAdmin = '';
currentChainId = '';
prevChainId = 0;
lastitem = 10000000;
pairs = [];
knowndecimals = [];
routers = [];
exchanges = [];
exchangenum = [];
exchangeImages = [];
BAYLaddy = '';
BAYRaddy = '';
fairRatio = [];
poolreserve = [];
lastchecked = 0;
lastchecked2 = 0;
autocompute = 0;
reservebayval = 0;
reservecoinval = 0;
reservebayval2 = 0;
reservecoinval2 = 0;
reservebayval3 = 0;
reservecoinval3 = 0;
currentdecimals = 8;
currentdecimals2 = 8;
recommendedBAY = 0;
slippage = 0;
LPtokens = 0;
mycurrentpair = '';
reserveatpool = [];
prevresult = [];
prevtime = 0;
prevselect = 10;
precision = 5;
lastSelect = '';
lastMinMax = 0;
withdrawMin1 = 0;
withdrawMin2 = 0;
document.getElementById("Coin1amount").value = '';
document.getElementById("Coin2amount").value = '';
document.getElementById("CoinPercent").value = '10';
//document.getElementById("text1").innerHTML = '';
document.getElementById("networkinfo").innerHTML = '';