-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
824 lines (587 loc) · 34.4 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
<!DOCTYPE html>
<html lang="en" class = "bg-black">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta charset="utf-8" />
<title>SpecieCircle</title>
<link rel="icon" type="image/x-icon" href="pics/pic/speciejs.png" />
<meta name="description" content="Decentralized Merchant Maker." />
<meta name="author" content="SpecieCircle" />
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- Ethereum Related -->
<script src="https://unpkg.com/web3@latest/dist/web3.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/web3@latest/dist/web3.min.js"></script>
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v5.13.0/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<!-- Core theme CSS (includes Bootstrap)-->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<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=Roboto+Mono:wght@200;400;600&display=swap" rel="stylesheet"/>
<link href="css/styles.css" rel="stylesheet" />
<link href="css/nucleo-icons.css" rel="stylesheet" />
<link href="css/nucleo-svg.css" rel="stylesheet" />
<!-- Font Awesome Icons -->
<script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
<link href="css/nucleo-svg.css" rel="stylesheet" />
<!-- CSS Files -->
</head>
<body id="page-top">
<div class="modal fade animate__animated animate__fadeInDown" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content bg-greygrey text-white">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Shipping Information & In Stock Supply</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Email</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputEmail">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">Name</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputName">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">Address</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputAddress">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">City</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputCity">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label"> State</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputState">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label">Zip Code</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputZip">
</div>
<div class="form-group">
<label for="recipient-name" class="col-form-label">Country</label>
<input type="text" class="form-control bg-greygrey text-white " id="inputCountry">
</div>
<div class="input-group input-group-sm mb-3 bg-greygrey">
<div class="input-group-prepend bg-greygrey">
<span class="input-group-text bg-greygrey text-white" id="inputGroup-sizing-sm">Small Size Amount</span>
</div>
<input type="number" name="SmallMogul" value = '0'class="form-control bg-greygrey text-white " id="inputSMA" min="0" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
<div class="input-group input-group-sm mb-3 bg-greygrey">
<div class="input-group-prepend bg-greygrey">
<span class="input-group-text bg-greygrey text-white " id="inputGroup-sizing-sm">Medium Size Amount</span>
</div>
<input type="number" name="mediumMogul" value = '0' class="form-control bg-greygrey text-white" id="inputMMA" min="0" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
<div class="input-group input-group-sm mb-3 bg-greygrey">
<div class="input-group-prepend bg-greygrey">
<span class="input-group-text bg-greygrey text-white" id="inputGroup-sizing-sm">Large Size Amount</span>
</div>
<input type="number" name="largeMogul" value = '0' class="form-control bg-greygrey text-white" id="inputLMA" min="0" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
<div class="input-group input-group-sm mb-3 bg-greygrey">
<div class="input-group-prepend bg-greygrey">
<span class="input-group-text bg-greygrey text-white" id="inputGroup-sizing-sm">xlarge Size Amount</span>
</div>
<input type="number" name="xlargeMogul" value = '0'class="form-control bg-greygrey text-white" id="inputXLMA" min="0" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
<div class="input-group input-group-sm mb-3 bg-greygrey">
<div class="input-group-prepend bg-greygrey">
<span class="input-group-text bg-greygrey text-white" id="inputGroup-sizing-sm">xxlarge Size Amount</span>
</div>
<input type="number" name="xxlargeMogul" value = '0' class="form-control bg-greygrey text-white" id="inputXXLMA" min="0" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
<div class="form-group">
<label for="message-text" class="col-form-label-lg">Currently In Stock</label>
<input type="text" class="form-control bg-greygrey text-white " id="s1" readOnly>
</div>
<div class="form-group">
<label for="message-text" class="col-form-label"></label>
<input type="text" class="form-control bg-greygrey text-white " id="s2" readOnly>
</div>
<div class="form-group">
<label for="message-text" class="col-form-label"></label>
<input type="text" class="form-control bg-greygrey text-white " id="s3" readOnly>
</div>
<div class="form-group">
<label for="message-text" class="col-form-label"></label>
<input type="text" class="form-control bg-greygrey text-white " id="s4" readOnly>
</div>
<div class="form-group">
<label for="message-text" class="col-form-label"></label>
<input type="text" class="form-control bg-greygrey text-white " id="s5" readonly>
</div>
</form>
</div>
<div class="modal-footer">
<button type="submit" id = "submitMogul" name = "submitXMogul" value = "success" class="btn btn-grey text-white">Purchase</button>
<script>
async function PURCHASE_WINDOW_X() {
$('#submitMogul').attr('data-target','#exampleModal');
$("#exampleModal").modal('hide');
console.log('Hide me');
}
</script>
</div>
</div>
</div>
</div>
<div class="modal fade" id="errorwebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
Error
</div>
</div>
</div>
</div>
<div class="modal fade" id="ZERO_ORDER_MODAL" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
You are trying to purchase nothing. Please put atleast the number 1 into one of the size "Amount" inputs.
</div>
</div>
</div>
</div>
<div class="modal fade" id="successwebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
You've successfully Purchased a Specie Circle item<br>
You're now apart of the Specie DAO<br>
Here's your transaction link: <br> <a id="suchash" class = "text-yellow" href="" >Receipt</a><br>
</div>
</div>
</div>
</div>
<script>
function OPEN_SUCCESS_HASH() {
window.open(document.getElementById('suchash').href, '_blank');
};
</script>
<div class="modal fade" id="subwebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; right: 8px; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
Transaction Submitted<br>
Another window will pop up when transaction is confirmed<br>
Here's your transaction link: <br> <a id="subhash" class = "text-yellow" href="" >Confirmation</a><br>
</div>
<script>
function OPEN_SUB_HASH() {
window.open(document.getElementById('subhash').href, '_blank');
};
</script>
</div>
</div>
</div>
<div class="modal fade" id="nowebModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " style = "position: relative; ">
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
You don't have a Web 3.0 wallet installed.<br>
Please Install A Web 3.0 Wallet<br>
Try Installing <a class = "text-yellow" href="https://metamask.io/">MetaMask.<img style = " width: 30px; right: 10px;" src="pics/pic/meta.png"></a><br>
</div>
</div>
</div>
</div>
<div class="modal fade" id="connectModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true" style = "border-radius: 10px;">
<div class="modal-dialog modal-dialog-centered " >
<div class="modal-content bg-greygrey text-white" >
<div class="modal-body bg-greygrey text-white">
Connect Your Wallet!
</div>
</div>
</div>
</div>
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-transparent text-white animate__animated animate__fadeInDown">
<button class="btn blur blur-rounded btn-greygrey animate__animated " style = " position: relative;padding: 0px 0px; left: 0px " onclick = "changeImage(); "><img id="NEW_" src="pics/pic/new.png" width = "60px" style = "position: relative; border-radius: 0%; top: 0px; left:13px " >
<script>
function changeImage() {
var image1 = document.getElementById("SELLER_PLACE");
var NEW_1 = document.getElementById("NEW_");
var previousNEW_ = "pics/pic/new.png";
var previousIMG = "pics/pic/SPECIEMOGULHOODIE.png"
var newSrc = "https://ipfs.io/ipfs/QmZkYcQeimLyn7tSM6kGumxKgKvoZ6iS9LDarGoLCLUuKa?filename=Specie-new-23.gif";
var newNEW_ = "pics/pic/back.png";
if (image1.src.endsWith("SPECIEMOGULHOODIE.png")) {
const ctx = document.getElementById('myChart')
var image1 = document.getElementById("SELLER_PLACE");
var NEW_ = document.getElementById("NEW_");
image1.src = newSrc;
image1.style.borderRadius = "50px";
NEW_.src = newNEW_;
var ethbtn = document.getElementById('ineedit');
document.getElementById('mogsub').style.display = "none";
document.getElementById('PurchaseETH').style.display = "none";
document.getElementById('POLY_EMB').style.display = "none";
ctx.style.display = "none";
ethbtn.disabled = true;
document.getElementById('soon_display').style.display = "block";
ctx.data.datasets = [];
ctx.update();
}
else {
window.location.reload()
}
}
</script>
<a class="navbar-brand text-white" onclick = "connectx(); check(); ethereum.on('connect', () => window.location.reload());">
<button id = "buttoneth" value = "Connect" class="btn blur blur-rounded btn-grey" style = "font-size: 0px; padding: 0px 0px; "
onclick = "connectx(); check(); ">
<style>
.btn-greygrey {
background-color: #222222 !important;
}
.btn-uniblue {
background-color: rgba(76, 130, 251, 0.24) !important;
}
.btn-outline-retro {
color: #ffffff00;
border-color: #ffffff;
}
</style>
<img onload = "changex();" onclick = "connectx(); check();" src="pics/pic/goldensimage.png" id="Avatar" width = "50px" style = "position: relative; border-radius: 50%; top: 2px; left: 5px; ">
<a id = "connecteth" onclick = "connectx(); check();" class=" btn blur blur-rounded btn-greygrey text-white " style = "font-size: 15px;padding: 15px 15px; right: 8px; top:-5px; position: relative"> Connect
</a>
<script>
async function check() {
// Then get the currently selected radio button's value
console.log(window.ethereum)
if (window.ethereum !== undefined) {
// From now on, this should always be true:
// provider === window.ethereum
console.log(window.ethereum); // initialize your app
} else {
$("#nowebModal").modal('show');
}
// Check the value to make sure you want to show the modal
}
async function changex()
{
const accounts = await ethereum.request({ method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
if (chainIDs !== "0x89") {
document.getElementById("connecteth").style.fontSize = "x-small";
document.getElementById("connecteth").innerHTML = "Polygon Only";
switchChain("Polygon") ;
ethereum.on('chainChanged', (_chainId) => window.location.reload());
} else {
document.getElementById("connecteth").innerHTML = await accounts[0].substring(0,6) + "...";
document.getElementById("Avatar").src = "pics/pic/greenensimage.png";
}
}
async function switchChain(chains) {
const Polygon = [{ chainId: '0x89'}];
const PolygonID = '0x89' ;
var chainsx = { "Polygon" : Polygon};
var chainx = { "Polygon" : PolygonID};
var RPCchain = {'Polygon' : 'https://polygon-rpc.com'}
var symChain = {'Polygon' : 'MATIC'}
var expchain = {'Polygon' : 'https://polygonscan.io/'}
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: chainsx[chains]
}).catch(async (switchError) => {
// This error code indicates that the chain has not been added to MetaMask.
if (switchError.code === 4902) {
await ethereum.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId: chainx[chains],
chainName: chains,
nativeCurrency: {
name: chains,
symbol: symChain[chains],
decimals: 18
},
rpcUrls: [RPCchain[chains]],
blockExplorerUrls: [expchain[chains]]
}
]
});
}
// handle other "switch" errors
})
ethereum.on('chainChanged', (_chainId) => window.location.reload());
}
async function connectx() {
await ethereum
.request({ method: 'eth_requestAccounts' })
.then(changex)
.catch((err) => {
if (err.code === 4001) {
// EIP-1193 userRejectedRequest error
// If this happens, the user rejected the connection request.
console.log('Please connect to MetaMask.');
document.getElementById("connecteth").innerHTML = "Rejected";
} else {
console.error(err);
}
}).then((result) => { changex()});
};
</script>
<style>
.bg-darkgrey {
background-color: #333333 !important;
}
.btn-lightgrey {
background-color: #333333 !important;
}
</style>
</nav>
<script type="text/javascript">
async function changext()
{
const accounts = await ethereum.request({ method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
const web3 = new Web3(new Web3.providers.HttpProvider("https://polygon-mainnet.infura.io/v3/3ac1c65d7658459ebafe15361c77dbac"))
var inventory = new web3.eth.Contract(inventoryabi, addressInv);
var smallsizes = await inventory.methods.smallSizes().call({from: accounts[0]});
var medsizes = await inventory.methods.mediumSizes().call({from: accounts[0]});
var lsizes = await inventory.methods.largeSizes().call({from: accounts[0]});
var xlsizes = await inventory.methods.xlargeSizes().call({from: accounts[0]});
var xxlsizes = await inventory.methods.xxlargeSizes().call({from: accounts[0]});
var totalsupply = (parseInt(smallsizes) + parseInt(medsizes) + parseInt(lsizes) + parseInt(xlsizes) + parseInt(xxlsizes));
const w3 = new Web3(new Web3.providers.HttpProvider("https://cloudflare-eth.com"))
var oracle = new w3.eth.Contract(CHAINLINK_ORACLE_ABI, chainlink);
var latestRound = await oracle.methods.latestRound().call({from: accounts[0]}, function(error, res) {
if (error != null) {
console.log(error)
return;
} else {
console.log(res);
return res ;
}
});
await oracle.methods.getRoundData(latestRound).call({from: accounts[0]}, function(error, res) {
if (error != null) {
console.log(error)
return;
} else {
console.log(res['answer'])
return res ;
}
});
oracle.methods.latestAnswer().call({from: accounts[0]}, function(error, res) {
if (error != null) {
console.log(error)
return;
} else {
var data = res;
var pricex = (parseInt(data) / 100000000) * 121 ;
var price = parseInt(pricex) + (parseInt(pricex) * ((100 - parseInt(totalsupply)) / 100));
var ETH_PRICE = (121 + (121 * ((100 - parseInt(totalsupply)) / 100)))
console.log("Latest price was:" , price)}
console.log(parseInt(data));
document.getElementById("PurchaseETH").value = ETH_PRICE.toFixed(2);
document.getElementById("mogsub").value = "$" + price.toFixed(2);
console.log("Latest MATIC price: " + ETH_PRICE.toFixed(2) + " MATIC");
if (chainIDs !== "0x89") {
document.getElementById("connecteth").style.fontSize = "x-small";
document.getElementById("connecteth").innerHTML = "Polygon Only";
ethereum.on('chainChanged', (_chainId) => window.location.reload());
} else {
document.getElementById("connecteth").innerHTML = accounts[0].substring(0,12) + "...";
document.getElementById("Avatar").src = "pics/pic/greenensimage.png"
}
});
}
</script>
<!-- Masthead-->
<header id = "mastxhead" class="masthead ">
<div class="container d-flex h-100 align-items-center animate__animated animate__fadeInDown">
<div class="mx-auto text-center">
<img id = "SELLER_PLACE" onload = "changex();changext();" class="img-fluid " src="pics/pic/SPECIEMOGULHOODIE.png" width = "350" height = "350" alt="" >
<button id = "ineedit" class="btn blur blur-rounded btn-grey mogul-btn" style= "font-size: 1px; padding: 5px 20px; right: 5px; " data-toggle="modal" data-target="" data-whatever="@mdo"
onclick = "blackout(); blackout();">
<script>
async function blackout() {
if (window.ethereum !== undefined) {
contractCall();
$('#ineedit').attr('data-target','#exampleModal');
$("#exampleModal").modal('show');
} else {
console.log(window.ethereum)
$("#connectModal").modal('show');
}
}
async function PURCHASE_WINDOW_X() {
$('#SUBMITmOGUL').attr('data-target','#exampleModal');
$("#exampleModal").modal('hide');
}
</script>
<style>
.btn-greygrey {
background-color: #222222 !important;
}
.btn-darkgrey {
background-color: #464545 !important;
}
</style>
<input type = "button" class="btn text-white blur blur-rounded btn-grey" id = "PurchaseETH" style = "font-size: 11px; right: 20px; top: 0px; position: relative" onclick = "blackout(); " value = ""><img src="pics/pic/polygon.png" id = "POLY_EMB" width = "12px" style = "position: relative; border-radius: 0%; top: -2px; right:48px " >
</a>
<input type ="button" class="btn text-white blur blur-rounded btn-greygrey" id = 'mogsub' style = "font-size: 15px; left: 10px; top: 0px; position: relative" onclick = "blackout();" value ="Connect">
<input type ="button" class="btn text-white blur blur-rounded btn-greygrey" id = 'soon_display' style = "font-size: 15px; left: 10px; top: 0px; position: relative; display: none;" value ="Soon..">
</input>
<canvas id="myChart" width="0" height="0"></canvas>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min.js"></script>
<script>
async function SPECIE_SUPPLY_X_CHAINLINK_ORACLE()
{
const accounts = await ethereum.request({ method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
const web3 = new Web3(new Web3.providers.HttpProvider("https://goerli.infura.io/v3/3ac1c65d7658459ebafe15361c77dbac"))
const w3 = new Web3(new Web3.providers.HttpProvider("https://cloudflare-eth.com"))
var oracle = new w3.eth.Contract(CHAINLINK_ORACLE_ABI, chainlink);
oracle.methods.latestRound().call({from: accounts[0]}, function(error, res) {
if (error != null) {
console.log(error)
return;
} else {
console.log(res)
return res ;
}
});
oracle.methods.latestAnswer().call({from: accounts[0]}, function(error, res) {
if (error != null) {
console.log(error)
return;
} else {
var data = res;
console.log("Latest price was:" ,res)}
console.log(parseInt(data));
var pricex = (parseInt(data) / 100000000) * 121 ;
var price = parseInt(pricex) + (parseInt(pricex) * ((100 - parseInt(totalsupply)) / 100));
document.getElementById("mogsub").value = "$" + price.toFixed(2);
})
};
async function SPECIE_SUPPLY_CHART() {
const accounts = await ethereum.request({ method: 'eth_accounts' });
const chainIDs = await ethereum.request({method: 'eth_chainId'});
const web3 = new Web3(new Web3.providers.HttpProvider("https://polygon-mainnet.infura.io/v3/3ac1c65d7658459ebafe15361c77dbac"))
var inventory = new web3.eth.Contract(inventoryabi, addressInv);
var smallsizes = await inventory.methods.smallSizes().call({from: accounts[0]});
var medsizes = await inventory.methods.mediumSizes().call({from: accounts[0]});
var lsizes = await inventory.methods.largeSizes().call({from: accounts[0]});
var xlsizes = await inventory.methods.xlargeSizes().call({from: accounts[0]});
var xxlsizes = await inventory.methods.xxlargeSizes().call({from: accounts[0]});
var totalsupply = (parseInt(smallsizes) + parseInt(medsizes) + parseInt(lsizes) + parseInt(xlsizes) + parseInt(xxlsizes));
const ctx = document.getElementById('myChart').getContext('2d');
const ctV = document.getElementById('myChart');
ctV.width = "300";
ctV.height = "300";
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['S', 'M', 'L', 'XL', 'XXL'],
datasets: [{
label: 'Supply Amounts',
data: [parseInt(smallsizes), parseInt(medsizes), parseInt(lsizes), parseInt(xlsizes), parseInt(xxlsizes)],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
legend: {
labels: {
// This more specific font property overrides the global property
fontColor: 'white'
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
}
SPECIE_SUPPLY_CHART();
</script>
</div>
<style>
.btn-greygrey {
background-color: #222222 !important;
}
</style>
<script>
async function contractCall () {
const web3 = new Web3(new Web3.providers.HttpProvider("https://polygon-mainnet.infura.io/v3/3ac1c65d7658459ebafe15361c77dbac"))
const accounts = await ethereum.request({ method: 'eth_accounts' });
var inventory = new web3.eth.Contract(inventoryabi, addressInv)
var smallsizes = await inventory.methods.smallSizes().call({from: accounts[0]});
var medsizes = await inventory.methods.mediumSizes().call({from: accounts[0]});
var lsizes = await inventory.methods.largeSizes().call({from: accounts[0]});
var xlsizes = await inventory.methods.xlargeSizes().call({from: accounts[0]});
var xxlsizes = await inventory.methods.xxlargeSizes().call({from: accounts[0]});
document.getElementById("s1").value ='Small Sizes Supply: ' + smallsizes;
document.getElementById("s2").value ='Medium Sizes Supply: ' + medsizes;
document.getElementById("s3").value ='Large Sizes Supply: ' + lsizes;
document.getElementById("s4").value ='XLarge Sizes Supply: ' + xlsizes;
document.getElementById("s5").value ='XXLarge Sizes Supply: ' + xxlsizes;
}
async function currentSupply() {
const web3 = new Web3("https://cloudflare-eth.com")
}
</script>
</div>
</div>
</header>
<!-- About-->
<!-- Footer-->
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-auth.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.7.1/firebase-analytics.js"></script>
<script>
const firebaseConfig = {
};
firebase.initializeApp(firebaseConfig)
</script>
<script src="https://cdn.jsdelivr.net/npm/@metamask/detect-provider"></script>
<!-- Bootstrap core JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/utf8/3.0.0/utf8.js" integrity="sha512-TpkRcfygox9TaC40D5Nu9CQElI7PaQ9d+/RrhWccgvktjgh/HITPo+VZ+xQc98DZbiR3Ct/z9BHXAp/m88j/kw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/utf8/3.0.0/utf8.min.js" integrity="sha512-Up/VFqLmUsS5GMd4XTuxE6NsCsBJlPv12A9apHDqRx8v/x+++Qmmg2M1kTs8cQztxHk0d/rgAqmVOjzEKBZH7A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js"></script>
<!-- Third party plugin JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/metaAcct.js"></script>
<script type="text/javascript" src="js/ABI_SPECIE.2.js"></script>
<script type="text/javascript" src="js/customerInfo.js"></script>
</body>
</html>