Skip to content
Verified contractPartial

Monalisa

Address0x80d36f5b3c9d814603844759e45d15a4bee5bc8f
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.19

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.19+commit.7dd6d404
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
18,240,264
Creation transaction
0xb2a89dd573…c69408ccbd

contracts/Monalisa.sol


pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";

import "./MonalisaState.sol";

contract Monalisa is MonalisaState {
    
    function initialize() initializer public {
        __MonalisaState_init();
        __Ownable_init();

        setExcludedFromFees(_msgSender(), true);
        setExcludedFromWhale(_msgSender(), true);
    }

    
    receive() external payable {}

    function _passAntiWhaleToSell(address seller, uint256 amount) internal returns(bool) {
        if (!_antiWhale.enabled || _isExcludedFromWhale[seller]) {
            return true;
        }

        
        if (amount < _antiWhale.minSellTxAmount || amount > _antiWhale.maxSellTxAmount) {
            return false;
        }

        
        if ((block.timestamp - _tAmountPerHour[seller]) >= _antiWhale.timeLimit) {
            _tAmountPerHour[seller] = block.timestamp;
            _rAmountPerHour[seller] = 0;
        }

        
        if ((_rAmountPerHour[seller] + amount) > _antiWhale.maxPerHourTxAmount) {
            return false;
        }

        
        (uint tokenLiquidity, uint wethLiquidity, ) = IUniswapV2Pair(pairAddress).getReserves();
        uint ethForTokens = IUniswapV2Router02(routerAddress).getAmountOut(amount, tokenLiquidity, wethLiquidity);

        if (ethForTokens >= wethLiquidity * _antiWhale.maxOverLiquidityLimit / (100*_percent)) {
            return false;
        }

        _rAmountPerHour[seller] = _rAmountPerHour[seller] + amount;

        return true;
    }

    function _passAntiWhaleToTransfer(address from, address to, uint256 amount) internal returns(bool) {
        if (!_antiWhale.enabled || _isExcludedFromWhale[from] || _isExcludedFromWhale[to]) {
            return true;
        }

        if (amount <= _antiWhale.maxTransferLimit) {
            if ((block.timestamp - _tAmountPerHour[from]) >= _antiWhale.timeLimit) {
                _tAmountPerHour[from] = block.timestamp;
                _rAmountPerHour[from] = 0;
            }

            if ((_rAmountPerHour[from] + amount) <= _antiWhale.maxPerHourTxAmount) {
                _rAmountPerHour[from] = _rAmountPerHour[from] + amount;
                _rAmountPerHour[to] = _rAmountPerHour[to] + amount;

                return true;
            }
        }

        return false;
    }

    
    function withdraw(address receiver) external onlyOwner {
        payable(receiver).transfer(address(this).balance);
    }

    
    function withdrawTokens(address receiver, uint amount) public onlyOwner {
        _transferTokens(address(this), receiver, amount);
    }

    /* Claims */
    function setClaimData(uint32 claimStart, uint32 claimPeriod, uint8 claimCountTotal) public onlyOwner {
        _claimStart = claimStart;
        _claimPeriod = claimPeriod;
        _claimCountTotal = claimCountTotal;
    }

    
    function getClaimData(address account) public view returns(ClaimData memory) {
        return _claims[account];
    }

    
    function claim() public nonReentrant {
        address account = _msgSender();

        require(block.timestamp >= _claimStart, "Claim: not started");
        require(!isExcludedFromSwapAndTransfer(account), "isExcludedFromSwapAndTransfer: you are excluded from operations with MONALISA.");

        uint32 claims = _claims[account].claims;
        uint claimed = _claims[account].claimed;
        uint allocation = _claims[account].allocation;

        uint allocationLeft = allocation - claimed;
        uint32 claimsFromUnlock = uint32((block.timestamp - _claimStart + _claimPeriod) / _claimPeriod);

        if (claimsFromUnlock > _claimCountTotal) {
            claimsFromUnlock = _claimCountTotal;
        }

        uint32 availableClaims = claimsFromUnlock - claims;
        uint32 totalClaims = _claimCountTotal - claims;

        require(availableClaims > 0, "Claim: no claims left");

        uint amountToClaim = (allocationLeft / totalClaims) * availableClaims;

        require(amountToClaim > 0, "Claim: nothing to claim");

        _claims[account].claims = claimsFromUnlock;
        _claims[account].claimed += amountToClaim;

        _transferTokens(address(this), account, amountToClaim);
    }


    
    function addToClaimList(ClaimParticipant[] calldata list) public onlyOwner {
        uint totalAmount = 0;

        for (uint8 i = 0; i < list.length; i++) {
            address wallet = list[i].wallet;

            _claimsList.push(wallet);

            _claims[wallet].wallet = wallet;
            _claims[wallet].allocation = list[i].allocation;

            totalAmount += _claims[wallet].allocation - _claims[wallet].claimed;
        }

        
        _transferTokens(_msgSender(), address(this), totalAmount);
    }

    function getClaimsLeft() public view returns(uint) {
        uint total = 0;

        for (uint8 i = 0; i < _claimsList.length; i++) {
            ClaimData memory data = _claims[_claimsList[i]];

            total += (data.allocation - data.claimed);
        }

        return total;
    }

    /* Transfers */
    function _transfer(address from, address to, uint256 amount) internal virtual override {
        address sender = _msgSender(); 

        require(!isExcludedFromSwapAndTransfer(sender) && !isExcludedFromSwapAndTransfer(to), "isExcludedFromSwapAndTransfer: you are excluded from operations with token.");

        bool isPairAddressInvolved = (from == pairAddress || to == pairAddress);
        bool excludedFromFee = isExcludedFromFee(sender) || isExcludedFromFee(to) || isExcludedFromFee(from);
        bool internalTransfer = _inSwap || _inLiquidity;
        bool takeFees = !internalTransfer && isPairAddressInvolved && !excludedFromFee;

        
        if (takeFees) {
            _inSwap = true;

            uint feeAmount = 0;

            
            if (from == pairAddress) {
                feeAmount = amount * _feesAndTaxes.buyFee / (100 * _percent);
            }
            
            else if (to == pairAddress) {
                require(_passAntiWhaleToSell(from, amount), "AntiWhaleSystem: You are not passed anti-whale");

                feeAmount = amount * _feesAndTaxes.sellFee / (100 * _percent);
            }

            uint liqAmount = amount * _feesAndTaxes.liquidityTax / (100 * _percent);
            uint amountToBuyer = amount - (feeAmount + liqAmount);

            
            _transferTokens(from, to, amountToBuyer);
            _transferTokens(from, marketing, feeAmount);

            
            _transferTokens(from, address(this), liqAmount);
            liquidityCapital += liqAmount;

            if (liquidityCapital >= liquidityCapitalLimit) {
                _swapAndLiquify(liquidityCapital);
                liquidityCapital = 0;
            }

            _inSwap = false;
        }
        else {
            if(!internalTransfer){
                require(_passAntiWhaleToTransfer(from, to, amount), "AntiWhaleSystem: You are not passed anti-whale");
            }
            _transferTokens(from, to, amount);
        }
    }

    function _transferTokens(address from, address to, uint256 amount) internal virtual {
        super._transfer(from, to, amount);
    }

    function withdrawLiquidity() public onlyAdmin {
        _swapAndLiquify(liquidityCapital);

        liquidityCapital = 0;
    }

    
    function _swapAndLiquify(uint tokenAmount) internal {
        require(tokenAmount > 0 && tokenAmount <= balanceOf(address(this)), "Not enough tokens in the contract");

        
        uint256 tokensForSwap = tokenAmount * liquidityShareETH / (100 * _percent);
        uint256 tokensForLiq = tokenAmount - tokensForSwap;

        _inLiquidity = true;

        if (tokensForLiq > 0 && tokensForSwap > 0) {
            uint initialBalance = address(this).balance;

            
            _swapTokensForEth(tokensForSwap);

            uint newBalance = address(this).balance - initialBalance;

            
             _addLiquidity(tokensForLiq, newBalance);
        }

        _inLiquidity = false;
    }

    function _swapTokensForEth(uint256 tokenAmount) private {
        IUniswapV2Router02 router = IUniswapV2Router02(routerAddress);

        
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = wethAddress;

        _approve(address(this), routerAddress, tokenAmount);

        
        router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokenAmount,
            0, 
            path,
            address(this),
            block.timestamp
        );
    }

    function _addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
        IUniswapV2Router02 router = IUniswapV2Router02(routerAddress);

        
        _approve(address(this), routerAddress, tokenAmount);

        
        router.addLiquidityETH{value: ethAmount}(
            address(this),
            tokenAmount,
            0, 
            0, 
            liquidityPool,
            block.timestamp + 600
        );
    }

    
    function updateRouter(address newRouterAddress) public onlyOwner returns(address) {
        require(newRouterAddress != address(routerAddress), "The router already has that address");

        IUniswapV2Router02 router = IUniswapV2Router02(newRouterAddress);

        address newWethAddress = router.WETH();
        address newPairAddress = IUniswapV2Factory(router.factory()).getPair(address(this), newWethAddress);

        
        if (newPairAddress == zeroAddress) {
            newPairAddress = IUniswapV2Factory(router.factory()).createPair(address(this), newWethAddress);
        }

        pairAddress = newPairAddress;
        routerAddress = newRouterAddress;
        wethAddress = newWethAddress;

        return newPairAddress;
    }
}

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol




pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https:
     */
    uint256[49] private __gap;
}

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol




pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * 
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol




pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https:
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    
    
    
    
    

    
    
    
    
    
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        
        
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https:
     */
    uint256[49] private __gap;
}

@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol




pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https:
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            
            
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        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);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https:
     */
    uint256[45] private __gap;
}

@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol




pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https:
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol




pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol




pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        
        
        

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https:
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https:
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https:
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https:
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                
                
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        
        if (returndata.length > 0) {
            
            
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol




pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https:
     */
    uint256[50] private __gap;
}

@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol

pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

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

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol

pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol

pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol

pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

contracts/MonalisaState.sol


pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";


contract MonalisaState is ERC20Upgradeable, OwnableUpgradeable, ReentrancyGuardUpgradeable {
    struct ClaimParticipant {
        address wallet;
        uint allocation;
    }

    struct ClaimData {
        address wallet;
        uint claimed;
        uint allocation;
        uint32 claims;
    }

    struct FeesAndTaxes {
        uint16 buyFee;
        uint16 sellFee;
        uint16 liquidityTax;
        uint16 royaltiesTax;
        uint16 burnTax;
        uint16 stakingTax;
    }

    struct AntiWhale {
        bool enabled;
        uint timeLimit;
        uint minSellTxAmount;
        uint maxSellTxAmount;
        uint maxPerHourTxAmount;
        uint maxTransferLimit;
        uint maxOverLiquidityLimit;
    }

    uint16 constant _percent = 10**2;
    address constant public deadAddress = address(0x000000000000000000000000000000000000dEaD);
    address constant public zeroAddress = address(0);

    
    bool internal _inSwap;
    bool internal _inLiquidity;

    
    address public team;
    address public marketing;
    address public development;
    address public liquidityPool;

    
    address public stakingAddress;
    address public routerAddress;
    address public pairAddress;

    
    FeesAndTaxes internal _feesAndTaxes;

    
    AntiWhale internal _antiWhale;

    uint16 internal liquidityShareETH;
    uint internal liquidityCapital;
    uint internal liquidityCapitalLimit;

    
    uint32 internal _claimStart;
    uint32 internal _claimPeriod;
    uint8  internal _claimCountTotal;

    address[] internal _claimsList;
    mapping (address => ClaimData) internal _claims;

    
    mapping (address => bool) internal _isExcludedFromFee;
    mapping (address => bool) internal _isExcludedFromWhale;
    mapping (address => bool) internal _isExcludedFromSwapAndTransfer;

    mapping(address => uint) public _tAmountPerHour;
    mapping(address => uint) public _rAmountPerHour;

    
    address public wethAddress;
    uint256[49] internal __gap;

    modifier onlyAdmin() {
        require(_msgSender() == marketing || _msgSender() == team || _msgSender() == development || _msgSender() == owner(), "You are not an Admin.");
        _;
    }

    function __MonalisaState_init() internal onlyInitializing {
        
        __ERC20_init("MONALISA", "MONALISA");
        _mint(_msgSender(), 100_000_000 * (10 **  decimals()));

        
        team          = 0xe52a2F2F6976c6193F4688b936Eecf538bA96f66;
        marketing     = 0x175AFD00D7b02d5a8b419DB24ecEEeAb6007EE58;
        development   = 0x1341dB1140D251859a46dD371e7A2E79843b23a5;
        liquidityPool = 0x8a0BA95DCa35716262b6580DeaF826ddE0fB27Ee;

        liquidityShareETH = 90 * _percent; 
        liquidityCapitalLimit = 100_000_000 * (10 ** decimals());

        
        _feesAndTaxes = FeesAndTaxes({
            buyFee      : 0 * _percent,
            sellFee     : 6 * _percent,
            liquidityTax: 6 * _percent,
            royaltiesTax: 0 * _percent,
            burnTax     : 0 * _percent,
            stakingTax  : 0 * _percent
        });

        
        _antiWhale = AntiWhale({
            enabled: true,
            minSellTxAmount      : 100 * (10 ** uint( decimals())),
            maxSellTxAmount      : 500_000 * (10 ** uint( decimals())),
            maxPerHourTxAmount   : 1_000_000 * (10 ** uint( decimals())),
            maxTransferLimit     : 1_000_000 * (10 ** uint( decimals())),
            maxOverLiquidityLimit: 3 * _percent,
            timeLimit            : 1 hours
        });

        
        _claimStart      = 1695978000;
        _claimPeriod     = 7 days;
        _claimCountTotal = 10;
    }

    function feesAndTaxes() public view returns (FeesAndTaxes memory) {
        return _feesAndTaxes;
    }

    
    function isExcludedFromFee(address account) public view returns(bool) {
        return _isExcludedFromFee[account];
    }

    function isExcludedFromWhale(address account) public view returns(bool) {
        return _isExcludedFromWhale[account];
    }

    function isExcludedFromSwapAndTransfer(address account) public view returns(bool) {
        return _isExcludedFromSwapAndTransfer[account];
    }

    
    
    function minSellTxAmount() public view returns (uint256) {
        return _antiWhale.minSellTxAmount / (10**decimals());
    }

    
    function maxSellTxAmount() public view returns (uint256) {
        return _antiWhale.maxSellTxAmount / (10**decimals());
    }

    
    function maxPerHourTxAmount() public view returns (uint256) {
        return _antiWhale.maxPerHourTxAmount / (10**decimals());
    }

    
    function maxTransferLimit() public view returns (uint256) {
        return _antiWhale.maxTransferLimit / (10**decimals());
    }

    
    function timeLimit() public view returns (uint256) {
        return _antiWhale.timeLimit;
    }

    function isAntiWhaleEnabled() public view returns (bool) {
        return _antiWhale.enabled;
    }


    
    function setBlacklisted(address account) public onlyAdmin {
        setExcludedFromSwapAndTransfer(account, true);
        uint accountBalance = balanceOf(account);

        super._transfer(account, marketing, accountBalance);
    }

    function setBaseWalletsExcluded() public onlyAdmin {
        
        setExcludedFromFees(owner(), true);
        setExcludedFromFees(team, true);
        setExcludedFromFees(marketing, true);
        setExcludedFromFees(development, true);
        setExcludedFromFees(liquidityPool, true);

        
        setExcludedFromWhale(owner(), true);
        setExcludedFromWhale(team, true);
        setExcludedFromWhale(marketing, true);
        setExcludedFromWhale(development, true);
        setExcludedFromWhale(liquidityPool, true);
    }

    function setExcludedFromFees(address account, bool _enabled) public onlyAdmin {
        _isExcludedFromFee[account] = _enabled;
    }

    function setExcludedFromWhale(address account, bool _enabled) public onlyAdmin {
        _isExcludedFromWhale[account] = _enabled;
    }

    function setExcludedFromSwapAndTransfer(address account, bool _enabled) public onlyAdmin {
        require(account != team && account != marketing && account != development, "Excluded account must not be one of Team, Marketing, Development and LiquidityPool.");
        require(account != pairAddress && account != routerAddress, "Excluded account must not be one of Pancake or Uniswap Router and Pair contract.");
        require(account != liquidityPool && account != stakingAddress, "Excluded account must not be one of our ecosystem contract.");
        require(account != zeroAddress && account != deadAddress, "Excluded account must not be one of EVM zero and dead wallets.");

        _isExcludedFromSwapAndTransfer[account] = _enabled;
    }

    
    function setBuyFee(uint16 newBuyFee) external onlyAdmin() {
        _feesAndTaxes.buyFee = newBuyFee;
    }

    function setSellFee(uint16 newSellFee) external onlyAdmin() {
        _feesAndTaxes.sellFee = newSellFee;
    }

    function setLiquidityTax(uint16 newLiquidityTax) external onlyAdmin() {
        _feesAndTaxes.liquidityTax = newLiquidityTax;
    }

    function setExtraTaxes(uint16 _royaltiesTax, uint16 _burnTax, uint16 _stakingTax) external onlyAdmin() {
        _feesAndTaxes.royaltiesTax = _royaltiesTax;
        _feesAndTaxes.burnTax = _burnTax;
        _feesAndTaxes.stakingTax = _stakingTax;
    }

    
    function setTeam(address account) external onlyAdmin() {
        require(account != pairAddress && account != routerAddress, "New account must NOT be one of Pancake or Uniswap Router and Pair contract.");
        require(account != liquidityPool && account != stakingAddress, "New account account must NOT be one of our ecosystem contract.");
        require(account != zeroAddress && account != deadAddress, "New account account must NOT be one of EVM zero and dead wallets.");

        team = account;
    }

    function setMarketing(address account) external onlyAdmin() {
        require(account != pairAddress && account != routerAddress, "New account must NOT be one of Pancake or Uniswap Router and Pair contract.");
        require(account != liquidityPool && account != stakingAddress, "New account account must NOT be one of our ecosystem contract.");
        require(account != zeroAddress && account != deadAddress, "New account account must NOT be one of EVM zero and dead wallets.");

        marketing = account;
    }

    function setDevelopment(address account) external onlyAdmin() {
        require(account != pairAddress && account != routerAddress, "New account must NOT be one of Pancake or Uniswap Router and Pair contract.");
        require(account != liquidityPool && account != stakingAddress, "New account account must NOT be one of our ecosystem contract.");
        require(account != zeroAddress && account != deadAddress, "New account account must NOT be one of EVM zero and dead wallets.");

        development = account;
    }

    function setLiquidityPool(address account) external onlyAdmin() {
        require(account != pairAddress && account != routerAddress, "New liquidity pool must NOT be one of Pancake or Uniswap Router and Pair contract.");
        require(account != stakingAddress, "New liquidity pool account must NOT be one of our ecosystem contract.");
        require(account != zeroAddress && account != deadAddress, "New liquidity pool account must NOT be one of EVM zero and dead wallets.");

        liquidityPool = account;
    }

    function setStakingAddress(address account) external onlyAdmin {
        require(account != pairAddress && account != routerAddress, "New staking contract must NOT be one of Pancake or Uniswap Router and Pair contract.");
        require(account != liquidityPool, "New staking contract account must NOT be one of our ecosystem contract.");
        require(account != zeroAddress && account != deadAddress, "New staking contract account must NOT be one of EVM zero and dead wallets.");

        stakingAddress = account;
    }

    
    
    function setMinSellTxAmount(uint256 minAmount) external onlyAdmin {
        _antiWhale.minSellTxAmount = minAmount * 10**decimals();
    }

    
    function setMaxSellTxAmount(uint256 maxAmount) external onlyAdmin {
        _antiWhale.maxSellTxAmount = maxAmount * 10**decimals();
    }

    
    function setMaxPerHourTxAmount(uint256 maxPerHourAmount) external onlyAdmin {
        _antiWhale.maxPerHourTxAmount = maxPerHourAmount * 10**decimals();
    }

    
    function setMaxTransferLimit(uint256 maxTransferAmount) external onlyAdmin {
        _antiWhale.maxTransferLimit = maxTransferAmount * 10**decimals();
    }

    
    function setWhaleHour(uint256 _timeLimit) external onlyAdmin {
        _antiWhale.timeLimit = _timeLimit;
    }

    function setAntiWhaleEnabled(bool enabled) external onlyAdmin {
        _antiWhale.enabled = enabled;
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.