Contract 0x1111113eaa7bd746d5e1f160b4b2a2b3e2cdc22d 1

 
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x8964ced867a154636a505dee475d5b02d145163341e88aadf41a3c05644f242d0x61014060331301752022-09-15 8:52:40198 days 15 hrs ago0x04a3a3734647430ca7a3ce7696906b6ed3cf63cd IN  Create: TradedToken0 MATIC0.451259204154 59.423225791
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x8964ced867a154636a505dee475d5b02d145163341e88aadf41a3c05644f242d331301752022-09-15 8:52:40198 days 15 hrs ago 0x1111113eaa7bd746d5e1f160b4b2a2b3e2cdc22d  Contract Creation0 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TradedToken

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 23 : TradedToken.sol
// SPDX-License-Identifier: AGPL
pragma solidity ^0.8.15;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC777/ERC777.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777Sender.sol";
import "@openzeppelin/contracts/utils/introspection/IERC1820Registry.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 "./libs/SwapSettingsLib.sol";
import "./libs/FixedPoint.sol";
import "./minimums/libs/MinimumsLib.sol";
import "./helpers/ExecuteManager.sol";
import "./helpers/Liquidity.sol";

//import "hardhat/console.sol";

contract TradedToken is Ownable, IERC777Recipient, IERC777Sender, ERC777, ExecuteManager {
    using FixedPoint for *;
    using MinimumsLib for MinimumsLib.UserStruct;

    struct PriceNumDen {
        uint256 numerator;
        uint256 denominator;
    }

    struct Observation {
        uint64 timestampLast;
        uint256 price0CumulativeLast;
        FixedPoint.uq112x112 price0Average;
    }

    bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
    bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");

    address private constant deadAddress = 0x000000000000000000000000000000000000dEaD;

    /**
     * @custom:shortd traded token address
     * @notice traded token address
     */
    address public immutable tradedToken;

    /**
     * @custom:shortd reserve token address
     * @notice reserve token address
     */
    address public immutable reserveToken;

    /**
     * @custom:shortd price drop (mul by fraction)
     * @notice price drop (mul by fraction)
     */
    uint256 public immutable priceDrop;

    PriceNumDen minClaimPrice;

    /**
     * @custom:shortd external token
     * @notice external token
     */
    address public externalToken;
    PriceNumDen externalTokenExchangePrice;

    /**
     * @custom:shortd uniswap v2 pair
     * @notice uniswap v2 pair
     */
    address public uniswapV2Pair;

    address internal uniswapRouter;
    address internal uniswapRouterFactory;

    // keep gas when try to get reserves
    // if token01 == true then (IUniswapV2Pair(uniswapV2Pair).token0() == tradedToken) so reserve0 it's reserves of TradedToken
    bool internal immutable token01;
    bool internal alreadyRunStartupSync;

    uint64 internal constant averagePriceWindow = 5;
    uint64 internal constant FRACTION = 10000;
    uint64 internal constant LOCKUP_INTERVAL = 24 * 60 * 60; // day in seconds
    uint64 internal startupTimestamp;
    uint64 internal lockupIntervalAmount;

    uint256 public immutable buyTaxMax;
    uint256 public immutable sellTaxMax;
    uint256 public buyTax;
    uint256 public sellTax;
    uint256 public totalCumulativeClaimed;

    Liquidity internal internalLiquidity;
    Observation internal pairObservation;

    mapping(address => MinimumsLib.UserStruct) internal tokensLocked;

    mapping(address => uint64) internal managers;

    event AddedLiquidity(uint256 tradedTokenAmount, uint256 priceAverageData);

    modifier onlyManagers() {
        require(owner() == _msgSender() || managers[_msgSender()] != 0, "MANAGERS_ONLY");
        _;
    }

    /**
     * @param tokenName_ token name
     * @param tokenSymbol_ token symbol
     * @param reserveToken_ reserve token address
     * @param priceDrop_ price drop while add liquidity
     * @param lockupIntervalAmount_ interval amount in days (see minimum lib)
     * @param minClaimPrice_ (numerator,denominator) minimum claim price that should be after "sell all claimed tokens"
     * @param externalToken_ external token address that used to change their tokens to traded
     * @param externalTokenExchangePrice_ (numerator,denominator) exchange price. used when user trying to change external token to Traded
     * @param buyTaxMax_ buyTaxMax_
     * @param sellTaxMax_ sellTaxMax_
     */
    constructor(
        string memory tokenName_,
        string memory tokenSymbol_,
        address reserveToken_, //” (USDC)
        uint256 priceDrop_,
        uint64 lockupIntervalAmount_,
        PriceNumDen memory minClaimPrice_,
        address externalToken_,
        PriceNumDen memory externalTokenExchangePrice_,
        uint256 buyTaxMax_,
        uint256 sellTaxMax_
    ) ERC777(tokenName_, tokenSymbol_, new address[](0)) {
        buyTaxMax = buyTaxMax_;
        sellTaxMax = sellTaxMax_;

        require(reserveToken_ != address(0), "reserveToken invalid");

        tradedToken = address(this);
        reserveToken = reserveToken_;
        priceDrop = priceDrop_;
        lockupIntervalAmount = lockupIntervalAmount_;

        minClaimPrice.numerator = minClaimPrice_.numerator;
        minClaimPrice.denominator = minClaimPrice_.denominator;
        externalToken = externalToken_;
        externalTokenExchangePrice.numerator = externalTokenExchangePrice_.numerator;
        externalTokenExchangePrice.denominator = externalTokenExchangePrice_.denominator;

        // setup swap addresses
        (uniswapRouter, uniswapRouterFactory) = SwapSettingsLib.netWorkSettings();

        // register interfaces
        _ERC1820_REGISTRY.setInterfaceImplementer(address(this), _TOKENS_SENDER_INTERFACE_HASH, address(this));
        _ERC1820_REGISTRY.setInterfaceImplementer(address(this), _TOKENS_RECIPIENT_INTERFACE_HASH, address(this));

        //create Pair
        uniswapV2Pair = IUniswapV2Factory(uniswapRouterFactory).createPair(tradedToken, reserveToken);
        require(uniswapV2Pair != address(0), "can't create pair");

        startupTimestamp = currentBlockTimestamp();
        pairObservation.timestampLast = currentBlockTimestamp();

        // TypeError: Cannot write to immutable here: Immutable variables cannot be initialized inside an if statement.
        // if (IUniswapV2Pair(uniswapV2Pair).token0() == tradedToken) {
        //     token01 = true;
        // }
        // but can do if use ternary operator :)
        token01 = (IUniswapV2Pair(uniswapV2Pair).token0() == tradedToken) ? true : false;

        // IUniswapV2Pair(uniswapV2Pair).sync(); !!!! not created yet

        internalLiquidity = new Liquidity(tradedToken, reserveToken, uniswapRouter);
    }

    ////////////////////////////////////////////////////////////////////////
    // external section ////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////
    /**
     * @notice part of IERC777Recipient
     */
    function tokensReceived(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata userData,
        bytes calldata operatorData
    ) external {}

    /**
     * @notice part of IERC777Sender
     */
    function tokensToSend(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata userData,
        bytes calldata operatorData
    ) external {}

    ////////////////////////////////////////////////////////////////////////
    // public section //////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////
    function addManagers(
        address manager
    )
        public
        onlyManagers
    {
        managers[manager] = currentBlockTimestamp();
    }
    /**
     * @notice setting buy tax
     * @param fraction buy tax
     * @custom:calledby owner
     */
    function setBuyTax(uint256 fraction) public onlyOwner {
        require(fraction <= buyTaxMax, "FRACTION_INVALID");
        buyTax = fraction;
    }

    /**
     * @notice setting sell tax
     * @param fraction sell tax
     * @custom:calledby owner
     */
    function setSellTax(uint256 fraction) public onlyOwner {
        require(fraction <= sellTaxMax, "FRACTION_INVALID");
        sellTax = fraction;
    }

    /**
     * @dev adding initial liquidity. need to donate `amountReserveToken` of reserveToken into the contract. can be called once
     * @param amountTradedToken amount of traded token which will be claimed into contract and adding as liquidity
     * @param amountReserveToken amount of reserve token which must be donate into contract by user and adding as liquidity
     */
    function addInitialLiquidity(uint256 amountTradedToken, uint256 amountReserveToken) public onlyOwner runOnlyOnce {
        require(amountReserveToken <= ERC777(reserveToken).balanceOf(address(this)), "INSUFFICIENT_RESERVE");
        _claim(amountTradedToken, address(this));

        ERC777(tradedToken).transfer(address(internalLiquidity), amountTradedToken);
        ERC777(reserveToken).transfer(address(internalLiquidity), amountReserveToken);

        internalLiquidity.addLiquidity();

        // singlePairSync() ??

        // console.log("force sync start");

        //force sync
        //IUniswapV2Pair(uniswapV2Pair).sync();

        // // and update
        // update();
    }

    /**
     * @notice claims `tradedTokenAmount` to caller
     * @param tradedTokenAmount amount of traded token to claim
     * @custom:calledby owner
     */
    function claim(uint256 tradedTokenAmount) public onlyManagers {
        _validateClaim(tradedTokenAmount);
        _claim(tradedTokenAmount, msg.sender);
    }

    /**
     * @notice claims to account
     * @param tradedTokenAmount amount of traded token to claim
     * @param account address to claim for
     * @custom:calledby owner
     */
    function claim(uint256 tradedTokenAmount, address account)
        public
        onlyManagers
    {
        _validateClaim(tradedTokenAmount);
        _claim(tradedTokenAmount, account);
    }

    /**
     * @notice claims to account traded tokens instead external tokens(if set). external tokens will send to dead address
     * @param externalTokenAmount amount of external token to claim traded token
     * @param account address to claim for
     */
    function claimViaExternal(uint256 externalTokenAmount, address account) public {
        require(externalToken != address(0), "EMPTY_EXTERNALTOKEN");
        require(
            externalTokenAmount <= ERC777(externalToken).allowance(msg.sender, address(this)),
            "INSUFFICIENT_AMOUNT"
        );

        ERC777(externalToken).transferFrom(msg.sender, deadAddress, externalTokenAmount);

        uint256 tradedTokenAmount = (externalTokenAmount * externalTokenExchangePrice.numerator) /
            externalTokenExchangePrice.denominator;

        _validateClaim(tradedTokenAmount);

        _claim(tradedTokenAmount, account);
    }

    /**
     * @dev claims, sells, adds liquidity, sends LP to 0x0
     * @custom:calledby owner
     */
    function addLiquidity(uint256 tradedTokenAmount) public onlyManagers {
        singlePairSync();

        uint256 tradedReserve1;
        uint256 tradedReserve2;
        uint256 priceAverageData; // it's fixed point uint224

        uint256 rTraded;
        uint256 rReserved;
        uint256 traded2Swap;
        uint256 traded2Liq;
        uint256 reserved2Liq;

        FixedPoint.uq112x112 memory averageWithPriceDrop;

        (tradedReserve1, tradedReserve2, priceAverageData) = _maxAddLiquidity();

        bool err;

        if (tradedReserve1 < tradedReserve2 && tradedTokenAmount <= (tradedReserve2 - tradedReserve1)) {
            err = false;
        } else {
            err = true;
        }

        if (err == false) {
            //if zero we've try to use max as possible of available tokens
            if (tradedTokenAmount == 0) {
                tradedTokenAmount = tradedReserve2 - tradedReserve1;
            }

            (rTraded, rReserved, traded2Swap, traded2Liq, reserved2Liq) = _calculateSellTradedAndLiquidity(
                tradedTokenAmount
            );

            averageWithPriceDrop = (
                FixedPoint
                    .uq112x112(uint224(priceAverageData))
                    .muluq(FixedPoint.encode(uint112(uint256(FRACTION) - priceDrop)))
                    .muluq(FixedPoint.fraction(1, FRACTION))
            );

            // "new_current_price" should be more than "average_price(1-price_drop)"
            if (
                FixedPoint.fraction(rReserved, rTraded + traded2Swap + traded2Liq)._x <=
                // (
                //     FixedPoint.uq112x112(uint224(priceAverageData)).muluq(FixedPoint.encode(uint112(uint256(FRACTION) - priceDrop))).muluq(FixedPoint.fraction(1, FRACTION))
                // )._x
                averageWithPriceDrop._x
            ) {
                err = true;
            }
        }

        require(err == false, "PRICE_DROP_TOO_BIG");

        // trade trade tokens and add liquidity
        _doSellTradedAndLiquidity(traded2Swap, traded2Liq);

        emit AddedLiquidity(tradedTokenAmount, priceAverageData);

        update();
    }

    function transferFrom(
        address holder,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        if (uniswapV2Pair == recipient) {
            uint256 taxAmount = (amount * sellTax) / FRACTION;
            if (taxAmount != 0) {
                amount -= taxAmount;
                _burn(holder, taxAmount, "", "");
            }
        }
        return super.transferFrom(holder, recipient, amount);
    }

    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        //address from = _msgSender();

        // inject into transfer and burn tax from sender
        // two ways:
        // 1. make calculations, burn taxes from sender and do transaction with substracted values
        if (uniswapV2Pair == _msgSender()) {
            uint256 taxAmount = (amount * buyTax) / FRACTION;

            if (taxAmount != 0) {
                amount -= taxAmount;
                _burn(_msgSender(), taxAmount, "", "");
            }
        }
        return super.transfer(recipient, amount);

        // 2. do usual transaction, then make calculation and burn tax from sides(buyer or seller)
        // we DON'T USE this case, because have callbacks in _move method: _callTokensToSend and _callTokensReceived
        // and than be send to some1 else in recipient contract callback
    }

    ////////////////////////////////////////////////////////////////////////
    // internal section ////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////

    // need to run immedialety after adding liquidity tx and sync cumulativePrice. BUT i's can't applicable if do in the same trasaction with addInitialLiquidity.
    // reserve0 and reserve1 still zero and
    function singlePairSync() internal {
        if (alreadyRunStartupSync == false) {
            alreadyRunStartupSync = true;
            IUniswapV2Pair(uniswapV2Pair).sync();
            //console.log("singlePairSync - synced");
        } else {
            //console.log("singlePairSync - ALREADY synced");
        }
    }

    function _beforeTokenTransfer(
        address, /*operator*/
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        if (
            // if minted
            (from == address(0)) ||
            // or burnt itself
            (from == address(this) && to == address(0)) // ||
        ) {
            //skip validation
        } else {
            uint256 balance = balanceOf(from);
            uint256 locked = tokensLocked[from]._getMinimum();
            require(balance - locked >= amount, "INSUFFICIENT_AMOUNT");
        }
    }

    /**
     * @notice helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**64 - 1]
     */
    function currentBlockTimestamp() internal view returns (uint64) {
        return uint64(block.timestamp % 2**64);
    }

    /**
     * @notice wrapper for getting uniswap reserves function. we use `token01` var here to be sure that reserve0 and token0 are always traded token data
     */
    function _uniswapReserves()
        internal
        view
        returns (
            // reserveTraded, reserveReserved, blockTimestampLast
            uint112,
            uint112,
            uint32
        )
    {
        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(uniswapV2Pair).getReserves();
        require(reserve0 != 0 && reserve1 != 0, "RESERVES_EMPTY");

        if (token01) {
            return (reserve0, reserve1, blockTimestampLast);
        } else {
            return (reserve1, reserve0, blockTimestampLast);
        }
    }

    /**
    * @notice 
        validate params when user claims
        here we should simulate swap totalCumulativeClaimed to reserve token and check price
        price should be less than minClaimPrice
    */
    function _validateClaim(uint256 tradedTokenAmount) internal view {
        (uint112 _reserve0, uint112 _reserve1, ) = IUniswapV2Pair(uniswapV2Pair).getReserves();
        uint256 currentIterationTotalCumulativeClaimed = totalCumulativeClaimed + tradedTokenAmount;
        // amountin reservein reserveout
        uint256 amountOut = IUniswapV2Router02(uniswapRouter).getAmountOut(
            currentIterationTotalCumulativeClaimed,
            _reserve0,
            _reserve1
        );

        require(amountOut > 0, "CLAIM_VALIDATION_ERROR");

        require(
            FixedPoint.fraction(_reserve1 - amountOut, _reserve0 + currentIterationTotalCumulativeClaimed)._x >
                FixedPoint.fraction(minClaimPrice.numerator, minClaimPrice.denominator)._x,
            "PRICE_HAS_BECOME_A_LOWER_THAN_MINCLAIMPRICE"
        );
    }

    /**
     * @notice do claim to the `account` and locked tokens if
     */
    function _claim(uint256 tradedTokenAmount, address account) internal {
        totalCumulativeClaimed += tradedTokenAmount;

        _mint(account, tradedTokenAmount, "", "");

        // lockup tokens for any except:
        // - owner(because it's owner)
        // - current contract(because do sell traded tokens and add liquidity)
        if (_msgSender() != owner() && _msgSender() != address(this)) {
            tokensLocked[account]._minimumsAdd(tradedTokenAmount, lockupIntervalAmount, LOCKUP_INTERVAL, true);
        }
    }

    //
    /**
     * @notice do swap for internal liquidity contract
     */
    function doSwapOnUniswap(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        address beneficiary
    ) internal returns (uint256 amountOut) {
        require(ERC777(tokenIn).approve(address(uniswapRouter), amountIn), "APPROVE_FAILED");

        address[] memory path = new address[](2);
        path[0] = address(tokenIn);
        path[1] = address(tokenOut);
        // amountOutMin is set to 0, so only do this with pairs that have deep liquidity

        uint256[] memory outputAmounts = IUniswapV2Router02(uniswapRouter).swapExactTokensForTokens(
            amountIn,
            0,
            path,
            beneficiary,
            block.timestamp
        );

        amountOut = outputAmounts[1];
    }

    /**
     * @notice
     */
    function tradedAveragePrice() internal view returns (FixedPoint.uq112x112 memory) {
        uint64 blockTimestamp = currentBlockTimestamp();
        uint256 price0Cumulative = IUniswapV2Pair(uniswapV2Pair).price0CumulativeLast();
        uint64 timeElapsed = blockTimestamp - pairObservation.timestampLast;
        uint64 windowSize = ((blockTimestamp - startupTimestamp) * averagePriceWindow) / FRACTION;

        if (timeElapsed > windowSize && timeElapsed > 0 && price0Cumulative > pairObservation.price0CumulativeLast) {
            // console.log("timeElapsed > windowSize && timeElapsed>0");
            // console.log("price0Cumulative                       =", price0Cumulative);
            // console.log("pairObservation.price0CumulativeLast   =", pairObservation.price0CumulativeLast);
            // console.log("timeElapsed                            =", timeElapsed);
            return
                FixedPoint.uq112x112(
                    uint224(price0Cumulative - pairObservation.price0CumulativeLast) / uint224(timeElapsed)
                );
        } else {
            //use stored
            return pairObservation.price0Average;
        }
    }

    function update() internal {
        uint64 blockTimestamp = currentBlockTimestamp();
        uint64 timeElapsed = blockTimestamp - pairObservation.timestampLast;

        uint64 windowSize = ((blockTimestamp - startupTimestamp) * averagePriceWindow) / FRACTION;

        if (timeElapsed > windowSize && timeElapsed > 0) {
            uint256 price0Cumulative = IUniswapV2Pair(uniswapV2Pair).price0CumulativeLast();

            pairObservation.price0Average = FixedPoint
                .uq112x112(uint224(price0Cumulative - pairObservation.price0CumulativeLast))
                .divuq(FixedPoint.encode(timeElapsed));
            pairObservation.price0CumulativeLast = price0Cumulative;

            pairObservation.timestampLast = blockTimestamp;
        }
    }

    function _calculateSellTradedAndLiquidity(uint256 incomingTradedToken)
        internal
        view
        returns (
            uint256 rTraded,
            uint256 rReserved,
            uint256 traded2Swap,
            uint256 traded2Liq,
            uint256 reserved2Liq
        )
    {
        (
            rTraded,
            rReserved, /*uint256 priceTraded*/

        ) = _uniswapReserves();

        traded2Swap = sqrt((rTraded + incomingTradedToken) * (rTraded)) - rTraded; //
        require(traded2Swap > 0 && incomingTradedToken > traded2Swap, "BAD_AMOUNT");

        reserved2Liq = IUniswapV2Router02(uniswapRouter).getAmountOut(traded2Swap, rTraded, rReserved);
        traded2Liq = incomingTradedToken - traded2Swap;
    }

    function _doSellTradedAndLiquidity(uint256 traded2Swap, uint256 traded2Liq) internal {
        // claim to address(this) necessary amount to swap from traded to reserved tokens
        _mint(address(this), traded2Swap, "", "");
        doSwapOnUniswap(tradedToken, reserveToken, traded2Swap, address(internalLiquidity));

        // mint that left to  internalLiquidity contract
        _mint(address(internalLiquidity), traded2Liq, "", "");

        // add to liquidity from there
        internalLiquidity.addLiquidity();
    }

    function _maxAddLiquidity()
        internal
        view
        returns (
            //      traded1 -> traded2->priceAverageData
            uint256,
            uint256,
            uint256
        )
    {
        // tradedNew = Math.sqrt(@tokenPair.r0 * @tokenPair.r1 / (average_price*([email protected]_drop)))

        uint112 reserve0;
        uint112 reserve1;
        uint32 blockTimestampLast;

        (reserve0, reserve1, blockTimestampLast) = _uniswapReserves();

        FixedPoint.uq112x112 memory priceAverageData = tradedAveragePrice();

        FixedPoint.uq112x112 memory q1 = FixedPoint.encode(uint112(sqrt(reserve0)));
        FixedPoint.uq112x112 memory q2 = FixedPoint.encode(uint112(sqrt(reserve1)));
        FixedPoint.uq112x112 memory q3 = (
            priceAverageData.muluq(FixedPoint.encode(uint112(uint256(FRACTION) - priceDrop))).muluq(
                FixedPoint.fraction(1, FRACTION)
            )
        ).sqrt();
        //FixedPoint.uq112x112 memory q4 = FixedPoint.encode(uint112(1)).divuq(q3);

        //traded1*reserve1/(priceaverage*pricedrop)

        //traded1 * reserve1*(1/(priceaverage*pricedrop))

        uint256 reserve0New = (
            q1.muluq(q2).muluq(FixedPoint.encode(uint112(sqrt(FRACTION)))).muluq(
                FixedPoint.encode(uint112(1)).divuq(q3)
            )
        ).decode();

        return (reserve0, reserve0New, priceAverageData._x);
    }

    function sqrt(uint256 x) internal pure returns (uint256 result) {
        if (x == 0) {
            return 0;
        }
        // Calculate the square root of the perfect square of a
        // power of two that is the closest to x.
        uint256 xAux = uint256(x);
        result = 1;
        if (xAux >= 0x100000000000000000000000000000000) {
            xAux >>= 128;
            result <<= 64;
        }
        if (xAux >= 0x10000000000000000) {
            xAux >>= 64;
            result <<= 32;
        }
        if (xAux >= 0x100000000) {
            xAux >>= 32;
            result <<= 16;
        }
        if (xAux >= 0x10000) {
            xAux >>= 16;
            result <<= 8;
        }
        if (xAux >= 0x100) {
            xAux >>= 8;
            result <<= 4;
        }
        if (xAux >= 0x10) {
            xAux >>= 4;
            result <<= 2;
        }
        if (xAux >= 0x8) {
            result <<= 1;
        }
        // The operations can never overflow because the result is
        // max 2^127 when it enters this block.
        unchecked {
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1; // Seven iterations should be enough
            uint256 roundedDownResult = x / result;
            return result >= roundedDownResult ? roundedDownResult : result;
        }
    }
}

File 2 of 23 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 23 : ERC777.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC777.sol";
import "./IERC777Recipient.sol";
import "./IERC777Sender.sol";
import "../ERC20/IERC20.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/IERC1820Registry.sol";

/**
 * @dev Implementation of the {IERC777} 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}.
 *
 * Support for ERC20 is included in this contract, as specified by the EIP: both
 * the ERC777 and ERC20 interfaces can be safely used when interacting with it.
 * Both {IERC777-Sent} and {IERC20-Transfer} events are emitted on token
 * movements.
 *
 * Additionally, the {IERC777-granularity} value is hard-coded to `1`, meaning that there
 * are no special restrictions in the amount of tokens that created, moved, or
 * destroyed. This makes integration with ERC20 applications seamless.
 */
contract ERC777 is Context, IERC777, IERC20 {
    using Address for address;

    IERC1820Registry internal constant _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);

    mapping(address => uint256) private _balances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    bytes32 private constant _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
    bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");

    // This isn't ever read from - it's only used to respond to the defaultOperators query.
    address[] private _defaultOperatorsArray;

    // Immutable, but accounts may revoke them (tracked in __revokedDefaultOperators).
    mapping(address => bool) private _defaultOperators;

    // For each account, a mapping of its operators and revoked default operators.
    mapping(address => mapping(address => bool)) private _operators;
    mapping(address => mapping(address => bool)) private _revokedDefaultOperators;

    // ERC20-allowances
    mapping(address => mapping(address => uint256)) private _allowances;

    /**
     * @dev `defaultOperators` may be an empty array.
     */
    constructor(
        string memory name_,
        string memory symbol_,
        address[] memory defaultOperators_
    ) {
        _name = name_;
        _symbol = symbol_;

        _defaultOperatorsArray = defaultOperators_;
        for (uint256 i = 0; i < defaultOperators_.length; i++) {
            _defaultOperators[defaultOperators_[i]] = true;
        }

        // register interfaces
        _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this));
        _ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC20Token"), address(this));
    }

    /**
     * @dev See {IERC777-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC777-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {ERC20-decimals}.
     *
     * Always returns 18, as per the
     * [ERC777 EIP](https://eips.ethereum.org/EIPS/eip-777#backward-compatibility).
     */
    function decimals() public pure virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC777-granularity}.
     *
     * This implementation always returns `1`.
     */
    function granularity() public view virtual override returns (uint256) {
        return 1;
    }

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

    /**
     * @dev Returns the amount of tokens owned by an account (`tokenHolder`).
     */
    function balanceOf(address tokenHolder) public view virtual override(IERC20, IERC777) returns (uint256) {
        return _balances[tokenHolder];
    }

    /**
     * @dev See {IERC777-send}.
     *
     * Also emits a {IERC20-Transfer} event for ERC20 compatibility.
     */
    function send(
        address recipient,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        _send(_msgSender(), recipient, amount, data, "", true);
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Unlike `send`, `recipient` is _not_ required to implement the {IERC777Recipient}
     * interface if it is a contract.
     *
     * Also emits a {Sent} event.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        require(recipient != address(0), "ERC777: transfer to the zero address");

        address from = _msgSender();

        _callTokensToSend(from, from, recipient, amount, "", "");

        _move(from, from, recipient, amount, "", "");

        _callTokensReceived(from, from, recipient, amount, "", "", false);

        return true;
    }

    /**
     * @dev See {IERC777-burn}.
     *
     * Also emits a {IERC20-Transfer} event for ERC20 compatibility.
     */
    function burn(uint256 amount, bytes memory data) public virtual override {
        _burn(_msgSender(), amount, data, "");
    }

    /**
     * @dev See {IERC777-isOperatorFor}.
     */
    function isOperatorFor(address operator, address tokenHolder) public view virtual override returns (bool) {
        return
            operator == tokenHolder ||
            (_defaultOperators[operator] && !_revokedDefaultOperators[tokenHolder][operator]) ||
            _operators[tokenHolder][operator];
    }

    /**
     * @dev See {IERC777-authorizeOperator}.
     */
    function authorizeOperator(address operator) public virtual override {
        require(_msgSender() != operator, "ERC777: authorizing self as operator");

        if (_defaultOperators[operator]) {
            delete _revokedDefaultOperators[_msgSender()][operator];
        } else {
            _operators[_msgSender()][operator] = true;
        }

        emit AuthorizedOperator(operator, _msgSender());
    }

    /**
     * @dev See {IERC777-revokeOperator}.
     */
    function revokeOperator(address operator) public virtual override {
        require(operator != _msgSender(), "ERC777: revoking self as operator");

        if (_defaultOperators[operator]) {
            _revokedDefaultOperators[_msgSender()][operator] = true;
        } else {
            delete _operators[_msgSender()][operator];
        }

        emit RevokedOperator(operator, _msgSender());
    }

    /**
     * @dev See {IERC777-defaultOperators}.
     */
    function defaultOperators() public view virtual override returns (address[] memory) {
        return _defaultOperatorsArray;
    }

    /**
     * @dev See {IERC777-operatorSend}.
     *
     * Emits {Sent} and {IERC20-Transfer} events.
     */
    function operatorSend(
        address sender,
        address recipient,
        uint256 amount,
        bytes memory data,
        bytes memory operatorData
    ) public virtual override {
        require(isOperatorFor(_msgSender(), sender), "ERC777: caller is not an operator for holder");
        _send(sender, recipient, amount, data, operatorData, true);
    }

    /**
     * @dev See {IERC777-operatorBurn}.
     *
     * Emits {Burned} and {IERC20-Transfer} events.
     */
    function operatorBurn(
        address account,
        uint256 amount,
        bytes memory data,
        bytes memory operatorData
    ) public virtual override {
        require(isOperatorFor(_msgSender(), account), "ERC777: caller is not an operator for holder");
        _burn(account, amount, data, operatorData);
    }

    /**
     * @dev See {IERC20-allowance}.
     *
     * Note that operator and allowance concepts are orthogonal: operators may
     * not have allowance, and accounts with allowance may not be operators
     * themselves.
     */
    function allowance(address holder, address spender) public view virtual override returns (uint256) {
        return _allowances[holder][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Note that accounts cannot have allowance issued by their operators.
     */
    function approve(address spender, uint256 value) public virtual override returns (bool) {
        address holder = _msgSender();
        _approve(holder, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Note that operator and allowance concepts are orthogonal: operators cannot
     * call `transferFrom` (unless they have allowance), and accounts with
     * allowance cannot call `operatorSend` (unless they are operators).
     *
     * Emits {Sent}, {IERC20-Transfer} and {IERC20-Approval} events.
     */
    function transferFrom(
        address holder,
        address recipient,
        uint256 amount
    ) public virtual override returns (bool) {
        require(recipient != address(0), "ERC777: transfer to the zero address");
        require(holder != address(0), "ERC777: transfer from the zero address");

        address spender = _msgSender();

        _callTokensToSend(spender, holder, recipient, amount, "", "");

        _move(spender, holder, recipient, amount, "", "");

        uint256 currentAllowance = _allowances[holder][spender];
        require(currentAllowance >= amount, "ERC777: transfer amount exceeds allowance");
        _approve(holder, spender, currentAllowance - amount);

        _callTokensReceived(spender, holder, recipient, amount, "", "", false);

        return true;
    }

    /**
     * @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * If a send hook is registered for `account`, the corresponding function
     * will be called with `operator`, `data` and `operatorData`.
     *
     * See {IERC777Sender} and {IERC777Recipient}.
     *
     * Emits {Minted} and {IERC20-Transfer} events.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - if `account` is a contract, it must implement the {IERC777Recipient}
     * interface.
     */
    function _mint(
        address account,
        uint256 amount,
        bytes memory userData,
        bytes memory operatorData
    ) internal virtual {
        _mint(account, amount, userData, operatorData, true);
    }

    /**
     * @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * If `requireReceptionAck` is set to true, and if a send hook is
     * registered for `account`, the corresponding function will be called with
     * `operator`, `data` and `operatorData`.
     *
     * See {IERC777Sender} and {IERC777Recipient}.
     *
     * Emits {Minted} and {IERC20-Transfer} events.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - if `account` is a contract, it must implement the {IERC777Recipient}
     * interface.
     */
    function _mint(
        address account,
        uint256 amount,
        bytes memory userData,
        bytes memory operatorData,
        bool requireReceptionAck
    ) internal virtual {
        require(account != address(0), "ERC777: mint to the zero address");

        address operator = _msgSender();

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

        // Update state variables
        _totalSupply += amount;
        _balances[account] += amount;

        _callTokensReceived(operator, address(0), account, amount, userData, operatorData, requireReceptionAck);

        emit Minted(operator, account, amount, userData, operatorData);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Send tokens
     * @param from address token holder address
     * @param to address recipient address
     * @param amount uint256 amount of tokens to transfer
     * @param userData bytes extra information provided by the token holder (if any)
     * @param operatorData bytes extra information provided by the operator (if any)
     * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient
     */
    function _send(
        address from,
        address to,
        uint256 amount,
        bytes memory userData,
        bytes memory operatorData,
        bool requireReceptionAck
    ) internal virtual {
        require(from != address(0), "ERC777: send from the zero address");
        require(to != address(0), "ERC777: send to the zero address");

        address operator = _msgSender();

        _callTokensToSend(operator, from, to, amount, userData, operatorData);

        _move(operator, from, to, amount, userData, operatorData);

        _callTokensReceived(operator, from, to, amount, userData, operatorData, requireReceptionAck);
    }

    /**
     * @dev Burn tokens
     * @param from address token holder address
     * @param amount uint256 amount of tokens to burn
     * @param data bytes extra information provided by the token holder
     * @param operatorData bytes extra information provided by the operator (if any)
     */
    function _burn(
        address from,
        uint256 amount,
        bytes memory data,
        bytes memory operatorData
    ) internal virtual {
        require(from != address(0), "ERC777: burn from the zero address");

        address operator = _msgSender();

        _callTokensToSend(operator, from, address(0), amount, data, operatorData);

        _beforeTokenTransfer(operator, from, address(0), amount);

        // Update state variables
        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC777: burn amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _totalSupply -= amount;

        emit Burned(operator, from, amount, data, operatorData);
        emit Transfer(from, address(0), amount);
    }

    function _move(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes memory userData,
        bytes memory operatorData
    ) private {
        _beforeTokenTransfer(operator, from, to, amount);

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

        emit Sent(operator, from, to, amount, userData, operatorData);
        emit Transfer(from, to, amount);
    }

    /**
     * @dev See {ERC20-_approve}.
     *
     * Note that accounts cannot have allowance issued by their operators.
     */
    function _approve(
        address holder,
        address spender,
        uint256 value
    ) internal {
        require(holder != address(0), "ERC777: approve from the zero address");
        require(spender != address(0), "ERC777: approve to the zero address");

        _allowances[holder][spender] = value;
        emit Approval(holder, spender, value);
    }

    /**
     * @dev Call from.tokensToSend() if the interface is registered
     * @param operator address operator requesting the transfer
     * @param from address token holder address
     * @param to address recipient address
     * @param amount uint256 amount of tokens to transfer
     * @param userData bytes extra information provided by the token holder (if any)
     * @param operatorData bytes extra information provided by the operator (if any)
     */
    function _callTokensToSend(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes memory userData,
        bytes memory operatorData
    ) private {
        address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(from, _TOKENS_SENDER_INTERFACE_HASH);
        if (implementer != address(0)) {
            IERC777Sender(implementer).tokensToSend(operator, from, to, amount, userData, operatorData);
        }
    }

    /**
     * @dev Call to.tokensReceived() if the interface is registered. Reverts if the recipient is a contract but
     * tokensReceived() was not registered for the recipient
     * @param operator address operator requesting the transfer
     * @param from address token holder address
     * @param to address recipient address
     * @param amount uint256 amount of tokens to transfer
     * @param userData bytes extra information provided by the token holder (if any)
     * @param operatorData bytes extra information provided by the operator (if any)
     * @param requireReceptionAck if true, contract recipients are required to implement ERC777TokensRecipient
     */
    function _callTokensReceived(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes memory userData,
        bytes memory operatorData,
        bool requireReceptionAck
    ) private {
        address implementer = _ERC1820_REGISTRY.getInterfaceImplementer(to, _TOKENS_RECIPIENT_INTERFACE_HASH);
        if (implementer != address(0)) {
            IERC777Recipient(implementer).tokensReceived(operator, from, to, amount, userData, operatorData);
        } else if (requireReceptionAck) {
            require(!to.isContract(), "ERC777: token recipient contract has no implementer for ERC777TokensRecipient");
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes
     * calls to {send}, {transfer}, {operatorSend}, minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to 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 operator,
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 4 of 23 : IERC777Recipient.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.
 *
 * Accounts can be notified of {IERC777} tokens being sent to them by having a
 * contract implement this interface (contract holders can be their own
 * implementer) and registering it on the
 * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
 *
 * See {IERC1820Registry} and {ERC1820Implementer}.
 */
interface IERC777Recipient {
    /**
     * @dev Called by an {IERC777} token contract whenever tokens are being
     * moved or created into a registered account (`to`). The type of operation
     * is conveyed by `from` being the zero address or not.
     *
     * This call occurs _after_ the token contract's state is updated, so
     * {IERC777-balanceOf}, etc., can be used to query the post-operation state.
     *
     * This function may revert to prevent the operation from being executed.
     */
    function tokensReceived(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata userData,
        bytes calldata operatorData
    ) external;
}

File 5 of 23 : IERC777Sender.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC777TokensSender standard as defined in the EIP.
 *
 * {IERC777} Token holders can be notified of operations performed on their
 * tokens by having a contract implement this interface (contract holders can be
 * their own implementer) and registering it on the
 * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
 *
 * See {IERC1820Registry} and {ERC1820Implementer}.
 */
interface IERC777Sender {
    /**
     * @dev Called by an {IERC777} token contract whenever a registered holder's
     * (`from`) tokens are about to be moved or destroyed. The type of operation
     * is conveyed by `to` being the zero address or not.
     *
     * This call occurs _before_ the token contract's state is updated, so
     * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.
     *
     * This function may revert to prevent the operation from being executed.
     */
    function tokensToSend(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata userData,
        bytes calldata operatorData
    ) external;
}

File 6 of 23 : IERC1820Registry.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the global ERC1820 Registry, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1820[EIP]. Accounts may register
 * implementers for interfaces in this registry, as well as query support.
 *
 * Implementers may be shared by multiple accounts, and can also implement more
 * than a single interface for each account. Contracts can implement interfaces
 * for themselves, but externally-owned accounts (EOA) must delegate this to a
 * contract.
 *
 * {IERC165} interfaces can also be queried via the registry.
 *
 * For an in-depth explanation and source code analysis, see the EIP text.
 */
interface IERC1820Registry {
    /**
     * @dev Sets `newManager` as the manager for `account`. A manager of an
     * account is able to set interface implementers for it.
     *
     * By default, each account is its own manager. Passing a value of `0x0` in
     * `newManager` will reset the manager to this initial state.
     *
     * Emits a {ManagerChanged} event.
     *
     * Requirements:
     *
     * - the caller must be the current manager for `account`.
     */
    function setManager(address account, address newManager) external;

    /**
     * @dev Returns the manager for `account`.
     *
     * See {setManager}.
     */
    function getManager(address account) external view returns (address);

    /**
     * @dev Sets the `implementer` contract as ``account``'s implementer for
     * `interfaceHash`.
     *
     * `account` being the zero address is an alias for the caller's address.
     * The zero address can also be used in `implementer` to remove an old one.
     *
     * See {interfaceHash} to learn how these are created.
     *
     * Emits an {InterfaceImplementerSet} event.
     *
     * Requirements:
     *
     * - the caller must be the current manager for `account`.
     * - `interfaceHash` must not be an {IERC165} interface id (i.e. it must not
     * end in 28 zeroes).
     * - `implementer` must implement {IERC1820Implementer} and return true when
     * queried for support, unless `implementer` is the caller. See
     * {IERC1820Implementer-canImplementInterfaceForAddress}.
     */
    function setInterfaceImplementer(
        address account,
        bytes32 _interfaceHash,
        address implementer
    ) external;

    /**
     * @dev Returns the implementer of `interfaceHash` for `account`. If no such
     * implementer is registered, returns the zero address.
     *
     * If `interfaceHash` is an {IERC165} interface id (i.e. it ends with 28
     * zeroes), `account` will be queried for support of it.
     *
     * `account` being the zero address is an alias for the caller's address.
     */
    function getInterfaceImplementer(address account, bytes32 _interfaceHash) external view returns (address);

    /**
     * @dev Returns the interface hash for an `interfaceName`, as defined in the
     * corresponding
     * https://eips.ethereum.org/EIPS/eip-1820#interface-name[section of the EIP].
     */
    function interfaceHash(string calldata interfaceName) external pure returns (bytes32);

    /**
     * @notice Updates the cache with whether the contract implements an ERC165 interface or not.
     * @param account Address of the contract for which to update the cache.
     * @param interfaceId ERC165 interface for which to update the cache.
     */
    function updateERC165Cache(address account, bytes4 interfaceId) external;

    /**
     * @notice Checks whether a contract implements an ERC165 interface or not.
     * If the result is not cached a direct lookup on the contract address is performed.
     * If the result is not cached or the cached value is out-of-date, the cache MUST be updated manually by calling
     * {updateERC165Cache} with the contract address.
     * @param account Address of the contract to check.
     * @param interfaceId ERC165 interface to check.
     * @return True if `account` implements `interfaceId`, false otherwise.
     */
    function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool);

    /**
     * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache.
     * @param account Address of the contract to check.
     * @param interfaceId ERC165 interface to check.
     * @return True if `account` implements `interfaceId`, false otherwise.
     */
    function implementsERC165InterfaceNoCache(address account, bytes4 interfaceId) external view returns (bool);

    event InterfaceImplementerSet(address indexed account, bytes32 indexed interfaceHash, address indexed implementer);

    event ManagerChanged(address indexed account, address indexed newManager);
}

File 7 of 23 : 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;
}

File 8 of 23 : 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;
}

File 9 of 23 : 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;
}

File 10 of 23 : SwapSettingsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

library SwapSettingsLib {
    function netWorkSettings(
    )
        internal
        view
        returns(address, address)
    {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        if ((chainId == 0x1) || (chainId == 0x3) || (chainId == 0x4) || (chainId == 0x539) || (chainId == 0x7a69)) {  //+ localganache chainId, used for fork 
            // Ethereum-Uniswap
            return( 
                0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, //uniswapRouter
                0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f  //uniswapRouterFactory
            );
        } else if(chainId == 0x89) {
            // Matic-QuickSwap
            return( 
                0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff, //uniswapRouter
                0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32  //uniswapRouterFactory
            );
        } else if(chainId == 0x38) {
            // Binance-PancakeSwap
            return( 
                0x10ED43C718714eb63d5aA57B78B54704E256024E, //uniswapRouter
                0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73  //uniswapRouterFactory
            );
        } else {
            revert("unsupported chain");
        }
    }

}

File 11 of 23 : FixedPoint.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;

import './FullMath.sol';
import './Babylonian.sol';
import './BitMath.sol';

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
library FixedPoint {
    // range: [0, 2**112 - 1]
    // resolution: 1 / 2**112
    struct uq112x112 {
        uint224 _x;
    }

    // range: [0, 2**144 - 1]
    // resolution: 1 / 2**112
    struct uq144x112 {
        uint256 _x;
    }

    uint8 public constant RESOLUTION = 112;
    uint256 public constant Q112 = 0x10000000000000000000000000000; // 2**112
    uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000; // 2**224
    uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)

    // encode a uint112 as a UQ112x112
    function encode(uint112 x) internal pure returns (uq112x112 memory) {
        return uq112x112(uint224(x) << RESOLUTION);
    }

    // encodes a uint144 as a UQ144x112
    function encode144(uint144 x) internal pure returns (uq144x112 memory) {
        return uq144x112(uint256(x) << RESOLUTION);
    }

    // decode a UQ112x112 into a uint112 by truncating after the radix point
    function decode(uq112x112 memory self) internal pure returns (uint112) {
        return uint112(self._x >> RESOLUTION);
    }

    // decode a UQ144x112 into a uint144 by truncating after the radix point
    function decode144(uq144x112 memory self) internal pure returns (uint144) {
        return uint144(self._x >> RESOLUTION);
    }

    // multiply a UQ112x112 by a uint, returning a UQ144x112
    // reverts on overflow
    function mul(uq112x112 memory self, uint256 y) internal pure returns (uq144x112 memory) {
        uint256 z = 0;
        require(y == 0 || (z = self._x * y) / y == self._x, 'FixedPoint::mul: overflow');
        return uq144x112(z);
    }

    // multiply a UQ112x112 by an int and decode, returning an int
    // reverts on overflow
    function muli(uq112x112 memory self, int256 y) internal pure returns (int256) {
        uint256 z = FullMath.mulDiv(self._x, uint256(y < 0 ? -y : y), Q112);
        require(z < 2**255, 'FixedPoint::muli: overflow');
        return y < 0 ? -int256(z) : int256(z);
    }

    // multiply a UQ112x112 by a UQ112x112, returning a UQ112x112
    // lossy
    function muluq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {
        if (self._x == 0 || other._x == 0) {
            return uq112x112(0);
        }
        uint112 upper_self = uint112(self._x >> RESOLUTION); // * 2^0
        uint112 lower_self = uint112(self._x & LOWER_MASK); // * 2^-112
        uint112 upper_other = uint112(other._x >> RESOLUTION); // * 2^0
        uint112 lower_other = uint112(other._x & LOWER_MASK); // * 2^-112

        // partial products
        uint224 upper = uint224(upper_self) * upper_other; // * 2^0
        uint224 lower = uint224(lower_self) * lower_other; // * 2^-224
        uint224 uppers_lowero = uint224(upper_self) * lower_other; // * 2^-112
        uint224 uppero_lowers = uint224(upper_other) * lower_self; // * 2^-112

        // so the bit shift does not overflow
        require(upper <= type(uint112).max, 'FixedPoint::muluq: upper overflow');

        // this cannot exceed 256 bits, all values are 224 bits
        uint256 sum = uint256(upper << RESOLUTION) + uppers_lowero + uppero_lowers + (lower >> RESOLUTION);

        // so the cast does not overflow
        require(sum <= type(uint224).max, 'FixedPoint::muluq: sum overflow');

        return uq112x112(uint224(sum));
    }

    // divide a UQ112x112 by a UQ112x112, returning a UQ112x112
    function divuq(uq112x112 memory self, uq112x112 memory other) internal pure returns (uq112x112 memory) {
        require(other._x > 0, 'FixedPoint::divuq: division by zero');
        if (self._x == other._x) {
            return uq112x112(uint224(Q112));
        }
        if (self._x <= type(uint144).max) {
            uint256 value = (uint256(self._x) << RESOLUTION) / other._x;
            require(value <= type(uint224).max, 'FixedPoint::divuq: overflow');
            return uq112x112(uint224(value));
        }

        uint256 result = FullMath.mulDiv(Q112, self._x, other._x);
        require(result <= type(uint224).max, 'FixedPoint::divuq: overflow');
        return uq112x112(uint224(result));
    }

    // returns a UQ112x112 which represents the ratio of the numerator to the denominator
    // can be lossy
    function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
        require(denominator > 0, 'FixedPoint::fraction: division by zero');
        if (numerator == 0) return FixedPoint.uq112x112(0);

        if (numerator <= type(uint144).max) {
            uint256 result = (numerator << RESOLUTION) / denominator;
            require(result <=type(uint224).max, 'FixedPoint::fraction: overflow');
            return uq112x112(uint224(result));
        } else {
            uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
            require(result <= type(uint224).max, 'FixedPoint::fraction: overflow');
            return uq112x112(uint224(result));
        }
    }

    // take the reciprocal of a UQ112x112
    // reverts on overflow
    // lossy
    function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        require(self._x != 0, 'FixedPoint::reciprocal: reciprocal of zero');
        require(self._x != 1, 'FixedPoint::reciprocal: overflow');
        return uq112x112(uint224(Q224 / self._x));
    }

    // square root of a UQ112x112
    // lossy between 0/1 and 40 bits
    function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
        if (self._x <= type(uint144).max) {
            return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
        }

        uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
        safeShiftBits -= safeShiftBits % 2;
        return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
    }
}

File 12 of 23 : MinimumsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

library MinimumsLib {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    //address internal constant ZERO_ADDRESS = address(0);

    struct Minimum {
     //   uint256 timestampStart; //ts start no need 
        //uint256 timestampEnd;   //ts end
        uint256 speedGradualUnlock;    
        uint256 amountGradualWithdrawn;
        //uint256 amountGradual;
        uint256 amountNoneGradual;
        //bool gradual;
    }

    struct Lockup {
        uint64 duration;
        //bool gradual; // does not used 
        bool exists;
    }

    struct UserStruct {
        EnumerableSetUpgradeable.UintSet minimumsIndexes;
        mapping(uint256 => Minimum) minimums;
        //mapping(uint256 => uint256) dailyAmounts;
        Lockup lockup;
    }


      /**
    * @dev adding minimum holding at sender during period from now to timestamp.
    *
    * @param amount amount.
    * @param intervalCount duration in count of intervals defined before
    * @param gradual true if the limitation can gradually decrease
    */
    function _minimumsAdd(
        UserStruct storage _userStruct,
        uint256 amount, 
        uint256 intervalCount,
        uint64 interval,
        bool gradual
    ) 
        // public 
        // onlyOwner()
        internal
        returns (bool)
    {
        uint256 timestampStart = getIndexInterval(block.timestamp, interval);
        uint256 timestampEnd = timestampStart + (intervalCount * interval);
        require(timestampEnd > timestampStart, "TIMESTAMP_INVALID");
        
        _minimumsClear(_userStruct, interval, false);
        
        _minimumsAddLow(_userStruct, timestampStart, timestampEnd, amount, gradual);
    
        return true;
        
    }
    
    /**
     * @dev removes all minimums from this address
     * so all tokens are unlocked to send
     *  UserStruct which should be clear restrict
     */
    function _minimumsClear(
        UserStruct storage _userStruct,
        uint64 interval
    )
        internal
        returns (bool)
    {
        return _minimumsClear(_userStruct, interval, true);
    }
    
    /**
     * from will add automatic lockup for destination address sent address from
     * @param duration duration in count of intervals defined before
     */
    function _automaticLockupAdd(
        UserStruct storage _userStruct,
        uint64 duration,
        uint64 interval
    )
        internal
    {
        _userStruct.lockup.duration = duration * interval;
        _userStruct.lockup.exists = true;
    }
    
    /**
     * remove automaticLockup from UserStruct
     */
    function _automaticLockupRemove(
        UserStruct storage _userStruct
    )
        internal
    {
        _userStruct.lockup.exists = false;
    }
    
    /**
    * @dev get sum minimum and sum gradual minimums from address for period from now to timestamp.
    *
    */
    function _getMinimum(
        UserStruct storage _userStruct
    ) 
        internal 
        view
        returns (uint256 amountLocked) 
    {
        
        uint256 mapIndex;
        uint256 tmp;
        for (uint256 i=0; i<_userStruct.minimumsIndexes.length(); i++) {
            mapIndex = _userStruct.minimumsIndexes.at(i);
            
            if (block.timestamp <= mapIndex) { // block.timestamp<timestampEnd
                tmp = _userStruct.minimums[mapIndex].speedGradualUnlock * (mapIndex - block.timestamp);
                
                amountLocked = amountLocked +
                                    (
                                        tmp < _userStruct.minimums[mapIndex].amountGradualWithdrawn 
                                        ? 
                                        0 
                                        : 
                                        tmp - (_userStruct.minimums[mapIndex].amountGradualWithdrawn)
                                    ) +
                                    (_userStruct.minimums[mapIndex].amountNoneGradual);
            }
        }
    }

    function _getMinimumList(
        UserStruct storage _userStruct
    ) 
        internal 
        view
        returns (uint256[][] memory ) 
    {
        
        uint256 mapIndex;
        uint256 tmp;
        uint256 len = _userStruct.minimumsIndexes.length();

        uint256[][] memory ret = new uint256[][](len);


        for (uint256 i=0; i<len; i++) {
            mapIndex = _userStruct.minimumsIndexes.at(i);
            
            if (block.timestamp <= mapIndex) { // block.timestamp<timestampEnd
                tmp = _userStruct.minimums[mapIndex].speedGradualUnlock * (mapIndex - block.timestamp);
                ret[i] = new uint256[](2);
                ret[i][1] = mapIndex;
                ret[i][0] = (
                                tmp < _userStruct.minimums[mapIndex].amountGradualWithdrawn 
                                ? 
                                0 
                                : 
                                tmp - _userStruct.minimums[mapIndex].amountGradualWithdrawn
                            ) +
                            _userStruct.minimums[mapIndex].amountNoneGradual;
            }
        }

        return ret;
    }
    
    /**
    * @dev clear expired items from mapping. used while addingMinimum
    *
    * @param deleteAnyway if true when delete items regardless expired or not
    */
    function _minimumsClear(
        UserStruct storage _userStruct,
        uint64 interval,
        bool deleteAnyway
    ) 
        internal 
        returns (bool) 
    {
        uint256 mapIndex = 0;
        uint256 len = _userStruct.minimumsIndexes.length();
        if (len > 0) {
            for (uint256 i=len; i>0; i--) {
                mapIndex = _userStruct.minimumsIndexes.at(i-1);
                if (
                    (deleteAnyway == true) ||
                    (getIndexInterval(block.timestamp, interval) > mapIndex)
                ) {
                    delete _userStruct.minimums[mapIndex];
                    _userStruct.minimumsIndexes.remove(mapIndex);
                }
                
            }
        }
        return true;
    }


        
    /**
     * added minimum if not exist by timestamp else append it
     * @param _userStruct destination user
     * @param timestampStart if empty get current interval or currente time. Using only for calculate gradual
     * @param timestampEnd "until time"
     * @param amount amount
     * @param gradual if true then lockup are gradually
     */
    //function _appendMinimum(
    function _minimumsAddLow(
        UserStruct storage _userStruct,
        uint256 timestampStart, 
        uint256 timestampEnd, 
        uint256 amount, 
        bool gradual
    )
        private
    {
        _userStruct.minimumsIndexes.add(timestampEnd);
        if (gradual == true) {
            // gradual
            _userStruct.minimums[timestampEnd].speedGradualUnlock = _userStruct.minimums[timestampEnd].speedGradualUnlock + 
                (
                amount / (timestampEnd - timestampStart)
                );
            //_userStruct.minimums[timestamp].amountGradual = _userStruct.minimums[timestamp].amountGradual.add(amount);
        } else {
            // none-gradual
            _userStruct.minimums[timestampEnd].amountNoneGradual = _userStruct.minimums[timestampEnd].amountNoneGradual + amount;
        }
    }
    
    /**
     * @dev reduce minimum by value  otherwise remove it 
     * @param _userStruct destination user struct
     * @param timestampEnd "until time"
     * @param value amount
     */
    function _reduceMinimum(
        UserStruct storage _userStruct,
        uint256 timestampEnd, 
        uint256 value,
        bool gradual
    )
        internal
    {
        
        if (_userStruct.minimumsIndexes.contains(timestampEnd) == true) {
            
            if (gradual == true) {
                
                _userStruct.minimums[timestampEnd].amountGradualWithdrawn = _userStruct.minimums[timestampEnd].amountGradualWithdrawn + value;
                
                uint256 left = (_userStruct.minimums[timestampEnd].speedGradualUnlock) * (timestampEnd - block.timestamp);
                if (left <= _userStruct.minimums[timestampEnd].amountGradualWithdrawn) {
                    _userStruct.minimums[timestampEnd].speedGradualUnlock = 0;
                    // delete _userStruct.minimums[timestampEnd];
                    // _userStruct.minimumsIndexes.remove(timestampEnd);
                }
            } else {
                if (_userStruct.minimums[timestampEnd].amountNoneGradual > value) {
                    _userStruct.minimums[timestampEnd].amountNoneGradual = _userStruct.minimums[timestampEnd].amountNoneGradual - value;
                } else {
                    _userStruct.minimums[timestampEnd].amountNoneGradual = 0;
                    // delete _userStruct.minimums[timestampEnd];
                    // _userStruct.minimumsIndexes.remove(timestampEnd);
                }
                    
            }
            
            if (
                _userStruct.minimums[timestampEnd].speedGradualUnlock == 0 &&
                _userStruct.minimums[timestampEnd].amountNoneGradual == 0
            ) {
                delete _userStruct.minimums[timestampEnd];
                _userStruct.minimumsIndexes.remove(timestampEnd);
            }
                
                
            
        }
    }
    
    /**
     * 
     
     * @param value amount
     */
    function minimumsTransfer(
        UserStruct storage _userStructFrom, 
        UserStruct storage _userStructTo, 
        bool isTransferToZeroAddress,
        //address to,
        uint256 value
    )
        internal
    {
        

        uint256 len = _userStructFrom.minimumsIndexes.length();
        uint256[] memory _dataList;
        //uint256 recieverTimeLeft;
    
        if (len > 0) {
            _dataList = new uint256[](len);
            for (uint256 i=0; i<len; i++) {
                _dataList[i] = _userStructFrom.minimumsIndexes.at(i);
            }
            _dataList = sortAsc(_dataList);
            
            uint256 iValue;
            uint256 tmpValue;
        
            for (uint256 i=0; i<len; i++) {
                
                if (block.timestamp <= _dataList[i]) {
                    
                    // try move none-gradual
                    if (value >= _userStructFrom.minimums[_dataList[i]].amountNoneGradual) {
                        iValue = _userStructFrom.minimums[_dataList[i]].amountNoneGradual;
                        value = value - iValue;
                    } else {
                        iValue = value;
                        value = 0;
                    }
                    
                    // remove from sender
                    _reduceMinimum(
                        _userStructFrom,
                        _dataList[i],//timestampEnd,
                        iValue,
                        false
                    );

                    // shouldn't add miniums for zero account.
                    // that feature using to drop minimums from sender
                    //if (to != ZERO_ADDRESS) {
                    if (!isTransferToZeroAddress) {
                        _minimumsAddLow(_userStructTo, block.timestamp, _dataList[i], iValue, false);
                    }
                    
                    if (value == 0) {
                        break;
                    }
                    
                    
                    // try move gradual
                    
                    // amount left in current minimums
                    tmpValue = _userStructFrom.minimums[_dataList[i]].speedGradualUnlock * (_dataList[i] - block.timestamp);
                        
                        
                    if (value >= tmpValue) {
                        iValue = tmpValue;
                        value = value - tmpValue;

                    } else {
                        iValue = value;
                        value = 0;
                    }
                    // remove from sender
                    _reduceMinimum(
                        _userStructFrom,
                        _dataList[i],//timestampEnd,
                        iValue,
                        true
                    );
                    // uint256 speed = iValue.div(
                        //     users[from].minimums[_dataList[i]].timestampEnd.sub(block.timestamp);
                        // );

                    // shouldn't add miniums for zero account.
                    // that feature using to drop minimums from sender
                    //if (to != ZERO_ADDRESS) {
                    if (!isTransferToZeroAddress) {
                        _minimumsAddLow(_userStructTo, block.timestamp, _dataList[i], iValue, true);
                    }
                    if (value == 0) {
                        break;
                    }
                    


                } // if (block.timestamp <= users[from].minimums[_dataList[i]].timestampEnd) {
            } // end for
            
   
        }
        
        // if (value != 0) {
            // todo 0: what this?
            // _appendMinimum(
            //     to,
            //     block.timestamp,//block.timestamp.add(minTimeDiff),
            //     value,
            //     false
            // );
        // }
     
        
    }

    /**
    * @dev gives index interval. here we deliberately making a loss precision(div before mul) to get the same index during interval.
    * @param ts unixtimestamp
    */
    function getIndexInterval(uint256 ts, uint64 interval) internal pure returns(uint256) {
        return ts / interval * interval;
    }
    
    // useful method to sort native memory array 
    function sortAsc(uint256[] memory data) private returns(uint[] memory) {
       quickSortAsc(data, int(0), int(data.length - 1));
       return data;
    }
    
    function quickSortAsc(uint[] memory arr, int left, int right) private {
        int i = left;
        int j = right;
        if(i==j) return;
        uint pivot = arr[uint(left + (right - left) / 2)];
        while (i <= j) {
            while (arr[uint(i)] < pivot) i++;
            while (pivot < arr[uint(j)]) j--;
            if (i <= j) {
                (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);
                i++;
                j--;
            }
        }
        if (left < j)
            quickSortAsc(arr, left, j);
        if (i < right)
            quickSortAsc(arr, i, right);
    }

 


}

File 13 of 23 : ExecuteManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

abstract contract ExecuteManager {
    uint8 private runOnlyOnceFlag;

    modifier runOnlyOnce() {
        require(runOnlyOnceFlag < 1, "already called");
        runOnlyOnceFlag = 1;
        _;
    }
}

File 14 of 23 : Liquidity.sol
// SPDX-License-Identifier: AGPL
pragma solidity ^0.8.15;

import "@openzeppelin/contracts/token/ERC777/IERC777Recipient.sol";
import "@openzeppelin/contracts/token/ERC777/IERC777.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/introspection/IERC1820Registry.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";

//import "hardhat/console.sol";

contract Liquidity is IERC777Recipient {
    address internal immutable token0;
    address internal immutable token1;
    address internal immutable uniswapRouter;
    IERC1820Registry internal constant _ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
    bytes32 private constant _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");

    constructor(
        address token0_,
        address token1_,
        address uniswapRouter_
    ) {
        token0 = token0_;
        token1 = token1_;
        uniswapRouter = uniswapRouter_;

        // register interfaces
        _ERC1820_REGISTRY.setInterfaceImplementer(address(this), _TOKENS_RECIPIENT_INTERFACE_HASH, address(this));
    }

    /**
     * adding liquidity for all available balance
     */
    function addLiquidity() external {
        uint256 token0Amount = IERC20(token0).balanceOf(address(this));
        uint256 token1Amount = IERC20(token1).balanceOf(address(this));

        _addLiquidity(token0Amount, token1Amount);
    }

    function tokensReceived(
        address operator,
        address from,
        address to,
        uint256 amount,
        bytes calldata userData,
        bytes calldata operatorData
    ) external {}

    /**
     * approve tokens to uniswap router obtain LP tokens and move to zero address
     */
    function _addLiquidity(uint256 token0Amount, uint256 token1Amount) internal {
        IERC20(token0).approve(address(uniswapRouter), token0Amount);
        IERC20(token1).approve(address(uniswapRouter), token1Amount);

        //(/* uint256 A*/, /*uint256 B*/, /*uint256 lpTokens*/) =
        IUniswapV2Router02(uniswapRouter).addLiquidity(
            token0,
            token1,
            token0Amount,
            token1Amount,
            0, // there may be some slippage
            0, // there may be some slippage
            address(0),
            block.timestamp
        );
    }
}

File 15 of 23 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 16 of 23 : IERC777.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC777Token standard as defined in the EIP.
 *
 * This contract uses the
 * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 registry standard] to let
 * token holders and recipients react to token movements by using setting implementers
 * for the associated interfaces in said registry. See {IERC1820Registry} and
 * {ERC1820Implementer}.
 */
interface IERC777 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the smallest part of the token that is not divisible. This
     * means all token operations (creation, movement and destruction) must have
     * amounts that are a multiple of this number.
     *
     * For most token contracts, this value will equal 1.
     */
    function granularity() external view returns (uint256);

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

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * If send or receive hooks are registered for the caller and `recipient`,
     * the corresponding functions will be called with `data` and empty
     * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.
     *
     * Emits a {Sent} event.
     *
     * Requirements
     *
     * - the caller must have at least `amount` tokens.
     * - `recipient` cannot be the zero address.
     * - if `recipient` is a contract, it must implement the {IERC777Recipient}
     * interface.
     */
    function send(
        address recipient,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev Destroys `amount` tokens from the caller's account, reducing the
     * total supply.
     *
     * If a send hook is registered for the caller, the corresponding function
     * will be called with `data` and empty `operatorData`. See {IERC777Sender}.
     *
     * Emits a {Burned} event.
     *
     * Requirements
     *
     * - the caller must have at least `amount` tokens.
     */
    function burn(uint256 amount, bytes calldata data) external;

    /**
     * @dev Returns true if an account is an operator of `tokenHolder`.
     * Operators can send and burn tokens on behalf of their owners. All
     * accounts are their own operator.
     *
     * See {operatorSend} and {operatorBurn}.
     */
    function isOperatorFor(address operator, address tokenHolder) external view returns (bool);

    /**
     * @dev Make an account an operator of the caller.
     *
     * See {isOperatorFor}.
     *
     * Emits an {AuthorizedOperator} event.
     *
     * Requirements
     *
     * - `operator` cannot be calling address.
     */
    function authorizeOperator(address operator) external;

    /**
     * @dev Revoke an account's operator status for the caller.
     *
     * See {isOperatorFor} and {defaultOperators}.
     *
     * Emits a {RevokedOperator} event.
     *
     * Requirements
     *
     * - `operator` cannot be calling address.
     */
    function revokeOperator(address operator) external;

    /**
     * @dev Returns the list of default operators. These accounts are operators
     * for all token holders, even if {authorizeOperator} was never called on
     * them.
     *
     * This list is immutable, but individual holders may revoke these via
     * {revokeOperator}, in which case {isOperatorFor} will return false.
     */
    function defaultOperators() external view returns (address[] memory);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must
     * be an operator of `sender`.
     *
     * If send or receive hooks are registered for `sender` and `recipient`,
     * the corresponding functions will be called with `data` and
     * `operatorData`. See {IERC777Sender} and {IERC777Recipient}.
     *
     * Emits a {Sent} event.
     *
     * Requirements
     *
     * - `sender` cannot be the zero address.
     * - `sender` must have at least `amount` tokens.
     * - the caller must be an operator for `sender`.
     * - `recipient` cannot be the zero address.
     * - if `recipient` is a contract, it must implement the {IERC777Recipient}
     * interface.
     */
    function operatorSend(
        address sender,
        address recipient,
        uint256 amount,
        bytes calldata data,
        bytes calldata operatorData
    ) external;

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the total supply.
     * The caller must be an operator of `account`.
     *
     * If a send hook is registered for `account`, the corresponding function
     * will be called with `data` and `operatorData`. See {IERC777Sender}.
     *
     * Emits a {Burned} event.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     * - the caller must be an operator for `account`.
     */
    function operatorBurn(
        address account,
        uint256 amount,
        bytes calldata data,
        bytes calldata operatorData
    ) external;

    event Sent(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 amount,
        bytes data,
        bytes operatorData
    );

    event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData);

    event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData);

    event AuthorizedOperator(address indexed operator, address indexed tokenHolder);

    event RevokedOperator(address indexed operator, address indexed tokenHolder);
}

File 17 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

File 18 of 23 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * 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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    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://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 19 of 23 : 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);
}

File 20 of 23 : FullMath.sol
// SPDX-License-Identifier: CC-BY-4.0
pragma solidity >=0.8.0;

// taken from https://medium.com/coinmonks/math-in-solidity-part-3-percents-and-proportions-4db014e080b1
// license is CC-BY-4.0
library FullMath {
    function fullMul(uint256 x, uint256 y) internal pure returns (uint256 l, uint256 h) {
        uint256 mm = mulmod(x, y, type(uint256).max);
        l = x * y;
        h = mm - l;
        if (mm < l) h -= 1;
    }

    function fullDiv(
        uint256 l,
        uint256 h,
        uint256 d
    ) private pure returns (uint256) {
        //uint256 pow2 = d & -d;
        uint256 pow2 = d & (~d + 1);

        d /= pow2;
        l /= pow2;
        //l += h * ((-pow2) / pow2 + 1);
        l += h * ((~pow2+1) / pow2 + 1);
        uint256 r = 1;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        r *= 2 - d * r;
        return l * r;
    }

    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 d
    ) internal pure returns (uint256) {
        (uint256 l, uint256 h) = fullMul(x, y);

        uint256 mm = mulmod(x, y, d);
        if (mm > l) h -= 1;
        l -= mm;

        if (h == 0) return l / d;

        require(h < d, 'FullMath: FULLDIV_OVERFLOW');
        return fullDiv(l, h, d);
    }
}

File 21 of 23 : Babylonian.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.8.0;

// computes square roots using the babylonian method
// https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
library Babylonian {
    // credit for this implementation goes to
    // https://github.com/abdk-consulting/abdk-libraries-solidity/blob/master/ABDKMath64x64.sol#L687
    function sqrt(uint256 x) internal pure returns (uint256) {
        if (x == 0) return 0;
        // this block is equivalent to r = uint256(1) << (BitMath.mostSignificantBit(x) / 2);
        // however that code costs significantly more gas
        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) {
            xx >>= 128;
            r <<= 64;
        }
        if (xx >= 0x10000000000000000) {
            xx >>= 64;
            r <<= 32;
        }
        if (xx >= 0x100000000) {
            xx >>= 32;
            r <<= 16;
        }
        if (xx >= 0x10000) {
            xx >>= 16;
            r <<= 8;
        }
        if (xx >= 0x100) {
            xx >>= 8;
            r <<= 4;
        }
        if (xx >= 0x10) {
            xx >>= 4;
            r <<= 2;
        }
        if (xx >= 0x8) {
            r <<= 1;
        }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1; // Seven iterations should be enough
        uint256 r1 = x / r;
        return (r < r1 ? r : r1);
    }
}

File 22 of 23 : BitMath.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;

library BitMath {
    // returns the 0 indexed position of the most significant bit of the input x
    // s.t. x >= 2**msb and x < 2**(msb+1)
    function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
        require(x > 0, 'BitMath::mostSignificantBit: zero');

        if (x >= 0x100000000000000000000000000000000) {
            x >>= 128;
            r += 128;
        }
        if (x >= 0x10000000000000000) {
            x >>= 64;
            r += 64;
        }
        if (x >= 0x100000000) {
            x >>= 32;
            r += 32;
        }
        if (x >= 0x10000) {
            x >>= 16;
            r += 16;
        }
        if (x >= 0x100) {
            x >>= 8;
            r += 8;
        }
        if (x >= 0x10) {
            x >>= 4;
            r += 4;
        }
        if (x >= 0x4) {
            x >>= 2;
            r += 2;
        }
        if (x >= 0x2) r += 1;
    }

    // returns the 0 indexed position of the least significant bit of the input x
    // s.t. (x & 2**lsb) != 0 and (x & (2**(lsb) - 1)) == 0)
    // i.e. the bit at the index is set and the mask of all lower bits is 0
    function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {
        require(x > 0, 'BitMath::leastSignificantBit: zero');

        r = 255;
        if (x & type(uint128).max > 0) {
            r -= 128;
        } else {
            x >>= 128;
        }
        if (x & type(uint64).max > 0) {
            r -= 64;
        } else {
            x >>= 64;
        }
        if (x & type(uint32).max > 0) {
            r -= 32;
        } else {
            x >>= 32;
        }
        if (x & type(uint16).max > 0) {
            r -= 16;
        } else {
            x >>= 16;
        }
        if (x & type(uint8).max > 0) {
            r -= 8;
        } else {
            x >>= 8;
        }
        if (x & 0xf > 0) {
            r -= 4;
        } else {
            x >>= 4;
        }
        if (x & 0x3 > 0) {
            r -= 2;
        } else {
            x >>= 2;
        }
        if (x & 0x1 > 0) r -= 1;
    }
}

File 23 of 23 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"tokenName_","type":"string"},{"internalType":"string","name":"tokenSymbol_","type":"string"},{"internalType":"address","name":"reserveToken_","type":"address"},{"internalType":"uint256","name":"priceDrop_","type":"uint256"},{"internalType":"uint64","name":"lockupIntervalAmount_","type":"uint64"},{"components":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"internalType":"struct TradedToken.PriceNumDen","name":"minClaimPrice_","type":"tuple"},{"internalType":"address","name":"externalToken_","type":"address"},{"components":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"internalType":"struct TradedToken.PriceNumDen","name":"externalTokenExchangePrice_","type":"tuple"},{"internalType":"uint256","name":"buyTaxMax_","type":"uint256"},{"internalType":"uint256","name":"sellTaxMax_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tradedTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"priceAverageData","type":"uint256"}],"name":"AddedLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"tokenHolder","type":"address"}],"name":"AuthorizedOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"tokenHolder","type":"address"}],"name":"RevokedOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"Sent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"amountTradedToken","type":"uint256"},{"internalType":"uint256","name":"amountReserveToken","type":"uint256"}],"name":"addInitialLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tradedTokenAmount","type":"uint256"}],"name":"addLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"manager","type":"address"}],"name":"addManagers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"authorizeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenHolder","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buyTaxMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tradedTokenAmount","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tradedTokenAmount","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"externalTokenAmount","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"claimViaExternal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"defaultOperators","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"externalToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"granularity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"tokenHolder","type":"address"}],"name":"isOperatorFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"operatorBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"operatorSend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceDrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"revokeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sellTaxMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fraction","type":"uint256"}],"name":"setBuyTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"fraction","type":"uint256"}],"name":"setSellTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"tokensReceived","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"userData","type":"bytes"},{"internalType":"bytes","name":"operatorData","type":"bytes"}],"name":"tokensToSend","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalCumulativeClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradedToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b506040516200613738038062006137833981016040819052620000359162000a43565b6040805160008152602081019091528a908a906200005333620006be565b600362000061848262000bbb565b50600462000070838262000bbb565b508051620000869060059060208401906200084f565b5060005b8151811015620000f657600160066000848481518110620000af57620000af62000c87565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580620000ed8162000c9d565b9150506200008a565b506040516329965a1d60e01b815230600482018190527fac7fbab5f54a3ca8194167523c6753bfeb96a445279294b6125b68cce217705460248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b1580156200017157600080fd5b505af115801562000186573d6000803e3d6000fd5b50506040516329965a1d60e01b815230600482018190527faea199e31a596269b42cdafd93407f14436db6e4cad65417994c2eb37381e05a60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad2492506329965a1d9150606401600060405180830381600087803b1580156200020457600080fd5b505af115801562000219573d6000803e3d6000fd5b505050610100869052505050610120829052506001600160a01b038816620002885760405162461bcd60e51b815260206004820152601460248201527f72657365727665546f6b656e20696e76616c696400000000000000000000000060448201526064015b60405180910390fd5b306080526001600160a01b0388811660a05260c0889052601380546001600160401b0319166001600160401b0389161790558551600b55602080870151600c55600d80546001600160a01b031916928716929092179091558351600e5583810151600f5562000300906200070e811b620015b117901c565b601280546001600160a01b039283166001600160a01b031991821617909155601180549390921692169190911790556040516329965a1d60e01b815230600482018190527f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe89560248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b158015620003a957600080fd5b505af1158015620003be573d6000803e3d6000fd5b50506040516329965a1d60e01b815230600482018190527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad2492506329965a1d9150606401600060405180830381600087803b1580156200043c57600080fd5b505af115801562000451573d6000803e3d6000fd5b505060125460805160a0516040516364e329cb60e11b81526001600160a01b03928316600482015290821660248201529116925063c9c6539691506044016020604051808303816000875af1158015620004af573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004d5919062000cc5565b601080546001600160a01b0319166001600160a01b03929092169182179055620005365760405162461bcd60e51b815260206004820152601160248201527031b0b713ba1031b932b0ba32903830b4b960791b60448201526064016200027f565b6200054062000833565b601280546001600160401b0392909216600160a81b02600160a81b600160e81b03199092169190911790556200057562000833565b601880546001600160401b0319166001600160401b039290921691909117905560805160105460408051630dfe168160e01b815290516001600160a01b039384169390921691630dfe1681916004808201926020929091908290030181865afa158015620005e7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200060d919062000cc5565b6001600160a01b0316146200062457600062000627565b60015b151560e05260805160a0516011546040516001600160a01b03909116906200064f90620008b9565b6001600160a01b03938416815291831660208301529091166040820152606001604051809103906000f0801580156200068c573d6000803e3d6000fd5b50601780546001600160a01b0319166001600160a01b03929092169190911790555062000d0d98505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080466001811480620007225750806003145b806200072e5750806004145b806200073b575080610539145b8062000748575080617a69145b15620007805750737a250d5630b4cf539739df2c5dacb4c659f2488d92735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f92509050565b80608903620007bb575073a5e0829caced8ffdd4de3c43696c57f7d7a678ff92735757371414417b8c6caad45baef941abc7d3ab3292509050565b80603803620007f657507310ed43c718714eb63d5aa57b78b54704e256024e9273ca143ce32fe78f1f7019d7d551a6402fc5350c7392509050565b60405162461bcd60e51b81526020600482015260116024820152703ab739bab83837b93a32b21031b430b4b760791b60448201526064016200027f565b60006200084a680100000000000000004262000cea565b905090565b828054828255906000526020600020908101928215620008a7579160200282015b82811115620008a757825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000870565b50620008b5929150620008c7565b5090565b6107118062005a2683390190565b5b80821115620008b55760008155600101620008c8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200091f576200091f620008de565b604052919050565b600082601f8301126200093957600080fd5b81516001600160401b03811115620009555762000955620008de565b60206200096b601f8301601f19168201620008f4565b82815285828487010111156200098057600080fd5b60005b83811015620009a057858101830151828201840152820162000983565b83811115620009b25760008385840101525b5095945050505050565b80516001600160a01b0381168114620009d457600080fd5b919050565b80516001600160401b0381168114620009d457600080fd5b60006040828403121562000a0457600080fd5b604080519081016001600160401b038111828210171562000a295762000a29620008de565b604052825181526020928301519281019290925250919050565b6000806000806000806000806000806101808b8d03121562000a6457600080fd5b8a516001600160401b038082111562000a7c57600080fd5b62000a8a8e838f0162000927565b9b5060208d015191508082111562000aa157600080fd5b5062000ab08d828e0162000927565b99505062000ac160408c01620009bc565b975060608b0151965062000ad860808c01620009d9565b955062000ae98c60a08d01620009f1565b945062000af960e08c01620009bc565b935062000b0b8c6101008d01620009f1565b92506101408b015191506101608b015190509295989b9194979a5092959850565b600181811c9082168062000b4157607f821691505b60208210810362000b6257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000bb657600081815260208120601f850160051c8101602086101562000b915750805b601f850160051c820191505b8181101562000bb25782815560010162000b9d565b5050505b505050565b81516001600160401b0381111562000bd75762000bd7620008de565b62000bef8162000be8845462000b2c565b8462000b68565b602080601f83116001811462000c27576000841562000c0e5750858301515b600019600386901b1c1916600185901b17855562000bb2565b600085815260208120601f198616915b8281101562000c585788860151825594840194600190910190840162000c37565b508582101562000c775787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b60006001820162000cbe57634e487b7160e01b600052601160045260246000fd5b5060010190565b60006020828403121562000cd857600080fd5b62000ce382620009bc565b9392505050565b60008262000d0857634e487b7160e01b600052601260045260246000fd5b500690565b60805160a05160c05160e0516101005161012051614c8a62000d9c600039600081816102cc0152610b3601526000818161033e015261112c01526000612f700152600081816104a7015281816108e10152611f1d01526000818161057a01528181610d8701528181610f04015261249d0152600081816104e101528181610e6b015261247b0152614c8a6000f3fe608060405234801561001057600080fd5b50600436106102525760003560e01c80638da5cb5b11610146578063d95b6371116100c3578063f2fde38b11610087578063f2fde38b14610562578063f4325d6714610575578063f54e59691461059c578063fad8b32a146105af578063fc673c4f146105c2578063fe9d9303146105d557600080fd5b8063d95b6371146104c9578063db0b27fd146104dc578063dc1052e214610503578063dd62ed3e14610516578063ddd5e1b21461054f57600080fd5b8063a40f4fa11161010a578063a40f4fa114610460578063a9059cbb14610473578063c9828ae014610486578063cc1776d314610499578063d7568b6e146104a257600080fd5b80638da5cb5b14610418578063959b8c3f1461042957806395d89b411461043c5780639bd9bbc6146104445780639d7b8d741461045757600080fd5b806349bd5a5e116101d45780636b44efd3116101985780636b44efd3146103c157806370a08231146103d4578063715018a6146103fd57806375ab9782146102575780638cd09d501461040557600080fd5b806349bd5a5e146103605780634f7041a51461038b57806351c6590a14610394578063556f0dc7146103a757806362ad1b83146103ae57600080fd5b806318160ddd1161021b57806318160ddd146102fc57806323b872dd14610304578063313ce56714610317578063379607f514610326578063486893a51461033957600080fd5b806223de291461025757806306e485381461027157806306fdde031461028f578063095ea7b3146102a45780630b224601146102c7575b600080fd5b61026f610265366004614207565b5050505050505050565b005b6102796105e8565b60405161028691906142fb565b60405180910390f35b61029761064a565b604051610286919061435b565b6102b76102b236600461436e565b6106d3565b6040519015158152602001610286565b6102ee7f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610286565b6002546102ee565b6102b761031236600461439a565b6106ed565b60405160128152602001610286565b61026f6103343660046143db565b610778565b6102ee7f000000000000000000000000000000000000000000000000000000000000000081565b601054610373906001600160a01b031681565b6040516001600160a01b039091168152602001610286565b6102ee60145481565b61026f6103a23660046143db565b6107e3565b60016102ee565b61026f6103bc3660046144a9565b610a0a565b61026f6103cf36600461453b565b610a46565b6102ee6103e236600461453b565b6001600160a01b031660009081526001602052604090205490565b61026f610ad4565b61026f6104133660046143db565b610b0a565b6000546001600160a01b0316610373565b61026f61043736600461453b565b610b9c565b610297610cb9565b61026f610452366004614558565b610cc8565b6102ee60165481565b61026f61046e3660046145b0565b610ceb565b6102b761048136600461436e565b610fe0565b600d54610373906001600160a01b031681565b6102ee60155481565b6102ee7f000000000000000000000000000000000000000000000000000000000000000081565b6102b76104d73660046145d2565b61105f565b6103737f000000000000000000000000000000000000000000000000000000000000000081565b61026f6105113660046143db565b611100565b6102ee6105243660046145d2565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b61026f61055d36600461460b565b611192565b61026f61057036600461453b565b6111f5565b6103737f000000000000000000000000000000000000000000000000000000000000000081565b61026f6105aa36600461460b565b61128d565b61026f6105bd36600461453b565b611443565b61026f6105d0366004614630565b61155e565b61026f6105e33660046146af565b611596565b6060600580548060200260200160405190810160405280929190818152602001828054801561064057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610622575b5050505050905090565b606060038054610659906146eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610685906146eb565b80156106405780601f106106a757610100808354040283529160200191610640565b820191906000526020600020905b8154815290600101906020018083116106b557509395945050505050565b6000336106e18185856116ce565b60019150505b92915050565b6010546000906001600160a01b038085169116036107635760155460009061271090610719908561473b565b6107239190614770565b90508015610761576107358184614784565b9250610761858260405180602001604052806000815250604051806020016040528060008152506117f5565b505b61076e8484846119b7565b90505b9392505050565b6000546001600160a01b03163314806107a85750336000908152601c60205260409020546001600160401b031615155b6107cd5760405162461bcd60e51b81526004016107c49061479b565b60405180910390fd5b6107d681611b77565b6107e08133611d89565b50565b6000546001600160a01b03163314806108135750336000908152601c60205260409020546001600160401b031615155b61082f5760405162461bcd60e51b81526004016107c49061479b565b610837611e21565b60008060008060008060008061085860408051602081019091526000815290565b610860611ea7565b919a50985096506000888a108015610881575061087d8a8a614784565b8b11155b1561088e57506000610892565b5060015b80151560000361096f578a6000036108b1576108ae8a8a614784565b9a505b6108ba8b611fc5565b939a509198509650945092506109306108d660016127106120ea565b61092a61090d6109087f0000000000000000000000000000000000000000000000000000000000000000612710614784565b61221d565b60408051602081019091526001600160e01b038d1681529061224f565b9061224f565b80519092506001600160e01b031661095c878661094d898c6147c2565b61095791906147c2565b6120ea565b516001600160e01b03161161096f575060015b80156109b25760405162461bcd60e51b815260206004820152601260248201527150524943455f44524f505f544f4f5f42494760701b60448201526064016107c4565b6109bc8585612448565b604080518c8152602081018a90527fe74b04c1435e286c6b8eba73f0f16a0a2fcc9d21d879598ecacf17db8c497701910160405180910390a16109fd612552565b5050505050505050505050565b610a14338661105f565b610a305760405162461bcd60e51b81526004016107c4906147da565b610a3f858585858560016126e1565b5050505050565b6000546001600160a01b0316331480610a765750336000908152601c60205260409020546001600160401b031615155b610a925760405162461bcd60e51b81526004016107c49061479b565b610a9a6127cd565b6001600160a01b03919091166000908152601c60205260409020805467ffffffffffffffff19166001600160401b03909216919091179055565b6000546001600160a01b03163314610afe5760405162461bcd60e51b81526004016107c490614826565b610b0860006127e2565b565b6000546001600160a01b03163314610b345760405162461bcd60e51b81526004016107c490614826565b7f0000000000000000000000000000000000000000000000000000000000000000811115610b975760405162461bcd60e51b815260206004820152601060248201526f11949050d51253d397d253959053125160821b60448201526064016107c4565b601555565b6001600160a01b0381163303610c005760405162461bcd60e51b8152602060048201526024808201527f4552433737373a20617574686f72697a696e672073656c66206173206f70657260448201526330ba37b960e11b60648201526084016107c4565b6001600160a01b03811660009081526006602052604090205460ff1615610c51573360009081526008602090815260408083206001600160a01b03851684529091529020805460ff19169055610c80565b3360009081526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790555b60405133906001600160a01b038316907ff4caeb2d6ca8932a215a353d0703c326ec2d81fc68170f320eb2ab49e9df61f990600090a350565b606060048054610659906146eb565b610ce6338484846040518060200160405280600081525060016126e1565b505050565b6000546001600160a01b03163314610d155760405162461bcd60e51b81526004016107c490614826565b600a54600160ff90911610610d5d5760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e4818d85b1b195960921b60448201526064016107c4565b600a805460ff191660011790556040516370a0823160e01b81523060048201526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df2919061485b565b811115610e385760405162461bcd60e51b8152602060048201526014602482015273494e53554646494349454e545f5245534552564560601b60448201526064016107c4565b610e428230611d89565b60175460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610eb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eda9190614874565b5060175460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018390527f00000000000000000000000000000000000000000000000000000000000000009091169063a9059cbb906044016020604051808303816000875af1158015610f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f739190614874565b50601760009054906101000a90046001600160a01b03166001600160a01b031663e8078d946040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fc457600080fd5b505af1158015610fd8573d6000803e3d6000fd5b505050505050565b601054600090336001600160a01b0390911603611055576014546000906127109061100b908561473b565b6110159190614770565b90508015611053576110278184614784565b9250611053338260405180602001604052806000815250604051806020016040528060008152506117f5565b505b6107718383612832565b6000816001600160a01b0316836001600160a01b031614806110ca57506001600160a01b03831660009081526006602052604090205460ff1680156110ca57506001600160a01b0380831660009081526008602090815260408083209387168352929052205460ff16155b806107715750506001600160a01b0390811660009081526007602090815260408083209490931682529290925290205460ff1690565b6000546001600160a01b0316331461112a5760405162461bcd60e51b81526004016107c490614826565b7f000000000000000000000000000000000000000000000000000000000000000081111561118d5760405162461bcd60e51b815260206004820152601060248201526f11949050d51253d397d253959053125160821b60448201526064016107c4565b601455565b6000546001600160a01b03163314806111c25750336000908152601c60205260409020546001600160401b031615155b6111de5760405162461bcd60e51b81526004016107c49061479b565b6111e782611b77565b6111f18282611d89565b5050565b6000546001600160a01b0316331461121f5760405162461bcd60e51b81526004016107c490614826565b6001600160a01b0381166112845760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107c4565b6107e0816127e2565b600d546001600160a01b03166112db5760405162461bcd60e51b815260206004820152601360248201527222a6a82a2cafa2ac2a22a92720a62a27a5a2a760691b60448201526064016107c4565b600d54604051636eb1769f60e11b81523360048201523060248201526001600160a01b039091169063dd62ed3e90604401602060405180830381865afa158015611329573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134d919061485b565b8211156113925760405162461bcd60e51b8152602060048201526013602482015272125394d551919250d251539517d05353d55395606a1b60448201526064016107c4565b600d546040516323b872dd60e01b815233600482015261dead6024820152604481018490526001600160a01b03909116906323b872dd906064016020604051808303816000875af11580156113eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061140f9190614874565b50600f54600e5460009190611424908561473b565b61142e9190614770565b905061143981611b77565b610ce68183611d89565b336001600160a01b038216036114a55760405162461bcd60e51b815260206004820152602160248201527f4552433737373a207265766f6b696e672073656c66206173206f70657261746f6044820152603960f91b60648201526084016107c4565b6001600160a01b03811660009081526006602052604090205460ff16156114f9573360009081526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611525565b3360009081526007602090815260408083206001600160a01b03851684529091529020805460ff191690555b60405133906001600160a01b038316907f50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa190600090a350565b611568338561105f565b6115845760405162461bcd60e51b81526004016107c4906147da565b611590848484846117f5565b50505050565b6111f1338383604051806020016040528060008152506117f5565b6000804660018114806115c45750806003145b806115cf5750806004145b806115db575080610539145b806115e7575080617a69145b1561161e5750737a250d5630b4cf539739df2c5dacb4c659f2488d92735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f92509050565b80608903611658575073a5e0829caced8ffdd4de3c43696c57f7d7a678ff92735757371414417b8c6caad45baef941abc7d3ab3292509050565b8060380361169257507310ed43c718714eb63d5aa57b78b54704e256024e9273ca143ce32fe78f1f7019d7d551a6402fc5350c7392509050565b60405162461bcd60e51b81526020600482015260116024820152703ab739bab83837b93a32b21031b430b4b760791b60448201526064016107c4565b6001600160a01b0383166117325760405162461bcd60e51b815260206004820152602560248201527f4552433737373a20617070726f76652066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107c4565b6001600160a01b0382166117945760405162461bcd60e51b815260206004820152602360248201527f4552433737373a20617070726f766520746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107c4565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0384166118565760405162461bcd60e51b815260206004820152602260248201527f4552433737373a206275726e2066726f6d20746865207a65726f206164647265604482015261737360f01b60648201526084016107c4565b33611866818660008787876128e5565b61187381866000876129ff565b6001600160a01b038516600090815260016020526040902054848110156118e85760405162461bcd60e51b815260206004820152602360248201527f4552433737373a206275726e20616d6f756e7420657863656564732062616c616044820152626e636560e81b60648201526084016107c4565b6001600160a01b0386166000908152600160205260408120868303905560028054879290611917908490614784565b92505081905550856001600160a01b0316826001600160a01b03167fa78a9be3a7b862d26933ad85fb11d80ef66b8f972d7cbba06621d583943a409887878760405161196593929190614896565b60405180910390a36040518581526000906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a3505050505050565b60006001600160a01b0383166119df5760405162461bcd60e51b81526004016107c4906148c1565b6001600160a01b038416611a445760405162461bcd60e51b815260206004820152602660248201527f4552433737373a207472616e736665722066726f6d20746865207a65726f206160448201526564647265737360d01b60648201526084016107c4565b6000339050611a758186868660405180602001604052806000815250604051806020016040528060008152506128e5565b611aa1818686866040518060200160405280600081525060405180602001604052806000815250612ab3565b6001600160a01b0380861660009081526009602090815260408083209385168352929052205483811015611b295760405162461bcd60e51b815260206004820152602960248201527f4552433737373a207472616e7366657220616d6f756e74206578636565647320604482015268616c6c6f77616e636560b81b60648201526084016107c4565b611b3d8683611b388785614784565b6116ce565b611b6b8287878760405180602001604052806000815250604051806020016040528060008152506000612c25565b50600195945050505050565b600080601060009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015611bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf1919061491c565b5091509150600083601654611c0691906147c2565b601154604051630153543560e21b8152600481018390526001600160701b038087166024830152851660448201529192506000916001600160a01b039091169063054d50d490606401602060405180830381865afa158015611c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c90919061485b565b905060008111611cdb5760405162461bcd60e51b815260206004820152601660248201527521a620a4a6afab20a624a220aa24a7a72fa2a92927a960511b60448201526064016107c4565b600b54600c54611ceb91906120ea565b516001600160e01b0316611d1e611d0b836001600160701b038716614784565b610957856001600160701b0389166147c2565b516001600160e01b031611610a3f5760405162461bcd60e51b815260206004820152602b60248201527f50524943455f4841535f4245434f4d455f415f4c4f5745525f5448414e5f4d4960448201526a4e434c41494d505249434560a81b60648201526084016107c4565b8160166000828254611d9b91906147c2565b92505081905550611dcc81836040518060200160405280600081525060405180602001604052806000815250612de0565b6000546001600160a01b03163314801590611de75750333014155b156111f1576013546001600160a01b0382166000908152601b60205260409020610ce69184906001600160401b0316620151806001612dee565b601254600160a01b900460ff161515600003610b08576012805460ff60a01b1916600160a01b1790556010546040805160016209351760e01b0319815290516001600160a01b039092169163fff6cae99160048082019260009290919082900301818387803b158015611e9357600080fd5b505af1158015611590573d6000803e3d6000fd5b600080600080600080611eb8612e89565b919450925090506000611ec9612fab565b90506000611ee2610908866001600160701b031661313d565b90506000611efb610908866001600160701b031661313d565b90506000611f50611f4b611f1260016127106120ea565b61092a611f446109087f0000000000000000000000000000000000000000000000000000000000000000612710614784565b889061224f565b6132b6565b90506000611f99611f89611f6e84611f68600161221d565b906133a8565b61092a611f7f61090861271061313d565b61092a898961224f565b5160701c6001600160701b031690565b94516001600160701b039889169c959098169a50506001600160e01b0390961697509195505050505050565b6000806000806000611fd5612e89565b506001600160701b0391821696501693508461200481611ff589826147c2565b611fff919061473b565b61313d565b61200e9190614784565b925060008311801561201f57508286115b6120585760405162461bcd60e51b815260206004820152600a60248201526910905117d05353d5539560b21b60448201526064016107c4565b601154604051630153543560e21b81526004810185905260248101879052604481018690526001600160a01b039091169063054d50d490606401602060405180830381865afa1580156120af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d3919061485b565b90506120df8387614784565b915091939590929450565b604080516020810190915260008152600082116121585760405162461bcd60e51b815260206004820152602660248201527f4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206260448201526579207a65726f60d01b60648201526084016107c4565b8260000361217557506040805160208101909152600081526106e7565b6001600160901b03831161220c57600061219383607086901b614770565b90506001600160e01b038111156121ec5760405162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f77000060448201526064016107c4565b6040518060200160405280826001600160e01b03168152509150506106e7565b600061219384600160701b8561358e565b60408051602081019091526000815250604080516020810190915260709190911b600160701b600160e01b0316815290565b60408051602081019091526000815282516001600160e01b0316158061227d575081516001600160e01b0316155b1561229757506040805160208101909152600081526106e7565b825182516001600160701b03607083811c8216938216929081901c8216911660006122c2838661496c565b905060006122dc6001600160701b0380851690871661496c565b905060006122f66001600160701b0380861690891661496c565b905060006123106001600160701b0380891690881661496c565b90506001600160701b036001600160e01b038516111561237c5760405162461bcd60e51b815260206004820152602160248201527f4669786564506f696e743a3a6d756c75713a207570706572206f766572666c6f6044820152607760f81b60648201526084016107c4565b6000607084811c6001600160701b0316906001600160e01b03848116916123b49187169089901b600160701b600160e01b03166147c2565b6123be91906147c2565b6123c891906147c2565b90506001600160e01b038111156124215760405162461bcd60e51b815260206004820152601f60248201527f4669786564506f696e743a3a6d756c75713a2073756d206f766572666c6f770060448201526064016107c4565b60408051602081019091526001600160e01b0390911681529b9a5050505050505050505050565b61247230836040518060200160405280600081525060405180602001604052806000815250612de0565b6017546124cd907f0000000000000000000000000000000000000000000000000000000000000000907f00000000000000000000000000000000000000000000000000000000000000009085906001600160a01b0316613659565b50601754604080516020808201835260008083528351918201909352918252612502926001600160a01b031691849190612de0565b601760009054906101000a90046001600160a01b03166001600160a01b031663e8078d946040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610fc457600080fd5b600061255c6127cd565b601854909150600090612578906001600160401b03168361499b565b905060006127106005601260159054906101000a90046001600160401b0316856125a2919061499b565b6125ac91906149c3565b6125b691906149e9565b9050806001600160401b0316826001600160401b03161180156125e257506000826001600160401b0316115b15610ce65760105460408051635909c0d560e01b815290516000926001600160a01b031691635909c0d59160048083019260209291908290030181865afa158015612631573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612655919061485b565b905061269961266c846001600160401b031661221d565b6040518060200160405280601860010154856126889190614784565b6001600160e01b03169052906133a8565b51601a80546001600160e01b039092166001600160e01b0319909216919091179055601955601880546001600160401b03851667ffffffffffffffff19909116179055505050565b6001600160a01b0386166127425760405162461bcd60e51b815260206004820152602260248201527f4552433737373a2073656e642066726f6d20746865207a65726f206164647265604482015261737360f01b60648201526084016107c4565b6001600160a01b0385166127985760405162461bcd60e51b815260206004820181905260248201527f4552433737373a2073656e6420746f20746865207a65726f206164647265737360448201526064016107c4565b336127a78188888888886128e5565b6127b5818888888888612ab3565b6127c481888888888888612c25565b50505050505050565b60006127dd600160401b42614a0f565b905090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001600160a01b03831661285a5760405162461bcd60e51b81526004016107c4906148c1565b600033905061288b8182868660405180602001604052806000815250604051806020016040528060008152506128e5565b6128b7818286866040518060200160405280600081525060405180602001604052806000815250612ab3565b6106e18182868660405180602001604052806000815250604051806020016040528060008152506000612c25565b60405163555ddc6560e11b81526001600160a01b03861660048201527f29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe8956024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015612966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298a9190614a23565b90506001600160a01b038116156127c457604051633ad5cbc160e11b81526001600160a01b038216906375ab9782906129d1908a908a908a908a908a908a90600401614a40565b600060405180830381600087803b1580156129eb57600080fd5b505af11580156109fd573d6000803e3d6000fd5b6001600160a01b0383161580612a2f57506001600160a01b03831630148015612a2f57506001600160a01b038216155b611590576001600160a01b038316600090815260016020908152604080832054601b9092528220909190612a6290613832565b905082612a6f8284614784565b1015610fd85760405162461bcd60e51b8152602060048201526013602482015272125394d551919250d251539517d05353d55395606a1b60448201526064016107c4565b612abf868686866129ff565b6001600160a01b03851660009081526001602052604090205483811015612b385760405162461bcd60e51b815260206004820152602760248201527f4552433737373a207472616e7366657220616d6f756e7420657863656564732060448201526662616c616e636560c81b60648201526084016107c4565b6001600160a01b03808716600090815260016020526040808220878503905591871681529081208054869290612b6f9084906147c2565b92505081905550846001600160a01b0316866001600160a01b0316886001600160a01b03167f06b541ddaa720db2b10a4d0cdac39b8d360425fc073085fac19bc82614677987878787604051612bc793929190614896565b60405180910390a4846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051612c1491815260200190565b60405180910390a350505050505050565b60405163555ddc6560e11b81526001600160a01b03861660048201527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b6024820152600090731820a4b7618bde71dce8cdc73aab6c95905fad249063aabbb8ca90604401602060405180830381865afa158015612ca6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cca9190614a23565b90506001600160a01b03811615612d46576040516223de2960e01b81526001600160a01b038216906223de2990612d0f908b908b908b908b908b908b90600401614a40565b600060405180830381600087803b158015612d2957600080fd5b505af1158015612d3d573d6000803e3d6000fd5b50505050610265565b8115610265576001600160a01b0386163b156102655760405162461bcd60e51b815260206004820152604d60248201527f4552433737373a20746f6b656e20726563697069656e7420636f6e747261637460448201527f20686173206e6f20696d706c656d656e74657220666f7220455243373737546f60648201526c1ad95b9cd49958da5c1a595b9d609a1b608482015260a4016107c4565b6115908484848460016138fd565b600080612dfb4285613a43565b90506000612e126001600160401b0386168761473b565b612e1c90836147c2565b9050818111612e615760405162461bcd60e51b81526020600482015260116024820152701512535154d510535417d2539590531251607a1b60448201526064016107c4565b612e6d88866000613a63565b50612e7b8883838a88613afd565b506001979650505050505050565b600080600080600080601060009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015612ee5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f09919061491c565b925092509250826001600160701b0316600014158015612f3157506001600160701b03821615155b612f6e5760405162461bcd60e51b815260206004820152600e60248201526d52455345525645535f454d50545960901b60448201526064016107c4565b7f000000000000000000000000000000000000000000000000000000000000000015612fa05791959094509092509050565b909591945092509050565b6040805160208101909152600081526000612fc46127cd565b90506000601060009054906101000a90046001600160a01b03166001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa15801561301b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303f919061485b565b60185490915060009061305b906001600160401b03168461499b565b905060006127106005601260159054906101000a90046001600160401b031686613085919061499b565b61308f91906149c3565b61309991906149e9565b9050806001600160401b0316826001600160401b03161180156130c557506000826001600160401b0316115b80156130d2575060195483115b1561311b576040518060200160405280836001600160401b0316601860010154866130fd9190614784565b6131079190614a9a565b6001600160e01b0316905295945050505050565b50506040805160208101909152601a546001600160e01b031681529392505050565b60008160000361314f57506000919050565b50600181600160801b81106131695760409190911b9060801c5b600160401b811061317f5760209190911b9060401c5b64010000000081106131965760109190911b9060201c5b6201000081106131ab5760089190911b9060101c5b61010081106131bf5760049190911b9060081c5b601081106131d25760029190911b9060041c5b600881106131e257600182901b91505b60018284816131f3576131f361475a565b048301901c9150600182848161320b5761320b61475a565b048301901c915060018284816132235761322361475a565b048301901c9150600182848161323b5761323b61475a565b048301901c915060018284816132535761325361475a565b048301901c9150600182848161326b5761326b61475a565b048301901c915060018284816132835761328361475a565b048301901c9150600082848161329b5761329b61475a565b049050808310156132ac57826132ae565b805b949350505050565b60408051602081019091526000815281516001600160901b036001600160e01b0390911611613315576040518060200160405280613304607085600001516001600160e01b0316901b613b91565b6001600160e01b0316905292915050565b600061332d83600001516001600160e01b0316613d0d565b6133389060ff614ab4565b9050613345600282614ad7565b61334f9082614ab4565b90506040518060200160405280600283607061336b9190614ab4565b6133759190614af9565b60ff166133948460ff1687600001516001600160e01b0316901b613b91565b6001600160e01b03911b1690529392505050565b60408051602081019091526000815281516001600160e01b031661341a5760405162461bcd60e51b815260206004820152602360248201527f4669786564506f696e743a3a64697675713a206469766973696f6e206279207a60448201526265726f60e81b60648201526084016107c4565b815183516001600160e01b0391821691160361344857506040805160208101909152600160701b81526106e7565b82516001600160901b036001600160e01b03909116116134eb5781518351600091613492916001600160e01b039091169060701b6dffffffffffffffffffffffffffff1916614770565b90506001600160e01b038111156121ec5760405162461bcd60e51b815260206004820152601b60248201527f4669786564506f696e743a3a64697675713a206f766572666c6f77000000000060448201526064016107c4565b6000613516600160701b85600001516001600160e01b031685600001516001600160e01b031661358e565b90506001600160e01b0381111561356f5760405162461bcd60e51b815260206004820152601b60248201527f4669786564506f696e743a3a64697675713a206f766572666c6f77000000000060448201526064016107c4565b60408051602081019091526001600160e01b0390911681529392505050565b600080600061359d8686613e4d565b91509150600084806135b1576135b161475a565b8688099050828111156135cc576135c9600183614784565b91505b6135d68184614784565b9250816000036135f4576135ea8584614770565b9350505050610771565b8482106136435760405162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a2046554c4c4449565f4f564552464c4f5700000000000060448201526064016107c4565b61364e838387613e8f565b979650505050505050565b60115460405163095ea7b360e01b81526001600160a01b0391821660048201526024810184905260009186169063095ea7b3906044016020604051808303816000875af11580156136ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136d29190614874565b61370f5760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b60448201526064016107c4565b604080516002808252606082018352600092602083019080368337019050509050858160008151811061374457613744614b1b565b60200260200101906001600160a01b031690816001600160a01b031681525050848160018151811061377857613778614b1b565b6001600160a01b0392831660209182029290920101526011546040516338ed173960e01b815260009291909116906338ed1739906137c2908890859087908a904290600401614b31565b6000604051808303816000875af11580156137e1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526138099190810190614b6d565b90508060018151811061381e5761381e614b1b565b602002602001015192505050949350505050565b60008080805b61384185614010565b8110156138f557613852858261401a565b92508242116138e3576138654284614784565b6000848152600287016020526040902054613880919061473b565b600084815260028088016020526040909120908101546001909101549193509083106138c95760008481526002870160205260409020600101546138c49084614784565b6138cc565b60005b6138d690866147c2565b6138e091906147c2565b93505b806138ed81614c12565b915050613838565b505050919050565b6001600160a01b0385166139535760405162461bcd60e51b815260206004820181905260248201527f4552433737373a206d696e7420746f20746865207a65726f206164647265737360448201526064016107c4565b3361396181600088886129ff565b846002600082825461397391906147c2565b90915550506001600160a01b038616600090815260016020526040812080548792906139a09084906147c2565b909155506139b690508160008888888888612c25565b856001600160a01b0316816001600160a01b03167f2fe5be0146f74c5bce36c0b80911af6c7d86ff27e89d5cfa61fc681327954e5d8787876040516139fd93929190614896565b60405180910390a36040518581526001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016119a7565b60006001600160401b038216613a598185614770565b610771919061473b565b60008080613a7086614010565b90508015611b6b57805b8015613af057613a95613a8e600183614784565b889061401a565b925060018515151480613ab0575082613aae4288613a43565b115b15613ade576000838152600280890160205260408220828155600181018390550155613adc8784614026565b505b80613ae881614c2b565b915050613a7a565b5060019695505050505050565b613b078584614032565b50801515600103613b5757613b1c8484614784565b613b269083614770565b6000848152600287016020526040902054613b4191906147c2565b6000848152600287016020526040902055610a3f565b6000838152600280870160205260409091200154613b769083906147c2565b60008481526002808801602052604090912001555050505050565b600081600003613ba357506000919050565b816001600160801b8210613bbc5760809190911c9060401b5b600160401b8210613bd25760409190911c9060201b5b6401000000008210613be95760209190911c9060101b5b620100008210613bfe5760109190911c9060081b5b6101008210613c125760089190911c9060041b5b60108210613c255760049190911c9060021b5b60088210613c315760011b5b6001613c3d8286614770565b613c4790836147c2565b901c90506001613c578286614770565b613c6190836147c2565b901c90506001613c718286614770565b613c7b90836147c2565b901c90506001613c8b8286614770565b613c9590836147c2565b901c90506001613ca58286614770565b613caf90836147c2565b901c90506001613cbf8286614770565b613cc990836147c2565b901c90506001613cd98286614770565b613ce390836147c2565b901c90506000613cf38286614770565b9050808210613d025780613d04565b815b95945050505050565b6000808211613d685760405162461bcd60e51b815260206004820152602160248201527f4269744d6174683a3a6d6f73745369676e69666963616e744269743a207a65726044820152606f60f81b60648201526084016107c4565b600160801b8210613d8657608091821c91613d839082614c42565b90505b600160401b8210613da457604091821c91613da19082614c42565b90505b6401000000008210613dc357602091821c91613dc09082614c42565b90505b620100008210613de057601091821c91613ddd9082614c42565b90505b6101008210613dfc57600891821c91613df99082614c42565b90505b60108210613e1757600491821c91613e149082614c42565b90505b60048210613e3257600291821c91613e2f9082614c42565b90505b60028210613e4857613e45600182614c42565b90505b919050565b600080806000198486099050613e63848661473b565b9250613e6f8382614784565b915082811015613e8757613e84600183614784565b91505b509250929050565b600080613e9e831960016147c2565b83169050613eac8184614770565b9250613eb88186614770565b945080613ec7811960016147c2565b613ed19190614770565b613edc9060016147c2565b613ee6908561473b565b613ef090866147c2565b94506001613efe818561473b565b613f09906002614784565b613f13908261473b565b9050613f1f818561473b565b613f2a906002614784565b613f34908261473b565b9050613f40818561473b565b613f4b906002614784565b613f55908261473b565b9050613f61818561473b565b613f6c906002614784565b613f76908261473b565b9050613f82818561473b565b613f8d906002614784565b613f97908261473b565b9050613fa3818561473b565b613fae906002614784565b613fb8908261473b565b9050613fc4818561473b565b613fcf906002614784565b613fd9908261473b565b9050613fe5818561473b565b613ff0906002614784565b613ffa908261473b565b9050614006818761473b565b9695505050505050565b6000613e45825490565b6000610771838361403e565b60006107718383614068565b6000610771838361415b565b600082600001828154811061405557614055614b1b565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561415157600061408c600183614784565b85549091506000906140a090600190614784565b90508181146141055760008660000182815481106140c0576140c0614b1b565b90600052602060002001549050808760000184815481106140e3576140e3614b1b565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061411657614116614c67565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106e7565b60009150506106e7565b60008181526001830160205260408120546141a2575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106e7565b5060006106e7565b6001600160a01b03811681146107e057600080fd5b60008083601f8401126141d157600080fd5b5081356001600160401b038111156141e857600080fd5b60208301915083602082850101111561420057600080fd5b9250929050565b60008060008060008060008060c0898b03121561422357600080fd5b883561422e816141aa565b9750602089013561423e816141aa565b9650604089013561424e816141aa565b95506060890135945060808901356001600160401b038082111561427157600080fd5b61427d8c838d016141bf565b909650945060a08b013591508082111561429657600080fd5b506142a38b828c016141bf565b999c989b5096995094979396929594505050565b600081518084526020808501945080840160005b838110156142f05781516001600160a01b0316875295820195908201906001016142cb565b509495945050505050565b60208152600061077160208301846142b7565b6000815180845260005b8181101561433457602081850181015186830182015201614318565b81811115614346576000602083870101525b50601f01601f19169290920160200192915050565b602081526000610771602083018461430e565b6000806040838503121561438157600080fd5b823561438c816141aa565b946020939093013593505050565b6000806000606084860312156143af57600080fd5b83356143ba816141aa565b925060208401356143ca816141aa565b929592945050506040919091013590565b6000602082840312156143ed57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614432576144326143f4565b604052919050565b600082601f83011261444b57600080fd5b81356001600160401b03811115614464576144646143f4565b614477601f8201601f191660200161440a565b81815284602083860101111561448c57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156144c157600080fd5b85356144cc816141aa565b945060208601356144dc816141aa565b93506040860135925060608601356001600160401b03808211156144ff57600080fd5b61450b89838a0161443a565b9350608088013591508082111561452157600080fd5b5061452e8882890161443a565b9150509295509295909350565b60006020828403121561454d57600080fd5b8135610771816141aa565b60008060006060848603121561456d57600080fd5b8335614578816141aa565b92506020840135915060408401356001600160401b0381111561459a57600080fd5b6145a68682870161443a565b9150509250925092565b600080604083850312156145c357600080fd5b50508035926020909101359150565b600080604083850312156145e557600080fd5b82356145f0816141aa565b91506020830135614600816141aa565b809150509250929050565b6000806040838503121561461e57600080fd5b823591506020830135614600816141aa565b6000806000806080858703121561464657600080fd5b8435614651816141aa565b93506020850135925060408501356001600160401b038082111561467457600080fd5b6146808883890161443a565b9350606087013591508082111561469657600080fd5b506146a38782880161443a565b91505092959194509250565b600080604083850312156146c257600080fd5b8235915060208301356001600160401b038111156146df57600080fd5b613e848582860161443a565b600181811c908216806146ff57607f821691505b60208210810361471f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561475557614755614725565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261477f5761477f61475a565b500490565b60008282101561479657614796614725565b500390565b6020808252600d908201526c4d414e41474552535f4f4e4c5960981b604082015260600190565b600082198211156147d5576147d5614725565b500190565b6020808252602c908201527f4552433737373a2063616c6c6572206973206e6f7420616e206f70657261746f60408201526b39103337b9103437b63232b960a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561486d57600080fd5b5051919050565b60006020828403121561488657600080fd5b8151801515811461077157600080fd5b8381526060602082015260006148af606083018561430e565b8281036040840152614006818561430e565b60208082526024908201527f4552433737373a207472616e7366657220746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b80516001600160701b0381168114613e4857600080fd5b60008060006060848603121561493157600080fd5b61493a84614905565b925061494860208501614905565b9150604084015163ffffffff8116811461496157600080fd5b809150509250925092565b60006001600160e01b038281168482168115158284048211161561499257614992614725565b02949350505050565b60006001600160401b03838116908316818110156149bb576149bb614725565b039392505050565b60006001600160401b038083168185168183048111821515161561499257614992614725565b60006001600160401b0380841680614a0357614a0361475a565b92169190910492915050565b600082614a1e57614a1e61475a565b500690565b600060208284031215614a3557600080fd5b8151610771816141aa565b6001600160a01b0387811682528681166020830152851660408201526060810184905260c060808201819052600090614a7b9083018561430e565b82810360a0840152614a8d818561430e565b9998505050505050505050565b60006001600160e01b0383811680614a0357614a0361475a565b600060ff821660ff841680821015614ace57614ace614725565b90039392505050565b600060ff831680614aea57614aea61475a565b8060ff84160691505092915050565b600060ff831680614b0c57614b0c61475a565b8060ff84160491505092915050565b634e487b7160e01b600052603260045260246000fd5b85815284602082015260a060408201526000614b5060a08301866142b7565b6001600160a01b0394909416606083015250608001529392505050565b60006020808385031215614b8057600080fd5b82516001600160401b0380821115614b9757600080fd5b818501915085601f830112614bab57600080fd5b815181811115614bbd57614bbd6143f4565b8060051b9150614bce84830161440a565b8181529183018401918481019088841115614be857600080fd5b938501935b83851015614c0657845182529385019390850190614bed565b98975050505050505050565b600060018201614c2457614c24614725565b5060010190565b600081614c3a57614c3a614725565b506000190190565b600060ff821660ff84168060ff03821115614c5f57614c5f614725565b019392505050565b634e487b7160e01b600052603160045260246000fdfea164736f6c634300080f000a60e060405234801561001057600080fd5b5060405161071138038061071183398101604081905261002f916100fd565b6001600160a01b0383811660805282811660a052811660c0526040516329965a1d60e01b815230600482018190527fb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b60248301526044820152731820a4b7618bde71dce8cdc73aab6c95905fad24906329965a1d90606401600060405180830381600087803b1580156100c157600080fd5b505af11580156100d5573d6000803e3d6000fd5b50505050505050610140565b80516001600160a01b03811681146100f857600080fd5b919050565b60008060006060848603121561011257600080fd5b61011b846100e1565b9250610129602085016100e1565b9150610137604085016100e1565b90509250925092565b60805160a05160c051610579610198600039600081816101970152818161024b01526103770152600081816101050152818161027a0152610326015260008181606f015281816101c601526102fe01526105796000f3fe608060405234801561001057600080fd5b50600436106100355760003560e01c806223de291461003a578063e8078d9414610054575b600080fd5b610052610048366004610451565b5050505050505050565b005b6100526040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e291906104fc565b6040516370a0823160e01b81523060048201529091506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906104fc565b905061017c8282610180565b5050565b60405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af115801561020f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102339190610515565b5060405163095ea7b360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af11580156102c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102e79190610515565b5060405162e8e33760e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830152604482018490526064820183905260006084830181905260a4830181905260c48301524260e48301527f0000000000000000000000000000000000000000000000000000000000000000169063e8e3370090610104016060604051808303816000875af11580156103c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e5919061053e565b5050505050565b80356001600160a01b038116811461040357600080fd5b919050565b60008083601f84011261041a57600080fd5b50813567ffffffffffffffff81111561043257600080fd5b60208301915083602082850101111561044a57600080fd5b9250929050565b60008060008060008060008060c0898b03121561046d57600080fd5b610476896103ec565b975061048460208a016103ec565b965061049260408a016103ec565b955060608901359450608089013567ffffffffffffffff808211156104b657600080fd5b6104c28c838d01610408565b909650945060a08b01359150808211156104db57600080fd5b506104e88b828c01610408565b999c989b5096995094979396929594505050565b60006020828403121561050e57600080fd5b5051919050565b60006020828403121561052757600080fd5b8151801515811461053757600080fd5b9392505050565b60008060006060848603121561055357600080fd5b835192506020840151915060408401519050925092509256fea164736f6c634300080f000a000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000009fb83c0635de2e815fd1c21b3a292277540c2e8d00000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000016d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000009496e746572636f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034954520000000000000000000000000000000000000000000000000000000000

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000009fb83c0635de2e815fd1c21b3a292277540c2e8d00000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000000000000000016d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000003e80000000000000000000000000000000000000000000000000000000000000009496e746572636f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034954520000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : tokenName_ (string): Intercoin
Arg [1] : tokenSymbol_ (string): ITR
Arg [2] : reserveToken_ (address): 0x9fb83c0635de2e815fd1c21b3a292277540c2e8d
Arg [3] : priceDrop_ (uint256): 1000
Arg [4] : lockupIntervalAmount_ (uint64): 365
Arg [5] : minClaimPrice_ (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [6] : externalToken_ (address): 0x0000000000000000000000000000000000000000
Arg [7] : externalTokenExchangePrice_ (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [8] : buyTaxMax_ (uint256): 1000
Arg [9] : sellTaxMax_ (uint256): 1000

-----Encoded View---------------
16 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [2] : 0000000000000000000000009fb83c0635de2e815fd1c21b3a292277540c2e8d
Arg [3] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [4] : 000000000000000000000000000000000000000000000000000000000000016d
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [10] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [11] : 00000000000000000000000000000000000000000000000000000000000003e8
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [13] : 496e746572636f696e0000000000000000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [15] : 4954520000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.