ETH Price: $3,296.12 (+0.27%)

Contract Diff Checker

Contract Name:
KIMPSONS

Contract Source Code:

File 1 of 1 : KIMPSONS

/*



 .----------------.  .----------------.  .----------------.  .----------------.  .----------------.  .----------------.  .-----------------. .----------------. 
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |
| |  ___  ____   | || |     _____    | || | ____    ____ | || |   ______     | || |    _______   | || |     ____     | || | ____  _____  | || |    _______   | |
| | |_  ||_  _|  | || |    |_   _|   | || ||_   \  /   _|| || |  |_   __ \   | || |   /  ___  |  | || |   .'    `.   | || ||_   \|_   _| | || |   /  ___  |  | |
| |   | |_/ /    | || |      | |     | || |  |   \/   |  | || |    | |__) |  | || |  |  (__ \_|  | || |  /  .--.  \  | || |  |   \ | |   | || |  |  (__ \_|  | |
| |   |  __'.    | || |      | |     | || |  | |\  /| |  | || |    |  ___/   | || |   '.___`-.   | || |  | |    | |  | || |  | |\ \| |   | || |   '.___`-.   | |
| |  _| |  \ \_  | || |     _| |_    | || | _| |_\/_| |_ | || |   _| |_      | || |  |`\____) |  | || |  \  `--'  /  | || | _| |_\   |_  | || |  |`\____) |  | |
| | |____||____| | || |    |_____|   | || ||_____||_____|| || |  |_____|     | || |  |_______.'  | || |   `.____.'   | || ||_____|\____| | || |  |_______.'  | |
| |              | || |              | || |              | || |              | || |              | || |              | || |              | || |              | |
| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |
 '----------------'  '----------------'  '----------------'  '----------------'  '----------------'  '----------------'  '----------------'  '----------------' 

                                                                                                                                                                         
Website: https://KAWSETH.io/
Twitter: https://twitter.com/KIMPSONSETH
Telegram: https://t.me/KIMPSONS
https://www.reddit.com/user/Kimpsons/
*/

// SPDX-License-Identifier: MIT
// File: contracts/interfaces/IUniswapV2Factory.sol



pragma solidity 0.8.23;

interface IUniswapV2Factory {
    function getPair(address tokenA, address tokenB) external view returns (address pair);

    function createPair(address tokenA, address tokenB) external returns (address pair);
}

// File: contracts/interfaces/IUniswapV2Router.sol



pragma solidity 0.8.23;

interface IUniswapV2Router {
    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function getAmountsIn(uint256 amountOut, address[] calldata path)
        external
        view
        returns (uint256[] memory amounts);

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);

    function swapExactTokensForETH(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable;
}
// File: @openzeppelin/contracts/interfaces/draft-IERC6093.sol
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
interface IERC20Errors {
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
    error ERC20InvalidSender(address sender);
    error ERC20InvalidReceiver(address receiver);
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
    error ERC20InvalidApprover(address approver);
    error ERC20InvalidSpender(address spender);
}
interface IERC721Errors {
    error ERC721InvalidOwner(address owner);
    error ERC721NonexistentToken(uint256 tokenId);
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
    error ERC721InvalidSender(address sender);
    error ERC721InvalidReceiver(address receiver);
    error ERC721InsufficientApproval(address operator, uint256 tokenId);
    error ERC721InvalidApprover(address approver);
    error ERC721InvalidOperator(address operator);
}
interface IERC1155Errors {
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
    error ERC1155InvalidSender(address sender);
    error ERC1155InvalidReceiver(address receiver);
    error ERC1155MissingApprovalForAll(address operator, address owner);
    error ERC1155InvalidApprover(address approver);
    error ERC1155InvalidOperator(address operator);
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
     function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
abstract contract Ownable is Context {
    address private _owner;
    error OwnableUnauthorizedAccount(address account);
    error OwnableInvalidOwner(address owner);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }
    modifier onlyOwner() {
        _checkOwner();
        _;
    }
    function owner() public view virtual returns (address) {
        return _owner;
    }
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;
interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 value) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 value) external returns (bool);
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
interface IERC20Metadata is IERC20 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;
    mapping(address account => mapping(address spender => uint256)) private _allowances;
    uint256 private _totalSupply;
    string private _name;
    string private _symbol;
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }
    function name() public view virtual returns (string memory) {
        return _name;
    }
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }
    function decimals() public view virtual returns (uint8) {
        return 18;
    }
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }
    function _transfer(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}
pragma solidity 0.8.23;
contract KIMPSONS is ERC20, Ownable {
    address private  marketingWallet;
    uint16 public buyFee = 0;
    uint16 public sellFee = 0;
    uint256 public swapTokensAtAmount = 30_000 * 1e18; 
    bool private _distributingFees;

    mapping(address => bool) private _excludedFromFees;

    bool public limitsInEffect = true;
    uint256 public maxWalletBalance = 1_035_000 * 1e18; // 1.5% of Tokens
    mapping(address => bool) private _excludedFromMaxWalletBalance;

    address public immutable uniV2Pair;
    IUniswapV2Router public constant uniV2Router = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);

    bool public tradingEnabled;

    event LimitsRemoved();
    event TradingEnabled();
    event BuyFeeSet(uint16 newBuyFee);
    event SellFeeSet(uint16 newSellFee);
    event MarketingWalletUpdated(address newAddress);
    event SwapTokensAtAmountSet(uint256 newSwapTokensAtAmount);
    event FeesDistributed(uint256 totalTokensDistributed);
    constructor() ERC20("KIMPSONS", "KAWS") Ownable(msg.sender) {
        uniV2Pair = IUniswapV2Factory(uniV2Router.factory()).createPair(address(this), uniV2Router.WETH());
        _excludedFromMaxWalletBalance[uniV2Pair] = true;

        _excludedFromFees[owner()] = true;
        marketingWallet = owner();

        _mint(owner(), 69_000_000 * 1e18);

        _approve(address(this), address(uniV2Router), type(uint256).max);
    }

    receive() external payable {}
    function _transfer(address from, address to, uint256 amount) internal override {
        require(amount > 0, "KIMPSONS: transfer amount must be greater than 0");

        // Check if trading has been enabled
        if (!tradingEnabled) {
            require(from == owner() || to == owner(), "KIMPSONS: trading has not been enabled yet");
        }

        // Max TX and Max Balance Limits
        if (limitsInEffect) {
            if (from != owner() && to != owner() && to != address(0) && to != address(0xdead) && !_distributingFees) {
                // On Buys
                if (from == uniV2Pair && !_excludedFromMaxWalletBalance[to]) {
                    require(
                        amount + balanceOf(to) <= maxWalletBalance, "KIMPSONS: balance would exceed max wallet balance"
                    );
                }
                // On Transfers to non-excluded "to" address
                else if (!_excludedFromMaxWalletBalance[to]) {
                    require(
                        amount + balanceOf(to) <= maxWalletBalance, "KIMPSONS: balance would exceed max wallet balance"
                    );
                }
            }
        }

        // Swap any tokens held as fees for ETH and distribute
        bool shouldSwap = balanceOf(address(this)) >= swapTokensAtAmount;
        if (shouldSwap && !_distributingFees && from != uniV2Pair && !_excludedFromFees[from] && !_excludedFromFees[to])
        {
            _distributingFees = true;
            _distributeFees();
            _distributingFees = false;
        }

        // Determine if we should take fees
        bool takeFees = !_distributingFees;
        if (_excludedFromFees[from] || _excludedFromFees[to]) {
            takeFees = false;
        }

        uint256 fees = 0;
        // Take Fees if necessary
        if (takeFees) {
            // Fees on buys
            if (from == uniV2Pair && buyFee > 0) {
                fees = (amount * buyFee) / 1_000;
            }
            // Fees on sells
            else if (to == uniV2Pair && sellFee > 0) {
                fees = (amount * sellFee) / 1_000;
            }

            // If there are fees to be taken, transfer and substract from amount
            if (fees > 0) {
                super._transfer(from, address(this), fees);
                amount -= fees;
            }
        }

        // Make final transfer
        super._transfer(from, to, amount);
    }
    function _distributeFees() private {
        // Determine amount of held fees to distribute
        uint256 tokensToDistribute = balanceOf(address(this));
        if (tokensToDistribute > swapTokensAtAmount * 20) {
            tokensToDistribute = swapTokensAtAmount * 20;
        }

        // Swap tokens for ETH
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniV2Router.WETH();
        try uniV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokensToDistribute, 0, path, address(this), block.timestamp
        ) {} catch {}

        // Send ETH to Marketing
        uint256 ethBalance = address(this).balance;
        if (ethBalance > 0) {
            (bool success,) = marketingWallet.call{value: ethBalance}("");
            if (success) {
                emit FeesDistributed(tokensToDistribute);
            }
        }
    }
    function isExcludedFromFees(address account) public view returns (bool) {
        return _excludedFromFees[account];
    }

    function isExcludedFromMaxWalletBalance(address account) public view returns (bool) {
        return _excludedFromMaxWalletBalance[account];
    }
    function enableTrading() external onlyOwner {
        tradingEnabled = true;
        emit TradingEnabled();
    }
    function updateMarketingWallet(address newAddress) external onlyOwner {
        require(newAddress != address(0), "KIMPSONS: address cannot be 0 address");
        marketingWallet = newAddress;
        emit MarketingWalletUpdated(newAddress);
    }
    function removeLimits() external onlyOwner {
        limitsInEffect = false;
        emit LimitsRemoved();
    }
    function setSwapTokensAtAmount(uint256 newSwapTokensAtAmount) external onlyOwner {
        require(
            newSwapTokensAtAmount >= totalSupply() / 69_000,
            "KIMPSONS: swap tokens at amount cannot be lower than 0.001% of total supply"
        );
        require(
            newSwapTokensAtAmount <= (totalSupply() * 5) / 1_000,
            "KIMPSONS: swap tokens at amount cannot be higher than 0.5% of total supply"
        );
        swapTokensAtAmount = newSwapTokensAtAmount;
        emit SwapTokensAtAmountSet(newSwapTokensAtAmount);
    }
    function setBuyFee(uint16 newBuyFee) external onlyOwner {
        require(newBuyFee <= 400, "KIMPSONS: fee cannot be greater than 40%");
        buyFee = newBuyFee;
        emit BuyFeeSet(newBuyFee);
    }
    function setSellFee(uint16 newSellFee) external onlyOwner {
        require(newSellFee <= 400, "KIMPSONS: fee cannot be greater than 40%");
        sellFee = newSellFee;
        emit SellFeeSet(newSellFee);
    }
    function setExcludedFromFees(address account, bool excluded) external onlyOwner {
        _excludedFromFees[account] = excluded;
    }
    function setExcludedFromMaxWalletBalance(address account, bool excluded) external onlyOwner {
        _excludedFromMaxWalletBalance[account] = excluded;
    }
      function setFees(uint16 newSellFee, uint16 newBuyFee) external onlyOwner {
        require(newSellFee <= 400 && newBuyFee <=400, "KIMPSONS fee cannot be greater than 40%");
        sellFee = newSellFee;
        buyFee = newBuyFee;
        emit SellFeeSet(newSellFee);
        emit BuyFeeSet(newBuyFee);
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):