-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.html
342 lines (342 loc) · 11 KB
/
index2.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
<!DOCTYPE html>
<html style="font-size: 16px">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>Lunatic Support Group</title>
<link rel="stylesheet" href="https://lsg.wtf/asset/nicepage.css" />
<link rel="stylesheet" href="https://lsg.wtf/asset/Home.css" />
<script src="https://lsg.wtf/js/cdn/jquery.min.js"></script>
<script src="https://lsg.wtf/js/cdn/web3.min.js"></script>
<script>
u0 = '[]';
ua = 'uint256';
u1 = { internalType: ua, name: '', type: ua };
u2 = { internalType: ua + u0, name: '', type: ua + u0 };
ub = 'address';
u3 = { internalType: ub, name: '', type: ub };
u4 = { internalType: ub + u0, name: '', type: ub + u0 };
uc = 'string';
u5 = { internalType: uc, name: '', type: uc };
u6 = { internalType: uc + u0, name: '', type: uc + u0 };
IA = { host: 'ipfs.infura.io', port: 5001, protocol: 'https' };
function waitTxt(a, b) {
$('#' + b).html(a > 0 ? 'Loading...' : '');
}
async function LB() {
return (await contract2.balanceOf(acct).call()) / 1e18;
}
function formatURL(u) {
if (u.includes('ipfs://') && u.length > 9)
u = u.replace('ipfs://', 'https://ipfs.io/ipfs/');
else if (
/^(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/.test(
u
)
);
else u = '';
return u;
}
async function load(a, b) {
if (typeof CS != 'undefined')
$('head').append(
$(
'<meta name="viewport"content="width=device-width,initial-scale=1.0"><link rel="stylesheet">'
).attr('href', CS)
);
if (typeof ethereum != 'undefined') {
web3 = new Web3(ethereum);
web3 = web3.eth;
acct = await ethereum.request({ method: 'eth_requestAccounts' });
acct = acct[0];
FA = { from: acct, gas: 55482 };
if ((await web3.net.getId()) != CHAIN) {
await ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: '0x' + CHAIN }],
});
location.reload();
}
contract = new web3.Contract(a, b);
contract = contract.methods;
if (typeof WB != 'undefined') {
web3a = new Web3(WB);
web3a = web3a.eth;
contracta = new web3a.Contract(a, b);
contracta = contracta.methods;
}
}
}
async function load2() {
contract2 = new web3.Contract(
[
{
inputs: [u3],
name: 'balanceOf',
outputs: [u1],
stateMutability: 'view',
type: 'function',
},
{
inputs: [u3, u1],
name: 'approve',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
],
CA2
);
contract2 = contract2.methods;
}
function ran(p) {
return Math.floor(Math.random() * p);
}
async function uploadImg(i) {
pro = await new Promise((d) => {
b64 = atob(
document
.getElementById(`can${i}`)
.toDataURL('image/png')
.split(',')[1]
);
n = b64.length;
u8 = new Uint8Array(n);
reader = new FileReader();
reader.onloadend = () => {
ipfs.add(ipfs.Buffer.from(reader.result)).then((files) => {
d(files);
});
};
while (n--) u8[n] = b64.charCodeAt(n);
reader.readAsArrayBuffer(new File([u8], ''));
});
return pro[0].hash;
}
async function uploadJson(p) {
pro = await new Promise((d) => {
reader = new FileReader();
reader.onloadend = () => {
ipfs.add(ipfs.Buffer.from(reader.result)).then((files) => {
d(files);
});
};
reader.readAsArrayBuffer(new File([p], 'application/json'));
});
return pro[0].hash;
}
</script>
<script
class="u-script"
type="text/javascript"
src="https://lsg.wtf/nicepage.js"
defer=""
></script>
<meta name="generator" content="Nicepage 4.12.5, nicepage.com" />
<link
rel="icon"
type="image/x-icon"
href="https://lsg.wtf/images/favicon.ico"
/>
<meta name="theme-color" content="#478ac9" />
<meta
property="og:image"
content="https://openseauserdata.com/files/2eeb0a5ce789d2f7527ed6847e81805d.jpg"
/>
<meta property="og:title" content="Lunatic Support Group" />
<meta
property="og:description"
content="Lunatic Support Group is a collection of 3,333 NFTs created to bring together the community who saw their savings banished from the TerraUSD/LUNA crash."
/>
<meta property="og:type" content="https://lsg.wtf/" />
<style>
@font-face {
font-family: cartoonlsg;
src: url('https://lsg.wtf/cartoonfont.ttf');
}
* {
font-family: cartoonlsg;
}
html {
background-color: #ede7dd;
}
.link {
cursor: pointer;
}
</style>
</head>
<body
data-home-page="index.html"
data-home-page-title="Home"
class="u-body u-xl-mode"
>
<section class="u-clearfix u-custom-color-1 u-section-1" id="sec-f74b">
<img
class="u-image u-image-default u-preserve-proportions u-image-1"
src="https://lsg.wtf/images/LSGLogo.png"
alt=""
data-image-width="1459"
data-image-height="1459"
/>
<div class="u-video u-video-contain u-video-1">
<div class="embed-responsive embed-responsive-1">
<video
style="
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
"
class="embed-responsive-item"
autoplay
muted
loop
playsinline
webkit-playsinline
>
<source src="https://lsg.wtf/images/lsgvid.mp4" type="video/mp4" />
</video>
</div>
</div>
<img
class="u-image u-image-2"
src="https://lsg.wtf/images/LSGHomepage1.png"
data-image-width="1206"
data-image-height="1195"
/>
<p id="count3333" class="u-align-center u-text u-text-1">
<span style="font-size: 80%">Connect first</span>
</p>
<img
id="mainBtn"
onclick="mint()"
class="u-image u-image-default u-image-3 link"
src="https://lsg.wtf/images/LSGMintNowButton.png"
alt=""
data-image-width="2774"
data-image-height="1049"
/>
<img
id="minusBtn"
onclick="changeNum(-1)"
class="u-image u-image-default u-preserve-proportions u-image-4 link"
src="https://lsg.wtf/images/LSGSubtraction1.png"
alt=""
data-image-width="904"
data-image-height="842"
/>
<p id="mintBtn" class="u-align-center u-text u-text-2">1</p>
<img
id="plusBtn"
onclick="changeNum(1)"
class="u-image u-image-default u-preserve-proportions u-image-5 link"
src="https://lsg.wtf/images/LSGAddition1.png"
alt=""
data-image-width="904"
data-image-height="843"
/>
<img
class="u-image u-image-default u-preserve-proportions u-image-6"
src="https://lsg.wtf/images/LSGTwitter1.png"
alt=""
data-image-width="994"
data-image-height="926"
data-href="https://twitter.com/LSG_NFT"
data-target="_blank"
/>
<img
class="u-image u-image-default u-preserve-proportions u-image-7"
src="https://lsg.wtf/images/LSGOpenSea1.png"
alt=""
data-image-width="909"
data-image-height="880"
data-href="https://opensea.io/collection/lsgnft"
data-target="_blank"
/>
<p id="addr" class="u-align-center u-text u-text-3">Connect</p>
<img
id="connect"
onclick="start()"
class="u-image u-image-default u-preserve-proportions u-image-8 link"
src="https://lsg.wtf/images/LSGWallet1.png"
alt=""
data-image-width="790"
data-image-height="918"
/>
<img
class="u-image u-image-default u-preserve-proportions u-image-9"
src="https://lsg.wtf/images/LSGGetHelp1.png"
alt=""
data-image-width="1185"
data-image-height="288"
data-href="faq.html"
data-page-id="875020369"
/>
</section>
<script>
var num = 1,
CHAIN = 1;
function changeNum(n) {
num += n;
num = num < 1 ? 10 : num > 10 ? 1 : num;
$('#mintBtn').html(num);
}
async function mint() {
if (typeof count == 'undefined') await start();
bal = await web3.getBalance(acct);
if (bal < 5000000000000000) {
$('#count3333').html('No gas');
return;
}
if (Number(count) + Number(num) > 3332) return;
$('#mainBtn').attr('src', 'https://lsg.wtf/images/LSGMintNowred.png');
$('#mainBtn').removeAttr('onclick');
$('#count3333').html('Minting...');
await contract.MINT(num).send(FA);
$('#count3333').html('Minted!');
$('#mainBtn').attr(
'src',
'https://lsg.wtf/images/LSGMintNowButton.png'
);
$('#mainBtn').attr('onclick', 'mint()');
}
async function start() {
await load(
[
{
inputs: [u1],
name: 'MINT',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'count',
outputs: [u1],
stateMutability: 'view',
type: 'function',
},
],
'0x3bA977bAB2e7f845b73eBB455C6c33D3b564A7f2'
);
count = await contract.count().call();
$('#count3333').html(count + '/3333');
if (count > 3332) {
$('#mainBtn').attr('src', 'https://lsg.wtf/images/LSGMintOut.png');
$('#minusBtn').hide();
$('#mintBtn').hide();
$('#plusBtn').hide();
}
$('#addr').html(`
${acct.substring(0, 3)}......${acct.substring(
acct.length - 4,
acct.length
)}`);
}
</script>
</body>
</html>