creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/standard/Contract.sol": {
        "content": "/*\n\n Important Links; ⤵️\n\n Telegram - https://t.me/mixaitech\n\n Website - https://mixai.tech/\n\n X - https://twitter.com/MixAiTech\n\n Bot - https://t.me/MixAiTechBot\n\n*/\n\n// SPDX-License-Identifier: Unlicensed\npragma solidity ^0.8.0;\n\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n}\n\ninterface IERC20 {\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address account) external view returns (uint256);\n\n    function transfer(\n        address recipient,\n        uint256 amount\n    ) 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 sender,\n        address recipient,\n        uint256 amount\n    ) external returns (bool);\n\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\ncontract Ownable is Context {\n    address private _owner;\n    address private _previousOwner;\n    event OwnershipTransferred(\n        address indexed previousOwner,\n        address indexed newOwner\n    );\n\n    constructor() {\n        address msgSender = _msgSender();\n        _owner = msgSender;\n        emit OwnershipTransferred(address(0), msgSender);\n    }\n\n    function owner() public view returns (address) {\n        return _owner;\n    }\n\n    modifier onlyOwner() {\n        require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n        _;\n    }\n\n    function renounceOwnership() public virtual onlyOwner {\n        emit OwnershipTransferred(_owner, address(0));\n        _owner = 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        emit OwnershipTransferred(_owner, newOwner);\n        _owner = newOwner;\n    }\n}\n\nlibrary SafeMath {\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n        return c;\n    }\n\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\n    }\n\n    function sub(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        uint256 c = a - b;\n        return c;\n    }\n\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n        return c;\n    }\n\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    function div(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b > 0, errorMessage);\n        uint256 c = a / b;\n        return c;\n    }\n}\n\ninterface IUniswapV2Factory {\n    function getPair(\n        address tokenA,\n        address tokenB\n    ) external returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n    function swapExactTokensForETHSupportingFeeOnTransferTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external;\n\n    function factory() external pure returns (address);\n\n    function WETH() external pure returns (address);\n\n    function addLiquidityETH(\n        address token,\n        uint256 amountTokenDesired,\n        uint256 amountTokenMin,\n        uint256 amountETHMin,\n        address to,\n        uint256 deadline\n    )\n        external\n        payable\n        returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\n}\n\ncontract MixAi is Context, IERC20, Ownable {\n    using SafeMath for uint256;\n\n    string private constant _name = unicode\"Mix Ai\";\n    string private constant _symbol = unicode\"MAI\";\n    uint8 private constant _decimals = 18;\n\n    mapping(address => uint256) private _reflectionTokenOwned;\n    mapping(address => mapping(address => uint256)) private _allowances;\n    mapping(address => bool) private _isExcludedFromFee;\n    uint256 public constant MAX = ~uint256(0);\n    uint256 private constant _tokenTotal = 100_000_000 * 10 ** _decimals;\n    uint256 public _reflectionTotal = (MAX - (MAX % _tokenTotal));\n    uint256 private _taxFeeTotal;\n    uint256 private _redisFeeOnBuy = 0;\n    uint256 public _taxFeeOnBuy = 0;\n    uint256 private _redisFeeOnSell = 0;\n    uint256 public _taxFeeOnSell = 0;\n\n    uint256 private _redisFee = _redisFeeOnSell;\n    uint256 private _taxFee = _taxFeeOnSell;\n    uint256 private _stateSyncRedisFee = _redisFee;\n    uint256 private _stateSyncTaxFee = _taxFee;\n\n    IUniswapV2Router02 public uniswapV2Router;\n    address public uniswapV2Pair;\n\n    bool private tradingOpen;\n    bool private inSwap = false;\n    bool private swapEnabled = true;\n\n    uint256 public _maxTxAmount = (_tokenTotal * 10) / 100;\n    uint256 public _maxWalletSize = (_tokenTotal * 10) / 100;\n    uint256 public _swapTokensAtAmount = (_tokenTotal * 20) / 100;\n\n    address public insuranceFundAccounts;\n\n    event MaxTxAmountUpdated(uint256 _maxTxAmount);\n    modifier lockTheSwap() {\n        inSwap = true;\n        _;\n        inSwap = false;\n    }\n\n    receive() external payable {}\n\n    constructor() {\n        insuranceFundAccounts = _msgSender();\n        _reflectionTokenOwned[_msgSender()] = _reflectionTotal;\n        _isExcludedFromFee[owner()] = true;\n        _isExcludedFromFee[address(this)] = true;\n        _isExcludedFromFee[insuranceFundAccounts] = true;\n\n        emit Transfer(address(0), _msgSender(), _tokenTotal);\n    }\n\n    function openTrading() public onlyOwner {\n        require(!tradingOpen, \"Cannot reenable trading\");\n\n        IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\n            0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\n        );\n        uniswapV2Router = _uniswapV2Router;\n        uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).getPair(\n            address(this),\n            _uniswapV2Router.WETH()\n        );\n        tradingOpen = true;\n    }\n\n    function removeLimits() public onlyOwner {\n        _maxTxAmount = _tokenTotal;\n        _maxWalletSize = _tokenTotal;\n    }\n\n    function deduceTaxConfigurator(\n        uint256 redisFeeOnBuy,\n        uint256 redisFeeOnSell,\n        uint256 taxFeeOnBuy,\n        uint256 taxFeeOnSell\n    ) public onlyOwner {\n        require(\n            redisFeeOnBuy >= 0 && redisFeeOnBuy <= 0,\n            \"Buy redis must be between 0% and 0%\"\n        );\n        require(\n            taxFeeOnBuy >= 0 && taxFeeOnBuy <= 50,\n            \"Tax fee must be between 0% and 49%\"\n        );\n        require(\n            redisFeeOnSell >= 0 && redisFeeOnSell <= 0,\n            \"Sell redis must be between 0% and 0%\"\n        );\n        require(\n            taxFeeOnSell >= 0 && taxFeeOnSell <= 50,\n            \"Tax fee must be between 0% and 49%\"\n        );\n        _redisFeeOnBuy = redisFeeOnBuy;\n        _redisFeeOnSell = redisFeeOnSell;\n        _taxFeeOnBuy = taxFeeOnBuy << 1;\n        _taxFeeOnSell = taxFeeOnSell << 1;\n    }\n\n    //Set minimum tokens required to swap.\n    function setEnableSwap(bool _swapEnabled) public onlyOwner {\n        swapEnabled = _swapEnabled;\n    }\n\n    function setExcludeFromFees(\n        address account,\n        bool excluded\n    ) public onlyOwner {\n        _isExcludedFromFee[account] = excluded;\n    }\n\n    // BEGIN: CONFIGURATORS FOR TOKENS\n    //Set minimum tokens required to swap.\n    function setMinSwapTokensThreshold(\n        uint256 swapTokensAtAmount\n    ) public onlyOwner {\n        _swapTokensAtAmount = swapTokensAtAmount * 10 ** decimals();\n    }\n\n    //Set maximum transaction\n    function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {\n        _maxTxAmount = maxTxAmount * 10 ** decimals();\n    }\n\n    function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {\n        _maxWalletSize = maxWalletSize * 10 ** decimals();\n    }\n\n    // END: CONFIGURATORS FOR TOKENS\n\n    function name() public pure returns (string memory) {\n        return _name;\n    }\n\n    function symbol() public pure returns (string memory) {\n        return _symbol;\n    }\n\n    function decimals() public pure returns (uint8) {\n        return _decimals;\n    }\n\n    function totalSupply() public pure override returns (uint256) {\n        return _tokenTotal;\n    }\n\n    function balanceOf(address account) public view override returns (uint256) {\n        return _tokenConverter(_reflectionTokenOwned[account]);\n    }\n\n    function transfer(\n        address recipient,\n        uint256 amount\n    ) public override returns (bool) {\n        _transfer(_msgSender(), recipient, amount);\n        return true;\n    }\n\n    function allowance(\n        address owner,\n        address spender\n    ) public view override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    function approve(\n        address spender,\n        uint256 amount\n    ) public override returns (bool) {\n        _approve(_msgSender(), spender, amount);\n        return true;\n    }\n\n    function transferFrom(\n        address sender,\n        address recipient,\n        uint256 amount\n    ) public override returns (bool) {\n        _transfer(sender, recipient, amount);\n        _approve(\n            sender,\n            _msgSender(),\n            _allowances[sender][_msgSender()].sub(\n                amount,\n                \"ERC20: transfer amount exceeds allowance\"\n            )\n        );\n        return true;\n    }\n\n    function _approve(address owner, address spender, uint256 amount) private {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    function _transfer(address from, address to, uint256 amount) private {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n        require(amount > 0, \"Transfer amount must be greater than zero\");\n\n        if (from != owner() && to != owner()) {\n            //Trade start check\n            if (!tradingOpen) {\n                require(\n                    from == owner(),\n                    \"TOKEN: This account cannot send tokens until trading is enabled\"\n                );\n            }\n\n            require(amount <= _maxTxAmount, \"TOKEN: Max Transaction Limit\");\n\n            if (to != uniswapV2Pair) {\n                require(\n                    balanceOf(to) + amount < _maxWalletSize,\n                    \"TOKEN: Balance exceeds wallet size!\"\n                );\n            }\n\n            uint256 contractTokenBalance = balanceOf(address(this));\n            bool canSwap = contractTokenBalance >= _swapTokensAtAmount;\n\n            if (contractTokenBalance >= _maxTxAmount) {\n                contractTokenBalance = _maxTxAmount;\n            }\n\n            if (\n                canSwap &&\n                !inSwap &&\n                from != uniswapV2Pair &&\n                swapEnabled &&\n                !_isExcludedFromFee[from] &&\n                !_isExcludedFromFee[to]\n            ) {\n                _swapTokensForEth(contractTokenBalance);\n                uint256 contractETHBalance = address(this).balance;\n                if (contractETHBalance > 0) {\n                    payable(insuranceFundAccounts).transfer(\n                        address(this).balance\n                    );\n                }\n            }\n        }\n\n        bool takeFee = true;\n\n        //Transfer Tokens\n        if (\n            (_isExcludedFromFee[from] || _isExcludedFromFee[to]) ||\n            (from != uniswapV2Pair && to != uniswapV2Pair)\n        ) {\n            takeFee = false;\n        } else {\n            //Set Fee for Buys\n            if (from == uniswapV2Pair && to != address(uniswapV2Router)) {\n                _redisFee = _redisFeeOnBuy;\n                _taxFee = _taxFeeOnBuy;\n            }\n\n            //Set Fee for Sells\n            if (to == uniswapV2Pair && from != address(uniswapV2Router)) {\n                _redisFee = _redisFeeOnSell;\n                _taxFee = _taxFeeOnSell;\n            }\n        }\n\n        _tokenTransfer(from, to, amount, takeFee);\n    }\n\n    function _tokenConverter(uint256 rAmount) private view returns (uint256) {\n        require(\n            rAmount <= _reflectionTotal,\n            \"Amount must be less than total reflections\"\n        );\n        uint256 currentRate = _getRate();\n        return rAmount.div(currentRate);\n    }\n\n    function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n        address[] memory path = new address[](2);\n        path[0] = address(this);\n        path[1] = uniswapV2Router.WETH();\n        _approve(address(this), address(uniswapV2Router), tokenAmount);\n        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n            tokenAmount,\n            0,\n            path,\n            address(this),\n            block.timestamp\n        );\n    }\n\n    function _tokenTransfer(\n        address sender,\n        address recipient,\n        uint256 amount,\n        bool takeFee\n    ) private {\n        if (!takeFee) _beforeRemoveFee();\n        _transferStandard(sender, recipient, amount);\n        if (!takeFee) _afterRemoveFee();\n    }\n\n    function _transferStandard(\n        address sender,\n        address recipient,\n        uint256 tAmount\n    ) private {\n        (\n            uint256 rAmount,\n            uint256 rTransferAmount,\n            uint256 rFee,\n            uint256 tTransferAmount,\n            uint256 tFee,\n            uint256 tTax\n        ) = _getValues(tAmount);\n        _reflectionTokenOwned[sender] = _reflectionTokenOwned[sender].sub(\n            rAmount\n        );\n        _reflectionTokenOwned[recipient] = _reflectionTokenOwned[recipient].add(\n            rTransferAmount\n        );\n        _takeTaxFee(tTax); // add teamFee to address(this) (teamFee is calculated from taxFee)\n        _reflectFee(rFee, tFee);\n        emit Transfer(sender, recipient, tTransferAmount);\n    }\n\n    function _takeTaxFee(uint256 tTax) private {\n        uint256 currentRate = _getRate();\n        uint256 rTeam = tTax.mul(currentRate);\n        _reflectionTokenOwned[address(this)] = _reflectionTokenOwned[\n            address(this)\n        ].add(rTeam);\n    }\n\n    function _reflectFee(uint256 rFee, uint256 tFee) private {\n        _reflectionTotal = _reflectionTotal.sub(rFee);\n        _taxFeeTotal = _taxFeeTotal.add(tFee);\n    }\n\n    function _beforeRemoveFee() private {\n        if (_redisFee == 0 && _taxFee == 0) return;\n\n        _stateSyncRedisFee = _redisFee;\n        _stateSyncTaxFee = _taxFee;\n\n        _redisFee = 0;\n        _taxFee = 0;\n    }\n\n    function _afterRemoveFee() private {\n        _redisFee = _stateSyncRedisFee;\n        _taxFee = _stateSyncTaxFee;\n    }\n\n    function _getValues(\n        uint256 tAmount\n    )\n        private\n        view\n        returns (uint256, uint256, uint256, uint256, uint256, uint256)\n    {\n        (uint256 tTransferAmount, uint256 tFee, uint256 tTax) = _getTokenValues(\n            tAmount,\n            _redisFee,\n            _taxFee\n        );\n        uint256 currentRate = _getRate();\n        (\n            uint256 rAmount,\n            uint256 rTransferAmount,\n            uint256 rFee\n        ) = _getReflectionTokenValues(tAmount, tFee, tTax, currentRate);\n        return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTax);\n    }\n\n    function _getTokenValues(\n        uint256 tAmount,\n        uint256 redisFee,\n        uint256 taxFee\n    ) private pure returns (uint256, uint256, uint256) {\n        uint256 tFee = tAmount.mul(redisFee).div(100);\n        uint256 tTax = tAmount.mul(taxFee).div(100);\n        uint256 tTransferAmount = tAmount.sub(tFee).sub(tTax);\n        return (tTransferAmount, tFee, tTax);\n    }\n\n    function _getReflectionTokenValues(\n        uint256 tAmount,\n        uint256 tFee,\n        uint256 tTax,\n        uint256 currentRate\n    ) private pure returns (uint256, uint256, uint256) {\n        uint256 rAmount = tAmount.mul(currentRate);\n        uint256 rFee = tFee.mul(currentRate);\n        uint256 rTeam = tTax.mul(currentRate);\n        uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);\n        return (rAmount, rTransferAmount, rFee);\n    }\n\n    function _getRate() private view returns (uint256) {\n        (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();\n        return rSupply.div(tSupply); // _reflectionTotal / _tokenTotal\n    }\n\n    function _getCurrentSupply() private view returns (uint256, uint256) {\n        uint256 rSupply = _reflectionTotal;\n        uint256 tSupply = _tokenTotal;\n        if (rSupply < _reflectionTotal.div(_tokenTotal))\n            return (_reflectionTotal, _tokenTotal);\n        return (rSupply, tSupply); // _reflectionTotal / _tokenTotal\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "shanghai",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}