-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.html
executable file
·676 lines (568 loc) · 38.7 KB
/
settings.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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Wizdwarfs</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" >
<link rel="shortcut icon" type="image/png" href="/images/favicon.png">
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300&family=Roboto+Mono:wght@500&display=swap" rel="stylesheet">
<link rel='stylesheet' type='text/css' href='/css/settings.css'>
<script src="https://cdn.jsdelivr.net/npm/fortmatic@latest/dist/fortmatic.js"></script>
<script src="https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.js"></script>
<script src="https://cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js"></script>
<!-- <script src='/js/main.js'></script> -->
</head>
<body>
<div class='main-dashboard-div'>
<nav class="navbar navbar-expand-md navbar-light custom-navbar">
<a class="navbar-brand" href="/">
<img src="/images/logo.png" alt="Logo" class="logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown" style="position: absolute;left: 37pc;">
<ul class="navbar-nav">
<li class="nav-item active pl-3">
<a class="nav-link" href="/dashboard">
<i class="fa fa-home icon-light" aria-hidden="true"></i>
</a>
</li>
<li class="nav-item dropdown pl-3">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fa fa-envelope" aria-hidden="true"></i>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item active" href="/messages" title="Private. These message will dispear after few seconds."><i class="fa fa-envelope-o" aria-hidden="true"></i> Private </a>
<a class="dropdown-item" href="/messages" title="Gossips"> <i class="fa fa-comments-o" aria-hidden="true"></i> Public </a>
</div>
</div>
</li>
<li class="nav-item dropdown pl-3">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fa fa-circle-user" aria-hidden="true"></i>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item active" href="/dashboard/profile" title="User will edit any information in the profile"><i class="fa fa-sliders" aria-hidden="true"></i>
Edit Your Profile
</a>
<a class="dropdown-item" href="/logout" title="Lock the account"><i class="fa fa-sign-out icon icon-light"
aria-hidden="true"></i>Logout</a>
</div>
</li>
</ul>
</div>
</nav>
</div>
<div class="menu-container" style="display: flex;position: absolute;top: 34pc;left: 35pc;color: transparent;">
<div class="btn-group dropup">
<button type="button" class="security-button dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Security protocols" style="border: none;color: slategray;">
<i class="fa fa-lock" aria-hidden="true"></i>
</button>
<div class="dropdown-menu" style="border-radius: 18px;">
<button class="dropdown-item capture" type="button">
<i class="fa fa-camera" style="color: slategray;"></i> Face capture
</button>
<button class="dropdown-item analysis" type="button">
<i class="fa fa-fingerprint" style="color: slategray;"></i> Fingerprint
</button>
</div>
</div>
<button class="button" class="notify" title="Alerts" style="border: none;color: slategray;position: relative;left: 2pc;">
<i class="fa fa-bell"></i>
</button>
<div class="btn-group dropup">
<button class="button" class="wallet dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Monetary Exchange" style="border: none;color: slategray;position: relative;left: 4pc;">
<i class="fa fa-helicopter"></i>
</button>
<div class="dropdown-menu" style="border-radius: 18px;">
<button class="dropdown-item buy" type="button">
<i class="fa fa-coins" style="color: slategray;"></i> Send
</button>
<button class="dropdown-item refund" type="button">
<i class="fa fa-coins" style="color: slategray;"></i> Refund
</button>
</div>
</div>
<div class="button-group dropup">
<button class="button" class="art dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Virtual Exchange" style="border: none;color: slategray;position: relative;left: 6pc;">
<i class="fa fa-palette"></i>
</button>
<div class="dropdown-menu" style="border-radius: 18px;">
<button class="dropdown-item" type="button">
<i class="fa fa-globe" style="color: slategray;"></i> Hand-shake
</button>
<button class="dropdown-item art" type="button">
<i class="fa fa-paintbrush" style="color: slategray;"></i> NFT
</button>
<button class="dropdown-item market" type="button">
<i class="fa fa-coins" style="color: slategray;"></i> Marketplace
</button>
</div>
</div>
<button class="button" class="keys" title="Keys" style="border: none;color: slategray;position: relative;left: 8pc;">
<i class="fa fa-key"></i>
</button>
</div>
</div>
<div class=renderer style="display: flex;position: absolute;top: 8pc;left: 18pc;width: 50pc;height: 25.5pc;">
<div class="pcontainer" style="display: flex;position: absolute;top: 4pc;height: 20pc;background: whitesmoke;width: 27pc; border-radius: 45px; visibility: hidden;">
<i class="fa fa-fingerprint" style="display: flex;position: inherit;top: 11pc;color: silver;transform: scale(15);left: 13pc;"></i>
</div>
<div class="linebar" style="position: inherit;width: 8pc;height: .2pc;top: 8pc;left: 9pc;background: green;border-radius: 10px; visibility: hidden;"></div>
<span class="browser-print" style="display: flex;position: inherit;top: 5pc;left: 15pc;color: slategray;"></span>
<div class="face-container" style="display: flex;position: absolute;top: 4pc;height: 20pc;background: whitesmoke;width: 27pc; border-radius: 45px; visibility: hidden;">
<video id="video"></video>
<button type="button" class="capture_moment" style="display: flex;position: inherit;top: 3pc;left: 24pc;border: none;color: slategray;">
<i class="fa fa-camera"></i>
</button>
<canvas id="canvas" style="display: flex;position: absolute;left: 45pc;width: 22pc;height: 20pc;border-radius: 45px;visibility: hidden;">
</canvas>
<div class="output-container" style="position: absolute;left: 27pc;">
<img id="output"/>
</div>
</div>
<div class="transact" style="visibility: hidden;display: flex;position: initial;width: 46pc;">
<div class="transact-container" style="position: inherit;display: flex;width: 46pc;">
<input type="text" placeholder="Service Link" class="product_buyer" id="product_buyer" style="display: flex;position: absolute;width: 39pc;height: 4pc;top: 7pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;"/>
<input type="text" placeholder="Description" class="product_description" id="product_description" style="display: flex;position: absolute;width: 39pc;height: 4pc;top: 14pc;left: 7pc;border: none;border-radius: 10pc; color:slategray;"/>
<input type="number" placeholder="100 Ethereum" class="bought" id="bought" style="display: flex;position: absolute;width: 31pc;height: 4pc;top: 20pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;"/>
<!-- <input type="checkbox" class="provider" id="provider" style="display: flex;position: absolute;height: 2pc;top: 21pc;left: 42pc;color:slategray;transform: scale(2.5);">
<label class="checkbox-label" for="provider" style="display: flex;position: absolute;width: 31pc;height: 4pc;top: 19pc;left: 40pc;color:slategray;"> Metamask </label> -->
</div>
</div>
<div class="refunding-container" style="visibility: hidden;display: flex;position: absolute;width: 46pc;">
<div class="container" style="position: inherit;">
<input type="date" class="date_time" style="display: flex;position: absolute;width: 39pc;height: 4pc;top: 7pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;">
<input type="text" placeholder="Service Link" class="report" style="display: flex;position: absolute;width: 39pc;height: 4pc;top: 14pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;">
<input type="number" placeholder="Refund amount" min="0.0001" class="refund-value" style="display: flex;position: absolute;width: 39pc;height: 4pc;top: 21pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;">
</div>
</div>
<div class="assets-container" style="visibility: hidden;display: flex;position: absolute;width: 46pc;">
<div class="container" style="position: inherit;">
<input type="text" placeholder="Token Name" class="token" id="token" style="display: flex;position: absolute;width: 12pc;height: 4pc;top: 7pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;">
<input type="text" placeholder="NFT Object Links (NOLs)" class="nfturl" id="nfturl" style="display: flex;position: absolute;width: 20pc;height: 4pc;top: 7pc;left: 20pc;border: none;border-radius: 10pc;color:slategray;">
<input type="number" placeholder="Auction Starting value" class="price" id="price" style="display: flex;position: absolute;width: 33pc;height: 4pc;top: 12pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;">
<input type="text" placeholder="Description" class="description" id="description" style="display: flex;position: absolute;width: 33pc;height: 4pc;top: 17pc;left: 7pc;border: none;border-radius: 10pc;color:slategray;">
</div>
</div>
<div class="market-container" style="visibility: hidden;display: flex;position: absolute;width: 46pc;">
<div class="container" style="position: inherit;">
<a href="#" class="Artists" title="My collectibles" style="display: flex;position: inherit;top: 8pc;left: 16pc;color: darkslategray;width: 15pc;height: 14pc;border: 1px slategrey;border-radius: 10pc;">
<i class="fa fa-paintbrush" style="position: inherit;top: 6pc;left: 4pc;transform: scale(2.5);"></i>
</a>
<a href="#" class="Community" title="Claim Ownership" style="display: flex;position: inherit;top: 8pc;left: 29pc;color: darkslategray;width: 15pc;height: 14pc;border: 1px slategrey;border-radius: 10pc;">
<i class="fa fa-users" style="position: inherit;top: 6pc;left: 4pc;transform: scale(2.5);"></i>
</a>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
// attributes
const _a01 = document.getElementsByClassName('analysis')[0];
const _p01 = document.getElementsByClassName('pcontainer')[0];
const _scan = document.getElementsByClassName('linebar')[0];
const _sp01 = document.getElementsByClassName('browser-print')[0];
// special-attributes
let audio_ctx = null;
let oscillator = null;
let dymanicCompressor = null;
let samples = null;
// output
let hash = 0;
// whenever user clicked on fingerprint button; either fingerprint already scanned then it change initial state => closed state
_a01.addEventListener('click', (event) =>{
// but the this case it inverse of the above state
if (_p01.style.visibility == 'hidden'){
// show scanner and start scan browser print
_p01.style.visibility = 'visible';
_scan.style.visibility = 'visible';
// Either User used Chrome, Firefox or Safari
const AudioContext = window.OfflineAudioContext || window.webkitAudioContext;
// create audio wave {channels = 1, samplingRate = 5000, waveform per second = 44100}
audio_ctx = new AudioContext(1, 5000, 44100);
// create oscillator {type = 'sine', frequency = 430hz}
oscillator = audio_ctx.createOscillator();
oscillator.type = 'sine';
oscillator.frequency.value = 430;
// create compressor {threshold = -36db, knee = 26db, ratio = 11.7db, attack = 0.102s, release = 0.226s}
dymanicCompressor = audio_ctx.createDynamicsCompressor();
dymanicCompressor.threshold.value = -36;
dymanicCompressor.knee.value = 26;
dymanicCompressor.ratio.value = 11.7;
dymanicCompressor.attack.value = 0.102;
dymanicCompressor.release.value = 0.226;
// connect components
oscillator.connect(dymanicCompressor);
dymanicCompressor.connect(audio_ctx.destination);
// start oscillator
oscillator.start();
// when a waveform complete
audio_ctx.oncomplete = event =>{
samples = event.renderedBuffer.getChannelData(0);
for (let i=0; i < samples.length; i++){
hash += Math.abs(samples[i]);
}
setTimeout(function(){
if (hash > 2500){
_p01.children[0].style.color = 'green';
_scan.style.background = 'red';
_sp01.innerHTML = hash;
}else{
_p01.children[0].style.color = 'red';
_scan.style.background = 'green';
_sp01.innerHTML = hash;
}
}, 20000);
}
audio_ctx.startRendering();
}else{
_p01.style.visibility = 'hidden';
_scan.style.visibility = 'hidden';
}
});
</script>
<script>
// html attributes
const _p02 = document.getElementsByClassName('face-container')[0];
const _b02 = document.getElementsByClassName('capture')[0];
// local variables
let video, canvas, photo = null;
let capture_moment = null;
// capture your face
_b02.addEventListener('click', event =>{
if (_p02.style.visibility == 'hidden'){
_p02.style.visibility = 'visible';
video = document.getElementById('video');
canvas = document.getElementById('canvas');
capture_moment = document.getElementsByClassName('capture_moment')[0];
photo = document.getElementById('output');
canvas.style.visibility = 'visible';
// photoframe attributes
var width = 352;
var height = 320;
// open webcame & record frames per sec
navigator.mediaDevices.getUserMedia({ video : true, audio : false}).then((renderbytes) =>{
video.srcObject = renderbytes;
video.play();
}).catch((error) =>{
alert("Error ! check your permission #??? ");
});
// readjust frame attributes
let stream = false;
video.addEventListener('canplay', (event) =>{
if (!stream) {
video.setAttribute('width', width);
video.setAttribute('height', height);
canvas.setAttribute('width', width);
canvas.setAttribute('height', height);
stream = true;
}
});
// capture image
capture_moment.addEventListener('click', (event) => {
// capture moment
if (width && height) {
canvas.width = width;
canvas.height = height;
var context = canvas.getContext('2d');
context.drawImage(video, 0, 0, width, height);
var data = canvas.toDataURL('image/png');
canvas.style.visibility = 'hidden';
canvas.fillStyle = '#FFF';
photo.setAttribute('src', data);
}else{
// clear the picture before renderering
var context = canvas.getContext('2d');
context.fillStyle = "#AAA";
context.fillRect(0, 0, canvas.width, canvas.height);
var data = canvas.toDataURL('image/png');
photo.setAttribute('src', data);
}
// event.preventDefault();
});
}else{
_p02.style.visibility = 'hidden';
}
});
</script>
<script>
// html tag attributes
const _i01 = document.getElementsByClassName('bought')[0];
const _p03 = document.getElementsByClassName('transact')[0];
const _b03 = document.getElementsByClassName('buy')[0];
// const _i02 = document.getElementsByClassName('provider')[0];
const _i03 = document.getElementsByClassName('product_buyer')[0];
// const attributes
const API_KEY = "pk_test_1089727802E62684";
const Production_API_KEY = "pk_live_59E7F894747B33ED";
// local attributes
let valid_price = 0.00;
// when user trigger send event over.
_b03.addEventListener('click', (event) => {
if (_p03.style.visibility === 'hidden'){_p03.style.visibility = 'visible';
// check whether price field is empty
_i01.addEventListener('change', (event) => {
// this condition proceed the transaction if & if this true
if (_i01.value > 0.000001) {
// direct call fortmatic wallet
var fort_wallet, web3eth = null;
fort_wallet = new Fortmatic(API_KEY);
// create provider object for web3
web3eth = new Web3(fort_wallet.getProvider());
// create batch process object for transaction
var batch = new web3eth.eth.BatchRequest();
// if user browser have formatic gateway access then login user account. If account is not created then create
if(!fort_wallet.getProvider().isFortmatic){alert('Fortmatic is not installed'); return}
console.log("application connect with fortmatic provider");
console.log(web3eth.currentProvider.enable());
fort_wallet.user.login().then(()=>{
var isLogin = fort_wallet.user.isLoggedIn();
// when a user login , get the public address
if(!isLogin){alert("Fortnight account login Fail"); return}
web3eth.eth.getAccounts().then((account)=>{
// read user account information
web3eth.eth.getBalance(account[0]).then((balance)=>{
// if user account have zero balance
let balance_status = balance < _i01.value ? true : false;
if(!balance_status) {alert("You have " + balance + " balance." ); return}
// compose invoice
var txs = {
to : '0x55057eb78fDbF783C961b4AAd6A5f8BC60cab44B',
from : account[0],
value : web3eth.utils.toWei(_i01.value, 'ether'),
}
// user invoice wait for gateway action after place in batch job
batch.add(web3eth.eth.sendTransaction.request(txs), (error, signed)=>{
if (error) throw error;
console.log("message signed: " + signed);
});
// perform invoice in batch mode
batch.execute();
});
});
});
}
});
}else{_p03.style.visibility = 'hidden';}
});
</script>
<script>
// html attributes
const _b04 = document.getElementsByClassName('refund')[0];
const _p04 = document.getElementsByClassName('refunding-container')[0];
// html input attributes
const _i04 = document.getElementsByClassName('date_time')[0];
const _i05 = document.getElementsByClassName('report')[0];
const _i06 = document.getElementsByClassName('refund-value')[0];
// erc20token evmcode
const erc20ABI = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":false,"inputs":[{"name":"spender","type":"address"},
{"name":"tokens","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":false,"inputs":[{"name":"from","type":"address"},{"name":"to","type":"address"},
{"name":"tokens","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[],"name":"_totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeSub","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},
{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeDiv","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},
{"constant":false,"inputs":[{"name":"spender","type":"address"},{"name":"tokens","type":"uint256"},{"name":"data","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeMul","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},
{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":false,"inputs":[{"name":"tokenAddress","type":"address"},{"name":"tokens","type":"uint256"}],"name":"transferAnyERC20Token","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"constant":true,"inputs":[{"name":"tokenOwner","type":"address"},{"name":"spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},
{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"safeAdd","outputs":[{"name":"c","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},
{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},
{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},
{"payable":true,"stateMutability":"payable","type":"fallback"},
{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},
{"indexed":true,"name":"_to","type":"address"}],"name":"OwnershipTransferred","type":"event"},
{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},
{"indexed":true,"name":"to","type":"address"},
{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Transfer","type":"event"},
{"anonymous":false,"inputs":[{"indexed":true,"name":"tokenOwner","type":"address"},
{"indexed":true,"name":"spender","type":"address"},
{"indexed":false,"name":"tokens","type":"uint256"}],"name":"Approval","type":"event"}];
// refund clicked
_b04.addEventListener('click', (event) => {
if(_p04.style.visibility === 'hidden'){
_p04.style.visibility = 'visible';
// valid attributes
if (!_i04.value === ''){ alert("Transaction date:", _i04.value); return}
if (!_i05.value === ''){ alert("Issue you had faced:", _i05.value); return }
if (!_i06.value === ''){ alert("Refund value should be greater than 0.0001"); return}
// trigger event
_i06.addEventListener('change', (event)=>{
if (!_i06.value > 0.000001){ alert('Refund value is too low for transaction'); return}
var _wallet, web3 = null;
_wallet = new Fortmatic(API_KEY);
// create provider object for web3
web3 = new Web3(_wallet.getProvider());
// if user browser have formatic gateway access then login user account. If account is not created then create
if(!_wallet.getProvider().isFortmatic){alert('Fortmatic is not installed'); return}
console.log("application connect with fortmatic provider");
console.log(web3.currentProvider.enable());
_wallet.user.login().then(()=>{
var isLogin = _wallet.user.isLoggedIn();
// when a user login , get the public address
if(!isLogin){alert("Fortnight account login Fail");}
// check organization balance if that is not enough then regard your request
web3.eth.getBalance('0x55057eb78fDbF783C961b4AAd6A5f8BC60cab44B').then((balance) => {
let balance_status = balance > _i06.value ? true : false;
if (!balance_status) {alert('Retry operation! Process cannot be completed'); return}
// if organization have enough balance then generate address
let generate_address = new web3.eth.abi.encodeEventSignature('refund(string)');
console.log("Generate Address:", generate_address);
// generated address attached with new contract that execute on evm.
let contract_address = new web3.eth.Contract([],generate_address, {
from : '0x55057eb78fDbF783C961b4AAd6A5f8BC60cab44B',
gasPrice : 0.00002,
});
console.log("Contract Address:", contract_address);
// execute contract on evm after attached user wallet address
let _contractToken = new web3.eth.Contract(erc20ABI, contract_address);
web3.eth.getAccounts().then((accounts)=>{
const _toAddress = accounts[0];
console.log("Account:", _toAddress);
// calculate contract fees
let _tokenDec = web3.utils.toBN(18);
let _tokenAmountRefund = web3.utils.toBN(_i06.value);
// let _tokenApproveAmount = web3.utils.toBN(_i06.value);
let _tokenCalculatedTransferValue = web3.utils.toHex(_tokenAmountRefund.mul(web3.utils.toBN(10).pow(_tokenDec)));
let _tokenCalculatedValue = web3.utils.toHex(_tokenAmountRefund.mul(web3.utils.toBN(10).pow(_tokenDec)));
const clone_account = _toAddress;
// refund money will be approve
_contractToken.methods.approve(_toAddress, _tokenCalculatedTransferValue)
.send({
from: clone_account,
})
.once('transactionHash', (hash)=>{
console.log(hash);
})
.once('receipt', (receipt)=>{
console.log(receipt);
});
// refund money will be refunded
_contractToken.methods.transfer(_toAddress, _tokenCalculatedValue).send({
from : clone_account,
}).once('transactionHash', (hash)=>{
console.log(hash);
}).once('receipt', (receipt)=>{
console.log(receipt);
});
});
});
});
});
}else{
_p04.style.visibility = 'hidden';
}
});
</script>
<script>
const _p05 = document.getElementsByClassName('assets-container')[0];
const _b05 = document.getElementsByClassName('art')[0];
const _i07 = document.getElementsByClassName('token')[0];
const _i08 = document.getElementsByClassName('nfturl')[0];
const _i09 = document.getElementsByClassName('price')[0];
const _i10 = document.getElementsByClassName('description')[0];
_b05.addEventListener('click', (event) =>{
if (_p05.style.visibility === 'hidden'){
_p05.style.visibility = 'visible';
if (! _i07.value === ''){ alert('Token should not be empty'); }
if (!_i08.value === ''){ alert('NFT URL is not specificed'); }
if (!_i09.value < 0.0001){ alert('Auction value is not specified');}
if (!_i10.value === ''){ alert('Description is too short'); }
if (_i09.value < 0.00){ alert('Auction value must be between 1 and 100');}
_i09.addEventListener('change', (event)=>{
// direct call fortmatic wallet
var fort_wallet, web3eth = null;
fort_wallet = new Fortmatic(API_KEY);
// create provider object for web3
web3eth = new Web3(fort_wallet.getProvider());
// create batch process object for transaction
var batch = new web3eth.eth.BatchRequest();
// different chain (this chain only for nfts);
web3eth.eth.defaultHardfork = 'istanbul';
// if user browser have formatic gateway access then login user account. If account is not created then create
if(!fort_wallet.getProvider().isFortmatic){alert('Fortmatic is not installed'); return}
console.log("application connect with fortmatic provider");
console.log(web3eth.currentProvider.enable());
fort_wallet.user.login().then(()=>{
var isLogin = fort_wallet.user.isLoggedIn();
// when a user login , get the public address
if(!isLogin){alert("Fortnight account login Fail"); return}
web3eth.eth.getAccounts().then((account)=>{
// read user account information
web3eth.eth.getBalance(account[0]).then((balance)=>{
// if user account have zero balance
let balance_status = balance < (_i09.value + 0.0002) ? true : false;
if(!balance_status) {alert("You have " + balance + " balance." ); return}
// compose invoice
var txs = {
to : '0x55057eb78fDbF783C961b4AAd6A5f8BC60cab44B',
from : account[0],
value : web3eth.utils.toWei(_i09.value, 'ether'),
}
// user invoice wait for gateway action after place in batch job
batch.add(web3eth.eth.sendTransaction.request(txs), (error, signed)=>{
if (error) throw error;
web3eth.eth.sign(txs, txs.from);
});
// NFT MINT FEES
var fees = {
to : '0x55057eb78fDbF783C961b4AAd6A5f8BC60cab44B',
from : account[0],
value : web3eth.utils.toWei(_i09.value * 0.2, 'ether'),
}
// NFT Fees reduction
batch.add(web3eth.eth.sendTransaction.request(fees), (error, signed)=>{
if (error) throw error;
web3eth.eth.sign(fees, fees.to);
});
// perform invoice in batch mode
batch.execute();
web3eth.eth.getBlockNumber().then((blocknum)=>{
web3eth.eth.getBlock(blocknum).then((info)=>{
console.log("Block information: " , info);
});
});
});
});
});
});
}else{
_p05.style.visibility = 'hidden';
}
});
</script>
<script>
const _b06 = document.getElementsByClassName('market')[0];
const _p06 = document.getElementsByClassName('market-container')[0];
_b06.addEventListener('click', (event) => {
if (_p06.style.visibility === 'hidden'){
_p06.style.visibility = 'visible';
}else{
_p06.style.visibility = 'hidden';
}
})
</script>
</body>
</html>