ETH Price: $2,915.56 (-3.78%)
Gas: 1 Gwei

Contract

0xAd1DE7b91b332972d76F4fD7690d1Dc47543B1c1
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60a06040170446142023-04-14 9:43:47450 days ago1681465427IN
 Create: RangeProtocolVault
0 ETH0.1319827525

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RangeProtocolVault

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 33 : RangeProtocolVault.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

import "./uniswap/TickMath.sol";
import "./uniswap/LiquidityAmounts.sol";
import "./interfaces/IRangeProtocolVault.sol";
import "./RangeProtocolVaultStorage.sol";
import "./abstract/Ownable.sol";

/**
 * @dev Mars@RangeProtocol
 * @notice RangeProtocolVault is fungible vault shares contract that accepts uniswap pool tokens for liquidity
 * provision to the corresponding uniswap v3 pool. This contract is configurable to work with any uniswap v3
 * pool and is initialized through RangeProtocolFactory contract's createVault function which determines
 * the pool address based provided tokens addresses and fee tier.
 *
 * The contract allows minting and burning of vault shares where minting involves providing token0 and/or token1
 * for the current set ticks (or based on ratio of token0 and token1 amounts in the vault when vault does not have an
 * active position in the uniswap v3 pool) and burning involves removing liquidity from the uniswap v3 pool along with
 * the vault's fee.
 *
 * The manager of the contract can remove liquidity from uniswap v3 pool and deposit into a newer take range to maximise
 * the profit by keeping liquidity out of the pool under high volatility periods.
 *
 * Part of the fee earned from uniswap v3 position is paid to manager as performance fee and fee is charged on the LP's
 * notional amount as managing fee.
 */
contract RangeProtocolVault is
    Initializable,
    UUPSUpgradeable,
    ReentrancyGuardUpgradeable,
    Ownable,
    ERC20Upgradeable,
    PausableUpgradeable,
    IRangeProtocolVault,
    RangeProtocolVaultStorage
{
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using TickMath for int24;

    /// Performance fee cannot be set more than 10% of the fee earned from uniswap v3 pool.
    uint16 public constant MAX_PERFORMANCE_FEE_BPS = 1000;
    /// Managing fee cannot be set more than 1% of the total fee earned.
    uint16 public constant MAX_MANAGING_FEE_BPS = 100;

    constructor() {
        _disableInitializers();
    }

    /**
     * @notice initialize initializes the vault contract and is called right after proxy deployment
     * by the factory contract.
     * @param _pool address of the uniswap v3 pool associated with vault
     * @param _tickSpacing tick spacing of the uniswap pool
     * @param data additional config data associated with the implementation. The data type chosen is bytes
     * to keep the initialize function implementation contract generic to be compatible with factory contract
     */
    function initialize(
        address _pool,
        int24 _tickSpacing,
        bytes memory data
    ) external override initializer {
        (address manager, string memory _name, string memory _symbol) = abi.decode(
            data,
            (address, string, string)
        );

        __UUPSUpgradeable_init();
        __ReentrancyGuard_init();
        __ERC20_init(_name, _symbol);
        __Pausable_init();

        pool = IUniswapV3Pool(_pool);
        token0 = IERC20Upgradeable(pool.token0());
        token1 = IERC20Upgradeable(pool.token1());
        tickSpacing = _tickSpacing;
        factory = msg.sender;

        performanceFee = 250;
        managingFee = 0;
        _manager = manager;

        // Managing fee is 0% at the time vault initialization.
        emit FeesUpdated(0, performanceFee);
    }

    /**
     * @notice updateTicks it is called by the contract manager to update the ticks.
     * It can only be called once total supply is zero and the vault has not active position
     * in the uniswap pool
     * @param _lowerTick lowerTick to set
     * @param _upperTick upperTick to set
     */
    function updateTicks(int24 _lowerTick, int24 _upperTick) external override onlyManager {
        if (totalSupply() != 0 || inThePosition) revert NotAllowedToUpdateTicks();
        _updateTicks(_lowerTick, _upperTick);

        if (!mintStarted) {
            mintStarted = true;
            emit MintStarted();
        }
    }

    /**
     * @notice allows pausing of minting and burning features of the contract in the event
     * any security risk is seen in the vault.
     */
    function pause() external onlyManager {
        _pause();
    }

    /**
     * @notice allows unpausing of minting and burning features of the contract if they paused.
     */
    function unpause() external onlyManager {
        _unpause();
    }

    /// @notice uniswapV3MintCallback Uniswap V3 callback fn, called back on pool.mint
    function uniswapV3MintCallback(
        uint256 amount0Owed,
        uint256 amount1Owed,
        bytes calldata
    ) external override {
        if (msg.sender != address(pool)) revert OnlyPoolAllowed();

        if (amount0Owed > 0) {
            token0.safeTransfer(msg.sender, amount0Owed);
        }

        if (amount1Owed > 0) {
            token1.safeTransfer(msg.sender, amount1Owed);
        }
    }

    /// @notice uniswapV3SwapCallback Uniswap v3 callback fn, called back on pool.swap
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata
    ) external override {
        if (msg.sender != address(pool)) revert OnlyPoolAllowed();

        if (amount0Delta > 0) {
            token0.safeTransfer(msg.sender, uint256(amount0Delta));
        } else if (amount1Delta > 0) {
            token1.safeTransfer(msg.sender, uint256(amount1Delta));
        }
    }

    /**
     * @notice mint mints range vault shares, fractional shares of a Uniswap V3 position/strategy
     * to compute the amount of tokens necessary to mint `mintAmount` see getMintAmounts
     * @param mintAmount The number of shares to mint
     * @return amount0 amount of token0 transferred from msg.sender to mint `mintAmount`
     * @return amount1 amount of token1 transferred from msg.sender to mint `mintAmount`
     */
    function mint(
        uint256 mintAmount
    ) external override nonReentrant whenNotPaused returns (uint256 amount0, uint256 amount1) {
        if (!mintStarted) revert MintNotStarted();
        if (mintAmount == 0) revert InvalidMintAmount();
        uint256 totalSupply = totalSupply();
        bool _inThePosition = inThePosition;
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();

        if (totalSupply > 0) {
            (uint256 amount0Current, uint256 amount1Current) = getUnderlyingBalances();
            amount0 = FullMath.mulDivRoundingUp(amount0Current, mintAmount, totalSupply);
            amount1 = FullMath.mulDivRoundingUp(amount1Current, mintAmount, totalSupply);
        } else if (_inThePosition) {
            // If total supply is zero then inThePosition must be set to accept token0 and token1 based on currently set ticks.
            // This branch will be executed for the first mint and as well as each time total supply is to be changed from zero to non-zero.
            (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(
                sqrtRatioX96,
                lowerTick.getSqrtRatioAtTick(),
                upperTick.getSqrtRatioAtTick(),
                SafeCastUpgradeable.toUint128(mintAmount)
            );
        } else {
            // If total supply is zero and the vault is not in the position then mint cannot be accepted based on the assumptions
            // that being out of the pool renders currently set ticks unusable and totalSupply being zero does not allow
            // calculating correct amounts of amount0 and amount1 to be accepted from the user.
            // This branch will be executed if all users remove their liquidity from the vault i.e. total supply is zero from non-zero and
            // the vault is out of the position i.e. no valid tick range to calculate the vault's mint shares.
            // Manager must call initialize function with valid tick ranges to enable the minting again.
            revert MintNotAllowed();
        }

        if (!userVaults[msg.sender].exists) {
            userVaults[msg.sender].exists = true;
            users.push(msg.sender);
        }
        if (amount0 > 0) {
            userVaults[msg.sender].token0 += amount0;
            token0.safeTransferFrom(msg.sender, address(this), amount0);
        }
        if (amount1 > 0) {
            userVaults[msg.sender].token1 += amount1;
            token1.safeTransferFrom(msg.sender, address(this), amount1);
        }

        _mint(msg.sender, mintAmount);
        if (_inThePosition) {
            uint128 liquidityMinted = LiquidityAmounts.getLiquidityForAmounts(
                sqrtRatioX96,
                lowerTick.getSqrtRatioAtTick(),
                upperTick.getSqrtRatioAtTick(),
                amount0,
                amount1
            );
            pool.mint(address(this), lowerTick, upperTick, liquidityMinted, "");
        }

        emit Minted(msg.sender, mintAmount, amount0, amount1);
    }

    /**
     * @notice burn burns range vault shares (shares of a Uniswap V3 position) and receive underlying
     * @param burnAmount The number of shares to burn
     * @return amount0 amount of token0 transferred to msg.sender for burning {burnAmount}
     * @return amount1 amount of token1 transferred to msg.sender for burning {burnAmount}
     */
    function burn(
        uint256 burnAmount
    ) external override nonReentrant whenNotPaused returns (uint256 amount0, uint256 amount1) {
        if (burnAmount == 0) revert InvalidBurnAmount();
        uint256 totalSupply = totalSupply();
        uint256 balanceBefore = balanceOf(msg.sender);
        _burn(msg.sender, burnAmount);

        if (inThePosition) {
            (uint128 liquidity, , , , ) = pool.positions(getPositionID());
            uint256 liquidityBurned_ = FullMath.mulDiv(burnAmount, liquidity, totalSupply);
            uint128 liquidityBurned = SafeCastUpgradeable.toUint128(liquidityBurned_);
            (uint256 burn0, uint256 burn1, uint256 fee0, uint256 fee1) = _withdraw(liquidityBurned);

            _applyPerformanceFee(fee0, fee1);
            (fee0, fee1) = _netPerformanceFees(fee0, fee1);
            emit PerformanceFeeEarned(fee0, fee1);
            amount0 =
                burn0 +
                FullMath.mulDiv(
                    token0.balanceOf(address(this)) - burn0 - managerBalance0,
                    burnAmount,
                    totalSupply
                );

            amount1 =
                burn1 +
                FullMath.mulDiv(
                    token1.balanceOf(address(this)) - burn1 - managerBalance1,
                    burnAmount,
                    totalSupply
                );
        } else {
            (uint256 amount0Current, uint256 amount1Current) = getUnderlyingBalances();
            amount0 = FullMath.mulDiv(amount0Current, burnAmount, totalSupply);
            amount1 = FullMath.mulDiv(amount1Current, burnAmount, totalSupply);
        }

        _applyManagingFee(amount0, amount1);
        (uint256 amount0AfterFee, uint256 amount1AfterFee) = _netManagingFees(amount0, amount1);
        emit ManagingFeeEarned(amount0 - amount0AfterFee, amount1 - amount1AfterFee);
        if (amount0 > 0) {
            userVaults[msg.sender].token0 =
                (userVaults[msg.sender].token0 * (balanceBefore - burnAmount)) /
                balanceBefore;
            token0.safeTransfer(msg.sender, amount0AfterFee);
        }
        if (amount1 > 0) {
            userVaults[msg.sender].token1 =
                (userVaults[msg.sender].token1 * (balanceBefore - burnAmount)) /
                balanceBefore;
            token1.safeTransfer(msg.sender, amount1AfterFee);
        }

        emit Burned(msg.sender, burnAmount, amount0AfterFee, amount1AfterFee);
    }

    /**
     * @notice removeLiquidity removes liquidity from uniswap pool and receives underlying tokens
     * in the vault contract.
     */
    function removeLiquidity() external override onlyManager {
        (uint128 liquidity, , , , ) = pool.positions(getPositionID());

        if (liquidity > 0) {
            int24 _lowerTick = lowerTick;
            int24 _upperTick = upperTick;
            (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1) = _withdraw(liquidity);

            emit LiquidityRemoved(liquidity, _lowerTick, _upperTick, amount0, amount1);

            _applyPerformanceFee(fee0, fee1);
            (fee0, fee1) = _netPerformanceFees(fee0, fee1);
            emit PerformanceFeeEarned(fee0, fee1);
        }

        // TicksSet event is not emitted here since the emitting would create a new position on subgraph but
        // the following statement is to only disallow any liquidity provision through the vault unless done
        // by manager (taking into account any features added in future).
        lowerTick = upperTick;
        inThePosition = false;
        emit InThePositionStatusSet(false);
    }

    /**
     * @dev Mars@RangeProtocol
     * @notice swap swaps token0 for token1 (token0 in, token1 out), or token1 for token0 (token1 in token0 out).
     * Zero for one will cause the price: amount1 / amount0 lower, otherwise it will cause the price higher
     * @param zeroForOne The direction of the swap, true is swap token0 for token1, false is swap token1 to token0
     * @param swapAmount The exact input token amount of the swap
     * @param sqrtPriceLimitX96 threshold price ratio after the swap.
     * If zero for one, the price cannot be lower (swap make price lower) than this threshold value after the swap
     * If one for zero, the price cannot be greater (swap make price higher) than this threshold value after the swap
     * @return amount0 If positive represents exact input token0 amount after this swap, msg.sender paid amount,
     * or exact output token0 amount (negative), msg.sender received amount
     * @return amount1 If positive represents exact input token1 amount after this swap, msg.sender paid amount,
     * or exact output token1 amount (negative), msg.sender received amount
     */
    function swap(
        bool zeroForOne,
        int256 swapAmount,
        uint160 sqrtPriceLimitX96
    ) external override onlyManager returns (int256 amount0, int256 amount1) {
        (amount0, amount1) = pool.swap(
            address(this),
            zeroForOne,
            swapAmount,
            sqrtPriceLimitX96,
            ""
        );

        emit Swapped(zeroForOne, amount0, amount1);
    }

    /**
     * @dev Mars@RangeProtocol
     * @notice addLiquidity allows manager to add liquidity into uniswap pool into newer tick ranges.
     * @param newLowerTick new lower tick to deposit liquidity into
     * @param newUpperTick new upper tick to deposit liquidity into
     * @param amount0 max amount of amount0 to use
     * @param amount1 max amount of amount1 to use
     * @return remainingAmount0 remaining amount from amount0
     * @return remainingAmount1 remaining amount from amount1
     */
    function addLiquidity(
        int24 newLowerTick,
        int24 newUpperTick,
        uint256 amount0,
        uint256 amount1
    ) external override onlyManager returns (uint256 remainingAmount0, uint256 remainingAmount1) {
        _validateTicks(newLowerTick, newUpperTick);
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
        uint128 baseLiquidity = LiquidityAmounts.getLiquidityForAmounts(
            sqrtRatioX96,
            newLowerTick.getSqrtRatioAtTick(),
            newUpperTick.getSqrtRatioAtTick(),
            amount0,
            amount1
        );

        if (baseLiquidity > 0) {
            (uint256 amountDeposited0, uint256 amountDeposited1) = pool.mint(
                address(this),
                newLowerTick,
                newUpperTick,
                baseLiquidity,
                ""
            );
            // Should return remaining token number for swap
            remainingAmount0 = amount0 - amountDeposited0;
            remainingAmount1 = amount1 - amountDeposited1;
            if (lowerTick != newLowerTick || upperTick != newUpperTick) {
                lowerTick = newLowerTick;
                upperTick = newUpperTick;
                emit TicksSet(newLowerTick, newUpperTick);
            }

            emit LiquidityAdded(
                baseLiquidity,
                newLowerTick,
                newUpperTick,
                amountDeposited0,
                amountDeposited1
            );
        }
        // This check is added to not update inThePosition state in case manager decides to add liquidity in smaller chunks.
        if (!inThePosition) {
            inThePosition = true;
            emit InThePositionStatusSet(true);
        }
    }

    /**
     * @dev pullFeeFromPool pulls accrued fee from uniswap v3 pool that position has accrued since
     * last collection.
     */
    function pullFeeFromPool() external onlyManager {
        (, , uint256 fee0, uint256 fee1) = _withdraw(0);
        _applyPerformanceFee(fee0, fee1);
        (fee0, fee1) = _netPerformanceFees(fee0, fee1);
        emit PerformanceFeeEarned(fee0, fee1);
    }

    /// @notice collectManager collects manager fees accrued
    function collectManager() external override {
        uint256 amount0 = managerBalance0;
        uint256 amount1 = managerBalance1;
        managerBalance0 = 0;
        managerBalance1 = 0;

        if (amount0 > 0) {
            token0.safeTransfer(_manager, amount0);
        }
        if (amount1 > 0) {
            token1.safeTransfer(_manager, amount1);
        }
    }

    /**
     * @notice updateFees allows updating of managing and performance fees
     */
    function updateFees(
        uint16 newManagingFee,
        uint16 newPerformanceFee
    ) external override onlyManager {
        if (newManagingFee > MAX_MANAGING_FEE_BPS) revert InvalidManagingFee();
        if (newPerformanceFee > MAX_PERFORMANCE_FEE_BPS) revert InvalidPerformanceFee();

        if (newManagingFee >= 0) {
            managingFee = newManagingFee;
        }

        if (newPerformanceFee >= 0) {
            performanceFee = newPerformanceFee;
        }

        emit FeesUpdated(newManagingFee, newPerformanceFee);
    }

    /**
     * @notice compute maximum shares that can be minted from `amount0Max` and `amount1Max`
     * @param amount0Max The maximum amount of token0 to forward on mint
     * @param amount1Max The maximum amount of token1 to forward on mint
     * @return amount0 actual amount of token0 to forward when minting `mintAmount`
     * @return amount1 actual amount of token1 to forward when minting `mintAmount`
     * @return mintAmount maximum number of shares mintable
     */
    function getMintAmounts(
        uint256 amount0Max,
        uint256 amount1Max
    ) external view override returns (uint256 amount0, uint256 amount1, uint256 mintAmount) {
        if (!mintStarted) revert MintNotStarted();
        uint256 totalSupply = totalSupply();
        if (totalSupply > 0) {
            (amount0, amount1, mintAmount) = _calcMintAmounts(totalSupply, amount0Max, amount1Max);
        } else {
            (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
            uint128 newLiquidity = LiquidityAmounts.getLiquidityForAmounts(
                sqrtRatioX96,
                lowerTick.getSqrtRatioAtTick(),
                upperTick.getSqrtRatioAtTick(),
                amount0Max,
                amount1Max
            );
            mintAmount = uint256(newLiquidity);
            (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity(
                sqrtRatioX96,
                lowerTick.getSqrtRatioAtTick(),
                upperTick.getSqrtRatioAtTick(),
                newLiquidity
            );
        }
    }

    /**
     * @notice compute total underlying token0 and token1 token supply at provided price
     * includes current liquidity invested in uniswap position, current fees earned
     * and any uninvested leftover (but does not include manager fees accrued)
     * @param sqrtRatioX96 price to computer underlying balances at
     * @return amount0Current current total underlying balance of token0
     * @return amount1Current current total underlying balance of token1
     */
    function getUnderlyingBalancesAtPrice(
        uint160 sqrtRatioX96
    ) external view override returns (uint256 amount0Current, uint256 amount1Current) {
        (, int24 tick, , , , , ) = pool.slot0();
        return _getUnderlyingBalances(sqrtRatioX96, tick);
    }

    /**
     * @notice getCurrentFees returns the current uncollected fees
     * @return fee0 uncollected fee in token0
     * @return fee1 uncollected fee in token1
     */
    function getCurrentFees() external view override returns (uint256 fee0, uint256 fee1) {
        (, int24 tick, , , , , ) = pool.slot0();
        (
            uint128 liquidity,
            uint256 feeGrowthInside0Last,
            uint256 feeGrowthInside1Last,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        ) = pool.positions(getPositionID());
        fee0 = _feesEarned(true, feeGrowthInside0Last, tick, liquidity) + uint256(tokensOwed0);
        fee1 = _feesEarned(false, feeGrowthInside1Last, tick, liquidity) + uint256(tokensOwed1);
        (fee0, fee1) = _netPerformanceFees(fee0, fee1);
    }

    /**
     * @notice returns array of current user vaults. This function is only intended to be called off-chain.
     * @param fromIdx start index to fetch the user vaults info from.
     * @param toIdx end index to fetch the user vault to.
     */
    function getUserVaults(
        uint256 fromIdx,
        uint256 toIdx
    ) external view override returns (UserVaultInfo[] memory) {
        if (fromIdx == 0 && toIdx == 0) {
            toIdx = users.length;
        }
        UserVaultInfo[] memory usersVaultInfo = new UserVaultInfo[](toIdx - fromIdx);
        uint256 count;
        for (uint256 i = fromIdx; i < toIdx; i++) {
            UserVault memory userVault = userVaults[users[i]];
            usersVaultInfo[count++] = UserVaultInfo({
                user: users[i],
                token0: userVault.token0,
                token1: userVault.token1
            });
        }
        return usersVaultInfo;
    }

    /**
     * @notice getPositionID returns the position id of the vault in uniswap pool
     * @return positionID position id of the vault in uniswap pool
     */
    function getPositionID() public view override returns (bytes32 positionID) {
        return keccak256(abi.encodePacked(address(this), lowerTick, upperTick));
    }

    /**
     * @notice compute total underlying token0 and token1 token supply at current price
     * includes current liquidity invested in uniswap position, current fees earned
     * and any uninvested leftover (but does not include manager fees accrued)
     * @return amount0Current current total underlying balance of token0
     * @return amount1Current current total underlying balance of token1
     */
    function getUnderlyingBalances()
        public
        view
        override
        returns (uint256 amount0Current, uint256 amount1Current)
    {
        (uint160 sqrtRatioX96, int24 tick, , , , , ) = pool.slot0();
        return _getUnderlyingBalances(sqrtRatioX96, tick);
    }

    /**
     * @notice _getUnderlyingBalances internal function to calculate underlying balances
     * @param sqrtRatioX96 price to calculate underlying balances at
     * @param tick tick at the given price
     * @return amount0Current current amount of token0
     * @return amount1Current current amount of token1
     */
    function _getUnderlyingBalances(
        uint160 sqrtRatioX96,
        int24 tick
    ) internal view returns (uint256 amount0Current, uint256 amount1Current) {
        (
            uint128 liquidity,
            uint256 feeGrowthInside0Last,
            uint256 feeGrowthInside1Last,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        ) = pool.positions(getPositionID());

        uint256 fee0;
        uint256 fee1;
        if (liquidity != 0) {
            (amount0Current, amount1Current) = LiquidityAmounts.getAmountsForLiquidity(
                sqrtRatioX96,
                lowerTick.getSqrtRatioAtTick(),
                upperTick.getSqrtRatioAtTick(),
                liquidity
            );
            fee0 = _feesEarned(true, feeGrowthInside0Last, tick, liquidity) + uint256(tokensOwed0);
            fee1 = _feesEarned(false, feeGrowthInside1Last, tick, liquidity) + uint256(tokensOwed1);
            (fee0, fee1) = _netPerformanceFees(fee0, fee1);
        }

        amount0Current += fee0 + token0.balanceOf(address(this)) - managerBalance0;
        amount1Current += fee1 + token1.balanceOf(address(this)) - managerBalance1;
    }

    /**
     * @notice _authorizeUpgrade internally called by UUPS contract to validate the upgrading operation of
     * the contract.
     */
    function _authorizeUpgrade(address) internal override {
        if (msg.sender != factory) revert OnlyFactoryAllowed();
    }

    /**
     * @notice _withdraw internal function to withdraw liquidity from uniswap pool
     * @param liquidity liquidity to remove from the uniswap pool
     */
    function _withdraw(
        uint128 liquidity
    ) private returns (uint256 burn0, uint256 burn1, uint256 fee0, uint256 fee1) {
        int24 _lowerTick = lowerTick;
        int24 _upperTick = upperTick;
        uint256 preBalance0 = token0.balanceOf(address(this));
        uint256 preBalance1 = token1.balanceOf(address(this));
        (burn0, burn1) = pool.burn(_lowerTick, _upperTick, liquidity);
        pool.collect(address(this), _lowerTick, _upperTick, type(uint128).max, type(uint128).max);
        fee0 = token0.balanceOf(address(this)) - preBalance0 - burn0;
        fee1 = token1.balanceOf(address(this)) - preBalance1 - burn1;
    }

    /**
     * @notice _calcMintAmounts internal function to calculate the amount based on the max supply of token0 and token1
     * and current supply of RangeVault shares.
     * @param totalSupply current total supply of range vault shares
     * @param amount0Max max amount of token0 to compute mint amount
     * @param amount1Max max amount of token1 to compute mint amount
     */
    function _calcMintAmounts(
        uint256 totalSupply,
        uint256 amount0Max,
        uint256 amount1Max
    ) private view returns (uint256 amount0, uint256 amount1, uint256 mintAmount) {
        (uint256 amount0Current, uint256 amount1Current) = getUnderlyingBalances();
        if (amount0Current == 0 && amount1Current > 0) {
            mintAmount = FullMath.mulDiv(amount1Max, totalSupply, amount1Current);
        } else if (amount1Current == 0 && amount0Current > 0) {
            mintAmount = FullMath.mulDiv(amount0Max, totalSupply, amount0Current);
        } else if (amount0Current == 0 && amount1Current == 0) {
            revert ZeroUnderlyingBalance();
        } else {
            uint256 amount0Mint = FullMath.mulDiv(amount0Max, totalSupply, amount0Current);
            uint256 amount1Mint = FullMath.mulDiv(amount1Max, totalSupply, amount1Current);
            if (amount0Mint == 0 || amount1Mint == 0) revert ZeroMintAmount();
            mintAmount = amount0Mint < amount1Mint ? amount0Mint : amount1Mint;
        }

        amount0 = FullMath.mulDivRoundingUp(mintAmount, amount0Current, totalSupply);
        amount1 = FullMath.mulDivRoundingUp(mintAmount, amount1Current, totalSupply);
    }

    /**
     * @notice _feesEarned internal function to return the fees accrued
     * @param isZero true to compute fee for token0 and false to compute fee for token1
     * @param feeGrowthInsideLast last time the fee was realized for the vault in uniswap pool
     */
    function _feesEarned(
        bool isZero,
        uint256 feeGrowthInsideLast,
        int24 tick,
        uint128 liquidity
    ) private view returns (uint256 fee) {
        uint256 feeGrowthOutsideLower;
        uint256 feeGrowthOutsideUpper;
        uint256 feeGrowthGlobal;
        if (isZero) {
            feeGrowthGlobal = pool.feeGrowthGlobal0X128();
            (, , feeGrowthOutsideLower, , , , , ) = pool.ticks(lowerTick);
            (, , feeGrowthOutsideUpper, , , , , ) = pool.ticks(upperTick);
        } else {
            feeGrowthGlobal = pool.feeGrowthGlobal1X128();
            (, , , feeGrowthOutsideLower, , , , ) = pool.ticks(lowerTick);
            (, , , feeGrowthOutsideUpper, , , , ) = pool.ticks(upperTick);
        }

        unchecked {
            uint256 feeGrowthBelow;
            if (tick >= lowerTick) {
                feeGrowthBelow = feeGrowthOutsideLower;
            } else {
                feeGrowthBelow = feeGrowthGlobal - feeGrowthOutsideLower;
            }

            uint256 feeGrowthAbove;
            if (tick < upperTick) {
                feeGrowthAbove = feeGrowthOutsideUpper;
            } else {
                feeGrowthAbove = feeGrowthGlobal - feeGrowthOutsideUpper;
            }
            uint256 feeGrowthInside = feeGrowthGlobal - feeGrowthBelow - feeGrowthAbove;

            fee = FullMath.mulDiv(
                liquidity,
                feeGrowthInside - feeGrowthInsideLast,
                0x100000000000000000000000000000000
            );
        }
    }

    /**
     * @notice _applyManagingFee applies the managing fee to the notional value of the redeeming user.
     * @param amount0 user's notional value in token0
     * @param amount1 user's notional value in token1
     */
    function _applyManagingFee(uint256 amount0, uint256 amount1) private {
        uint256 _managingFee = managingFee;
        managerBalance0 += (amount0 * _managingFee) / 10_000;
        managerBalance1 += (amount1 * _managingFee) / 10_000;
    }

    /**
     * @notice _applyPerformanceFee applies the performance fee to the fees earned from uniswap v3 pool.
     * @param fee0 fee earned in token0
     * @param fee1 fee earned in token1
     */
    function _applyPerformanceFee(uint256 fee0, uint256 fee1) private {
        uint256 _performanceFee = performanceFee;
        managerBalance0 += (fee0 * _performanceFee) / 10_000;
        managerBalance1 += (fee1 * _performanceFee) / 10_000;
    }

    /**
     * @notice _netManagingFees computes the fee share for manager from notional value of the redeeming user.
     * @param amount0 user's notional value in token0
     * @param amount1 user's notional value in token1
     * @return amount0AfterFee user's notional value in token0 after managing fee deduction
     * @return amount1AfterFee user's notional value in token1 after managing fee deduction
     */
    function _netManagingFees(
        uint256 amount0,
        uint256 amount1
    ) private view returns (uint256 amount0AfterFee, uint256 amount1AfterFee) {
        uint256 _managingFee = managingFee;
        uint256 deduct0 = (amount0 * _managingFee) / 10_000;
        uint256 deduct1 = (amount1 * _managingFee) / 10_000;
        amount0AfterFee = amount0 - deduct0;
        amount1AfterFee = amount1 - deduct1;
    }

    /**
     * @notice _netPerformanceFees computes the fee share for manager as performance fee from the fee earned from uniswap v3 pool.
     * @param rawFee0 fee earned in token0 from uniswap v3 pool.
     * @param rawFee1 fee earned in token1 from uniswap v3 pool.
     * @return fee0AfterDeduction fee in token0 earned after deducting performance fee from earned fee.
     * @return fee1AfterDeduction fee in token1 earned after deducting performance fee from earned fee.
     */
    function _netPerformanceFees(
        uint256 rawFee0,
        uint256 rawFee1
    ) private view returns (uint256 fee0AfterDeduction, uint256 fee1AfterDeduction) {
        uint256 _performanceFee = performanceFee;
        uint256 deduct0 = (rawFee0 * _performanceFee) / 10_000;
        uint256 deduct1 = (rawFee1 * _performanceFee) / 10_000;
        fee0AfterDeduction = rawFee0 - deduct0;
        fee1AfterDeduction = rawFee1 - deduct1;
    }

    /**
     * @notice _updateTicks internal function to validate and update ticks
     * _lowerTick lower tick to update
     * _upperTick upper tick to update
     */
    function _updateTicks(int24 _lowerTick, int24 _upperTick) private {
        _validateTicks(_lowerTick, _upperTick);
        lowerTick = _lowerTick;
        upperTick = _upperTick;

        // Upon updating ticks inThePosition status is set to true.
        inThePosition = true;
        emit InThePositionStatusSet(true);
        emit TicksSet(_lowerTick, _upperTick);
    }

    /**
     * @notice _validateTicks validates the upper and lower ticks
     * @param _lowerTick lower tick to validate
     * @param _upperTick upper tick to validate
     */
    function _validateTicks(int24 _lowerTick, int24 _upperTick) private view {
        if (_lowerTick < TickMath.MIN_TICK || _upperTick > TickMath.MAX_TICK)
            revert TicksOutOfRange();

        if (
            _lowerTick >= _upperTick ||
            _lowerTick % tickSpacing != 0 ||
            _upperTick % tickSpacing != 0
        ) revert InvalidTicksSpacing();
    }
}

File 2 of 33 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 3 of 33 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 4 of 33 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Emitted when the beacon is upgraded.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @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) private returns (bytes memory) {
        require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }

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

File 5 of 33 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

File 6 of 33 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

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

File 7 of 33 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

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

File 8 of 33 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

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

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

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

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

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

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

File 9 of 33 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

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

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

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

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

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

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

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

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

File 10 of 33 : draft-IERC20PermitUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20PermitUpgradeable {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 11 of 33 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

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

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

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

File 12 of 33 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

File 13 of 33 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20Upgradeable {
    using AddressUpgradeable for address;

    function safeTransfer(
        IERC20Upgradeable token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20Upgradeable token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20PermitUpgradeable token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 14 of 33 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://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 functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 15 of 33 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

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

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

File 16 of 33 : SafeCastUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCastUpgradeable {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 17 of 33 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }
}

File 18 of 33 : IUniswapV3MintCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#mint
/// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface
interface IUniswapV3MintCallback {
    /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.
    /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity
    /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call
    function uniswapV3MintCallback(
        uint256 amount0Owed,
        uint256 amount1Owed,
        bytes calldata data
    ) external;
}

File 19 of 33 : IUniswapV3SwapCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

File 20 of 33 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 21 of 33 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 22 of 33 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 23 of 33 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 24 of 33 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 25 of 33 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 26 of 33 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 27 of 33 : FixedPoint96.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.4.0;

/// @title FixedPoint96
/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
/// @dev Used in SqrtPriceMath.sol
library FixedPoint96 {
    uint8 internal constant RESOLUTION = 96;
    uint256 internal constant Q96 = 0x1000000000000000000000000;
}

File 28 of 33 : Ownable.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.4;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an manager) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the manager 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
 * `onlyManager`, which can be applied to your functions to restrict their use to
 * the manager.
 */
abstract contract Ownable {
    address internal _manager;

    event OwnershipTransferred(address indexed previousManager, address indexed newManager);

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

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

    /**
     * @dev Leaves the contract without manager. It will not be possible to call
     * `onlyManager` functions anymore. Can only be called by the current manager.
     *
     * NOTE: Renouncing ownership will leave the contract without an manager,
     * thereby removing any functionality that is only available to the manager.
     */
    function renounceOwnership() public virtual onlyManager {
        emit OwnershipTransferred(_manager, address(0));
        _manager = address(0);
    }

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

    uint256[49] private __gap;
}

File 29 of 33 : IRangeProtocolVault.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol";
import "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";

error MintNotStarted();
error NotAllowedToUpdateTicks();
error InvalidManagingFee();
error InvalidPerformanceFee();
error OnlyPoolAllowed();
error InvalidMintAmount();
error InvalidBurnAmount();
error MintNotAllowed();
error ZeroMintAmount();
error ZeroUnderlyingBalance();
error TicksOutOfRange();
error InvalidTicksSpacing();
error OnlyFactoryAllowed();

interface IRangeProtocolVault is IUniswapV3MintCallback, IUniswapV3SwapCallback {
    event Minted(
        address indexed receiver,
        uint256 mintAmount,
        uint256 amount0In,
        uint256 amount1In
    );
    event Burned(
        address indexed receiver,
        uint256 burnAmount,
        uint256 amount0Out,
        uint256 amount1Out
    );
    event LiquidityAdded(
        uint256 liquidityMinted,
        int24 tickLower,
        int24 tickUpper,
        uint256 amount0In,
        uint256 amount1In
    );
    event LiquidityRemoved(
        uint256 liquidityRemoved,
        int24 tickLower,
        int24 tickUpper,
        uint256 amount0Out,
        uint256 amount1Out
    );
    event PerformanceFeeEarned(uint256 feesEarned0, uint256 feesEarned1);
    event ManagingFeeEarned(uint256 feesEarned0, uint256 feesEarned1);
    event FeesUpdated(uint16 managingFee, uint16 performanceFee);
    event InThePositionStatusSet(bool inThePosition);
    event Swapped(bool zeroForOne, int256 amount0, int256 amount1);
    event TicksSet(int24 lowerTick, int24 upperTick);
    event MintStarted();

    function initialize(address _pool, int24 _tickSpacing, bytes memory data) external;

    function updateTicks(int24 _lowerTick, int24 _upperTick) external;

    function mint(uint256 mintAmount) external returns (uint256 amount0, uint256 amount1);

    function burn(uint256 burnAmount) external returns (uint256 amount0, uint256 amount1);

    function removeLiquidity() external;

    function swap(
        bool zeroForOne,
        int256 swapAmount,
        uint160 sqrtPriceLimitX96
    ) external returns (int256 amount0, int256 amount1);

    function addLiquidity(
        int24 newLowerTick,
        int24 newUpperTick,
        uint256 amount0,
        uint256 amount1
    ) external returns (uint256 remainingAmount0, uint256 remainingAmount1);

    function collectManager() external;

    function updateFees(uint16 newManagingFee, uint16 newPerformanceFee) external;

    function getMintAmounts(
        uint256 amount0Max,
        uint256 amount1Max
    ) external view returns (uint256 amount0, uint256 amount1, uint256 mintAmount);

    function getUnderlyingBalances()
        external
        view
        returns (uint256 amount0Current, uint256 amount1Current);

    function getUnderlyingBalancesAtPrice(
        uint160 sqrtRatioX96
    ) external view returns (uint256 amount0Current, uint256 amount1Current);

    function getCurrentFees() external view returns (uint256 fee0, uint256 fee1);

    function getPositionID() external view returns (bytes32 positionID);

    struct UserVaultInfo {
        address user;
        uint256 token0;
        uint256 token1;
    }

    function getUserVaults(
        uint256 fromIdx,
        uint256 toIdx
    ) external view returns (UserVaultInfo[] memory);
}

File 30 of 33 : RangeProtocolVaultStorage.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

/**
 * @notice RangeProtocolVaultStorage a storage contract for RangeProtocolVault
 */
abstract contract RangeProtocolVaultStorage {
    int24 public lowerTick;
    int24 public upperTick;

    uint16 public managingFee;
    uint256 public managerBalance0;
    uint256 public managerBalance1;

    IUniswapV3Pool public pool;
    IERC20Upgradeable public token0;
    IERC20Upgradeable public token1;
    int24 public tickSpacing;

    /// @notice Unused slots
    address public unusedSlot0;
    uint256 public unusedSlot1;
    uint256 public unusedSlot2;

    bool public inThePosition;
    bool public mintStarted;

    address public factory;

    struct UserVault {
        bool exists;
        uint256 token0;
        uint256 token1;
    }
    mapping(address => UserVault) public userVaults;
    address[] public users;

    uint16 public performanceFee;
    // NOTE: Only add more state variable below it and do not change the order of above state variables.
}

File 31 of 33 : FullMath.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = a * b
            // Compute the product mod 2**256 and mod 2**256 - 1
            // then use the Chinese Remainder Theorem to reconstruct
            // the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2**256 + prod0
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(a, b, not(0))
                prod0 := mul(a, b)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division
            if (prod1 == 0) {
                require(denominator > 0);
                assembly {
                    result := div(prod0, denominator)
                }
                return result;
            }

            // Make sure the result is less than 2**256.
            // Also prevents denominator == 0
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0]
            // Compute remainder using mulmod
            uint256 remainder;
            assembly {
                remainder := mulmod(a, b, denominator)
            }
            // Subtract 256 bit number from 512 bit number
            assembly {
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator
            // Compute largest power of two divisor of denominator.
            // Always >= 1.
            // EDIT for 0.8 compatibility:
            // see: https://ethereum.stackexchange.com/questions/96642/unary-operator-cannot-be-applied-to-type-uint256
            uint256 twos = denominator & (~denominator + 1);

            // Divide denominator by power of two
            assembly {
                denominator := div(denominator, twos)
            }

            // Divide [prod1 prod0] by the factors of two
            assembly {
                prod0 := div(prod0, twos)
            }
            // Shift in bits from prod1 into prod0. For this we need
            // to flip `twos` such that it is 2**256 / twos.
            // If twos is zero, then it becomes one
            assembly {
                twos := add(div(sub(0, twos), twos), 1)
            }
            prod0 |= prod1 * twos;

            // Invert denominator mod 2**256
            // Now that denominator is an odd number, it has an inverse
            // modulo 2**256 such that denominator * inv = 1 mod 2**256.
            // Compute the inverse by starting with a seed that is correct
            // correct for four bits. That is, denominator * inv = 1 mod 2**4
            uint256 inv = (3 * denominator) ^ 2;
            // Now use Newton-Raphson iteration to improve the precision.
            // Thanks to Hensel's lifting lemma, this also works in modular
            // arithmetic, doubling the correct bits in each step.
            inv *= 2 - denominator * inv; // inverse mod 2**8
            inv *= 2 - denominator * inv; // inverse mod 2**16
            inv *= 2 - denominator * inv; // inverse mod 2**32
            inv *= 2 - denominator * inv; // inverse mod 2**64
            inv *= 2 - denominator * inv; // inverse mod 2**128
            inv *= 2 - denominator * inv; // inverse mod 2**256

            // Because the division is now exact we can divide by multiplying
            // with the modular inverse of denominator. This will give us the
            // correct result modulo 2**256. Since the precoditions guarantee
            // that the outcome is less than 2**256, this is the final result.
            // We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inv;
            return result;
        }
    }

    /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    function mulDivRoundingUp(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        result = mulDiv(a, b, denominator);
        if (mulmod(a, b, denominator) > 0) {
            require(result < type(uint256).max);
            result++;
        }
    }
}

File 32 of 33 : LiquidityAmounts.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0;

import {FullMath} from "./FullMath.sol";
import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";

/// @title Liquidity amount functions
/// @notice Provides functions for computing liquidity amounts from token amounts and prices
library LiquidityAmounts {
    function toUint128(uint256 x) private pure returns (uint128 y) {
        require((y = uint128(x)) == x);
    }

    /// @notice Computes the amount of liquidity received for a given amount of token0 and price range
    /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)).
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param amount0 The amount0 being sent in
    /// @return liquidity The amount of returned liquidity
    function getLiquidityForAmount0(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint256 amount0
    ) internal pure returns (uint128 liquidity) {
        if (sqrtRatioAX96 > sqrtRatioBX96)
            (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
        uint256 intermediate =
            FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);
        return
            toUint128(
                FullMath.mulDiv(
                    amount0,
                    intermediate,
                    sqrtRatioBX96 - sqrtRatioAX96
                )
            );
    }

    /// @notice Computes the amount of liquidity received for a given amount of token1 and price range
    /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param amount1 The amount1 being sent in
    /// @return liquidity The amount of returned liquidity
    function getLiquidityForAmount1(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint256 amount1
    ) internal pure returns (uint128 liquidity) {
        if (sqrtRatioAX96 > sqrtRatioBX96)
            (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
        return
            toUint128(
                FullMath.mulDiv(
                    amount1,
                    FixedPoint96.Q96,
                    sqrtRatioBX96 - sqrtRatioAX96
                )
            );
    }

    /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current
    /// pool prices and the prices at the tick boundaries
    function getLiquidityForAmounts(
        uint160 sqrtRatioX96,
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint256 amount0,
        uint256 amount1
    ) internal pure returns (uint128 liquidity) {
        if (sqrtRatioAX96 > sqrtRatioBX96)
            (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

        if (sqrtRatioX96 <= sqrtRatioAX96) {
            liquidity = getLiquidityForAmount0(
                sqrtRatioAX96,
                sqrtRatioBX96,
                amount0
            );
        } else if (sqrtRatioX96 < sqrtRatioBX96) {
            uint128 liquidity0 =
                getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);
            uint128 liquidity1 =
                getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);

            liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;
        } else {
            liquidity = getLiquidityForAmount1(
                sqrtRatioAX96,
                sqrtRatioBX96,
                amount1
            );
        }
    }

    /// @notice Computes the amount of token0 for a given amount of liquidity and a price range
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param liquidity The liquidity being valued
    /// @return amount0 The amount0
    function getAmount0ForLiquidity(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint128 liquidity
    ) internal pure returns (uint256 amount0) {
        if (sqrtRatioAX96 > sqrtRatioBX96)
            (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

        return
            FullMath.mulDiv(
                uint256(liquidity) << FixedPoint96.RESOLUTION,
                sqrtRatioBX96 - sqrtRatioAX96,
                sqrtRatioBX96
            ) / sqrtRatioAX96;
    }

    /// @notice Computes the amount of token1 for a given amount of liquidity and a price range
    /// @param sqrtRatioAX96 A sqrt price
    /// @param sqrtRatioBX96 Another sqrt price
    /// @param liquidity The liquidity being valued
    /// @return amount1 The amount1
    function getAmount1ForLiquidity(
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint128 liquidity
    ) internal pure returns (uint256 amount1) {
        if (sqrtRatioAX96 > sqrtRatioBX96)
            (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

        return
            FullMath.mulDiv(
                liquidity,
                sqrtRatioBX96 - sqrtRatioAX96,
                FixedPoint96.Q96
            );
    }

    /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current
    /// pool prices and the prices at the tick boundaries
    function getAmountsForLiquidity(
        uint160 sqrtRatioX96,
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint128 liquidity
    ) internal pure returns (uint256 amount0, uint256 amount1) {
        if (sqrtRatioAX96 > sqrtRatioBX96)
            (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

        if (sqrtRatioX96 <= sqrtRatioAX96) {
            amount0 = getAmount0ForLiquidity(
                sqrtRatioAX96,
                sqrtRatioBX96,
                liquidity
            );
        } else if (sqrtRatioX96 < sqrtRatioBX96) {
            amount0 = getAmount0ForLiquidity(
                sqrtRatioX96,
                sqrtRatioBX96,
                liquidity
            );
            amount1 = getAmount1ForLiquidity(
                sqrtRatioAX96,
                sqrtRatioX96,
                liquidity
            );
        } else {
            amount1 = getAmount1ForLiquidity(
                sqrtRatioAX96,
                sqrtRatioBX96,
                liquidity
            );
        }
    }
}

File 33 of 33 : TickMath.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO =
        1461446703485210103287273052203988822378723970342;

    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick)
        internal
        pure
        returns (uint160 sqrtPriceX96)
    {
        uint256 absTick =
            tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));

        // EDIT: 0.8 compatibility
        require(absTick <= uint256(int256(MAX_TICK)), "T");

        uint256 ratio =
            absTick & 0x1 != 0
                ? 0xfffcb933bd6fad37aa2d162d1a594001
                : 0x100000000000000000000000000000000;
        if (absTick & 0x2 != 0)
            ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
        if (absTick & 0x4 != 0)
            ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
        if (absTick & 0x8 != 0)
            ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
        if (absTick & 0x10 != 0)
            ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
        if (absTick & 0x20 != 0)
            ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
        if (absTick & 0x40 != 0)
            ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
        if (absTick & 0x80 != 0)
            ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
        if (absTick & 0x100 != 0)
            ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
        if (absTick & 0x200 != 0)
            ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
        if (absTick & 0x400 != 0)
            ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
        if (absTick & 0x800 != 0)
            ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
        if (absTick & 0x1000 != 0)
            ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
        if (absTick & 0x2000 != 0)
            ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
        if (absTick & 0x4000 != 0)
            ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
        if (absTick & 0x8000 != 0)
            ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
        if (absTick & 0x10000 != 0)
            ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
        if (absTick & 0x20000 != 0)
            ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
        if (absTick & 0x40000 != 0)
            ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
        if (absTick & 0x80000 != 0)
            ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

        if (tick > 0) ratio = type(uint256).max / ratio;

        // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
        // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
        // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
        sqrtPriceX96 = uint160(
            (ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)
        );
    }

    /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
    /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
    /// ever return.
    /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
    /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
    function getTickAtSqrtRatio(uint160 sqrtPriceX96)
        internal
        pure
        returns (int24 tick)
    {
        // second inequality must be < because the price can never reach the price at the max tick
        require(
            sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO,
            "R"
        );
        uint256 ratio = uint256(sqrtPriceX96) << 32;

        uint256 r = ratio;
        uint256 msb = 0;

        assembly {
            let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(5, gt(r, 0xFFFFFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(4, gt(r, 0xFFFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(3, gt(r, 0xFF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(2, gt(r, 0xF))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := shl(1, gt(r, 0x3))
            msb := or(msb, f)
            r := shr(f, r)
        }
        assembly {
            let f := gt(r, 0x1)
            msb := or(msb, f)
        }

        if (msb >= 128) r = ratio >> (msb - 127);
        else r = ratio << (127 - msb);

        int256 log_2 = (int256(msb) - 128) << 64;

        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(63, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(62, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(61, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(60, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(59, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(58, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(57, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(56, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(55, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(54, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(53, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(52, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(51, f))
            r := shr(f, r)
        }
        assembly {
            r := shr(127, mul(r, r))
            let f := shr(128, r)
            log_2 := or(log_2, shl(50, f))
        }

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

        int24 tickLow =
            int24(
                (log_sqrt10001 - 3402992956809132418596140100660247210) >> 128
            );
        int24 tickHi =
            int24(
                (log_sqrt10001 + 291339464771989622907027621153398088495) >> 128
            );

        tick = tickLow == tickHi
            ? tickLow
            : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96
            ? tickHi
            : tickLow;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidBurnAmount","type":"error"},{"inputs":[],"name":"InvalidManagingFee","type":"error"},{"inputs":[],"name":"InvalidMintAmount","type":"error"},{"inputs":[],"name":"InvalidPerformanceFee","type":"error"},{"inputs":[],"name":"InvalidTicksSpacing","type":"error"},{"inputs":[],"name":"MintNotAllowed","type":"error"},{"inputs":[],"name":"MintNotStarted","type":"error"},{"inputs":[],"name":"NotAllowedToUpdateTicks","type":"error"},{"inputs":[],"name":"OnlyFactoryAllowed","type":"error"},{"inputs":[],"name":"OnlyPoolAllowed","type":"error"},{"inputs":[],"name":"TicksOutOfRange","type":"error"},{"inputs":[],"name":"ZeroMintAmount","type":"error"},{"inputs":[],"name":"ZeroUnderlyingBalance","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","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":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"burnAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"}],"name":"Burned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"managingFee","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"performanceFee","type":"uint16"}],"name":"FeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"inThePosition","type":"bool"}],"name":"InThePositionStatusSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"liquidityMinted","type":"uint256"},{"indexed":false,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":false,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"liquidityRemoved","type":"uint256"},{"indexed":false,"internalType":"int24","name":"tickLower","type":"int24"},{"indexed":false,"internalType":"int24","name":"tickUpper","type":"int24"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"}],"name":"LiquidityRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feesEarned0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feesEarned1","type":"uint256"}],"name":"ManagingFeeEarned","type":"event"},{"anonymous":false,"inputs":[],"name":"MintStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousManager","type":"address"},{"indexed":true,"internalType":"address","name":"newManager","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feesEarned0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feesEarned1","type":"uint256"}],"name":"PerformanceFeeEarned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"zeroForOne","type":"bool"},{"indexed":false,"internalType":"int256","name":"amount0","type":"int256"},{"indexed":false,"internalType":"int256","name":"amount1","type":"int256"}],"name":"Swapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int24","name":"lowerTick","type":"int24"},{"indexed":false,"internalType":"int24","name":"upperTick","type":"int24"}],"name":"TicksSet","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"MAX_MANAGING_FEE_BPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERFORMANCE_FEE_BPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"newLowerTick","type":"int24"},{"internalType":"int24","name":"newUpperTick","type":"int24"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"remainingAmount0","type":"uint256"},{"internalType":"uint256","name":"remainingAmount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","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":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"burnAmount","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentFees","outputs":[{"internalType":"uint256","name":"fee0","type":"uint256"},{"internalType":"uint256","name":"fee1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Max","type":"uint256"},{"internalType":"uint256","name":"amount1Max","type":"uint256"}],"name":"getMintAmounts","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPositionID","outputs":[{"internalType":"bytes32","name":"positionID","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyingBalances","outputs":[{"internalType":"uint256","name":"amount0Current","type":"uint256"},{"internalType":"uint256","name":"amount1Current","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint160","name":"sqrtRatioX96","type":"uint160"}],"name":"getUnderlyingBalancesAtPrice","outputs":[{"internalType":"uint256","name":"amount0Current","type":"uint256"},{"internalType":"uint256","name":"amount1Current","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromIdx","type":"uint256"},{"internalType":"uint256","name":"toIdx","type":"uint256"}],"name":"getUserVaults","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"token0","type":"uint256"},{"internalType":"uint256","name":"token1","type":"uint256"}],"internalType":"struct IRangeProtocolVault.UserVaultInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inThePosition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"int24","name":"_tickSpacing","type":"int24"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lowerTick","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managerBalance0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managerBalance1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"managingFee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract IUniswapV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pullFeeFromPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"removeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"int256","name":"swapAmount","type":"int256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"name":"swap","outputs":[{"internalType":"int256","name":"amount0","type":"int256"},{"internalType":"int256","name":"amount1","type":"int256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tickSpacing","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","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":[{"internalType":"uint256","name":"amount0Owed","type":"uint256"},{"internalType":"uint256","name":"amount1Owed","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3MintCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unusedSlot0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unusedSlot1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unusedSlot2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"newManagingFee","type":"uint16"},{"internalType":"uint16","name":"newPerformanceFee","type":"uint16"}],"name":"updateFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"_lowerTick","type":"int24"},{"internalType":"int24","name":"_upperTick","type":"int24"}],"name":"updateTicks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"upperTick","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userVaults","outputs":[{"internalType":"bool","name":"exists","type":"bool"},{"internalType":"uint256","name":"token0","type":"uint256"},{"internalType":"uint256","name":"token1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"users","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523060601b6080523480156200001857600080fd5b506200002362000029565b620000eb565b600054610100900460ff1615620000965760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e9576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60805160601c615e0a6200012660003960008181610da501528181610de50152818161168c015281816116cc01526118200152615e0a6000f3fe6080604052600436106103815760003560e01c806371908a03116101d1578063b670ed7d11610102578063d7e458b5116100a0578063f3d2350e1161006f578063f3d2350e14610a74578063f8c2e29b14610a94578063fa461e3314610aa9578063fd87f9aa14610ac957600080fd5b8063d7e458b514610a0a578063dd62ed3e14610a1f578063df28408a14610a3f578063f2fde38b14610a5457600080fd5b8063c653089f116100dc578063c653089f1461097a578063d0c93a7c146109a7578063d21220a7146109c9578063d3487997146109ea57600080fd5b8063b670ed7d1461091c578063c18d7e761461093c578063c45a01551461095357600080fd5b80639894f21a1161016f578063a457c2d711610149578063a457c2d7146108a5578063a9059cbb146108c5578063a9722cf3146108e5578063b1fbe9af1461090557600080fd5b80639894f21a1461082f5780639b1344ac1461086a578063a0712d681461088557600080fd5b806387788782116101ab57806387788782146107c85780639210b8f3146107e45780639403c1ae1461080557806395d89b411461081a57600080fd5b806371908a0314610769578063727dd2281461077e5780638456cb59146107b357600080fd5b80633d048c27116102b65780634fa62c5f1161025457806367b9a2861161022357806367b9a286146106f3578063708891651461070857806370a082311461071e578063715018a61461075457600080fd5b80634fa62c5f1461066f57806352d1902d1461068f5780635c975abb146106a4578063601b48a4146106bd57600080fd5b806342966c681161029057806342966c681461060757806342fb9d4414610627578063481c6a751461063e5780634f1ef2861461065c57600080fd5b80633d048c27146105b75780633f4ba83a146105d75780634043f5ca146105ec57600080fd5b8063195cd92c11610323578063313ce567116102fd578063313ce567146105395780633659cfe614610555578063365b98b214610577578063395093511461059757600080fd5b8063195cd92c1461049b57806323b872dd146104bb5780632958d031146104db57600080fd5b80630dfe16811161035f5780630dfe1681146104025780631322d9541461043b57806316f0115b1461046557806318160ddd1461048657600080fd5b8063065756db1461038657806306fdde03146103b0578063095ea7b3146103d2575b600080fd5b34801561039257600080fd5b5061039d6101605481565b6040519081526020015b60405180910390f35b3480156103bc57600080fd5b506103c5610ae9565b6040516103a791906159db565b3480156103de57600080fd5b506103f26103ed366004615553565b610b7b565b60405190151581526020016103a7565b34801561040e57600080fd5b5061016354610423906001600160a01b031681565b6040516001600160a01b0390911681526020016103a7565b34801561044757600080fd5b50610450610b93565b604080519283526020830191909152016103a7565b34801561047157600080fd5b5061016254610423906001600160a01b031681565b34801561049257600080fd5b5060fd5461039d565b3480156104a757600080fd5b506104506104b636600461559a565b610c3d565b3480156104c757600080fd5b506103f26104d636600461546f565b610d74565b3480156104e757600080fd5b5061051c6104f636600461538b565b6101696020526000908152604090208054600182015460029092015460ff909116919083565b6040805193151584526020840192909252908201526060016103a7565b34801561054557600080fd5b50604051601281526020016103a7565b34801561056157600080fd5b5061057561057036600461538b565b610d9a565b005b34801561058357600080fd5b506104236105923660046158d4565b610e7a565b3480156105a357600080fd5b506103f26105b2366004615553565b610ea5565b3480156105c357600080fd5b506105756105d23660046154fd565b610ec7565b3480156105e357600080fd5b506105756111f9565b3480156105f857600080fd5b50610168546103f29060ff1681565b34801561061357600080fd5b506104506106223660046158d4565b61123c565b34801561063357600080fd5b5061039d6101615481565b34801561064a57600080fd5b506097546001600160a01b0316610423565b61057561066a3660046154af565b611681565b34801561067b57600080fd5b5061057561068a3660046155f3565b611752565b34801561069b57600080fd5b5061039d611813565b3480156106b057600080fd5b5061012d5460ff166103f2565b3480156106c957600080fd5b5061015f546106e090600160301b900461ffff1681565b60405161ffff90911681526020016103a7565b3480156106ff57600080fd5b506105756118c6565b34801561071457600080fd5b506106e06103e881565b34801561072a57600080fd5b5061039d61073936600461538b565b6001600160a01b0316600090815260fb602052604090205490565b34801561076057600080fd5b50610575611ae9565b34801561077557600080fd5b50610450611b6c565b34801561078a57600080fd5b5061015f546107a0906301000000900460020b81565b60405160029190910b81526020016103a7565b3480156107bf57600080fd5b50610575611cfd565b3480156107d457600080fd5b5061016b546106e09061ffff1681565b3480156107f057600080fd5b5061016554610423906001600160a01b031681565b34801561081157600080fd5b50610575611d3e565b34801561082657600080fd5b506103c5611d9a565b34801561083b57600080fd5b5061084f61084a3660046158ec565b611da9565b604080519384526020840192909252908201526060016103a7565b34801561087657600080fd5b5061015f546107a09060020b81565b34801561089157600080fd5b506104506108a03660046158d4565b611f2a565b3480156108b157600080fd5b506103f26108c0366004615553565b61230d565b3480156108d157600080fd5b506103f26108e0366004615553565b612393565b3480156108f157600080fd5b50610168546103f290610100900460ff1681565b34801561091157600080fd5b5061039d6101665481565b34801561092857600080fd5b5061045061093736600461538b565b6123a1565b34801561094857600080fd5b5061039d6101675481565b34801561095f57600080fd5b5061016854610423906201000090046001600160a01b031681565b34801561098657600080fd5b5061099a6109953660046158ec565b612449565b6040516103a7919061596b565b3480156109b357600080fd5b50610164546107a090600160a01b900460020b81565b3480156109d557600080fd5b5061016454610423906001600160a01b031681565b3480156109f657600080fd5b50610575610a05366004615688565b612627565b348015610a1657600080fd5b5061057561268e565b348015610a2b57600080fd5b5061039d610a3a366004615437565b612732565b348015610a4b57600080fd5b5061039d61275d565b348015610a6057600080fd5b50610575610a6f36600461538b565b6127c2565b348015610a8057600080fd5b50610575610a8f3660046158a7565b6128be565b348015610aa057600080fd5b506106e0606481565b348015610ab557600080fd5b50610575610ac4366004615688565b6129b2565b348015610ad557600080fd5b50610450610ae4366004615620565b612a24565b606060fe8054610af890615c42565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2490615c42565b8015610b715780601f10610b4657610100808354040283529160200191610b71565b820191906000526020600020905b815481529060010190602001808311610b5457829003601f168201915b5050505050905090565b600033610b89818585612d2b565b5060019392505050565b60008060008061016260009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610be857600080fd5b505afa158015610bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c209190615807565b505050505091509150610c338282612e4f565b9350935050509091565b60008033610c536097546001600160a01b031690565b6001600160a01b031614610c825760405162461bcd60e51b8152600401610c7990615aa6565b60405180910390fd5b61016254604051630251596160e31b81523060048201528615156024820152604481018690526001600160a01b03858116606483015260a06084830152600060a48301529091169063128acb089060c4016040805180830381600087803b158015610cec57600080fd5b505af1158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d249190615665565b6040805188151581526020810184905290810182905291935091507fbf511038cfa32cfb7971e976074c0e6aeda010e6afcbb38d87b4f910305014949060600160405180910390a1935093915050565b600033610d828582856130eb565b610d8d85858561315f565b60019150505b9392505050565b306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610de35760405162461bcd60e51b8152600401610c7990615a0e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610e2c600080516020615d8e833981519152546001600160a01b031690565b6001600160a01b031614610e525760405162461bcd60e51b8152600401610c7990615a5a565b610e5b8161330a565b60408051600080825260208201909252610e779183919061333c565b50565b61016a8181548110610e8b57600080fd5b6000918252602090912001546001600160a01b0316905081565b600033610b89818585610eb88383612732565b610ec29190615b8c565b612d2b565b600054610100900460ff1615808015610ee75750600054600160ff909116105b80610f015750303b158015610f01575060005460ff166001145b610f645760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c79565b6000805460ff191660011790558015610f87576000805461ff0019166101001790555b600080600084806020019051810190610fa091906153c3565b925092509250610fae6134bb565b610fb66134e2565b610fc08282613511565b610fc8613542565b61016280546001600160a01b0319166001600160a01b03891690811790915560408051630dfe168160e01b81529051630dfe168191600480820192602092909190829003018186803b15801561101d57600080fd5b505afa158015611031573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105591906153a7565b61016380546001600160a01b0319166001600160a01b03928316179055610162546040805163d21220a760e01b81529051919092169163d21220a7916004808301926020929190829003018186803b1580156110b057600080fd5b505afa1580156110c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e891906153a7565b61016480546001600160a01b039283166001600160b81b031990911617600160a01b62ffffff60028b900b1602179055610168805462010000600160b01b03191633620100000217905561016b805460fa61ffff19909116811790915561015f805467ffff00000000000019169055609780546001600160a01b03191692861692909217909155604080516000815260208101929092527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c11910160405180910390a150505080156111f3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b3361120c6097546001600160a01b031690565b6001600160a01b0316146112325760405162461bcd60e51b8152600401610c7990615aa6565b61123a613571565b565b6000806112476135c4565b61124f61361e565b8261126d576040516302075cc160e41b815260040160405180910390fd5b600061127860fd5490565b33600081815260fb60205260409020549192506112959086613665565b6101685460ff16156114c257610162546000906001600160a01b031663514ea4bf6112be61275d565b6040518263ffffffff1660e01b81526004016112dc91815260200190565b60a06040518083038186803b1580156112f457600080fd5b505afa158015611308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132c91906157b1565b505050509050600061134887836001600160801b031686613799565b9050600061135582613848565b9050600080600080611366856138b5565b93509350935093506113788282613c49565b6113828282613cb3565b60408051838152602081018390529294509092507fb841b8f9713db8d7cd9269d4f7f396d88cd5be4ddacf7d38da5ce8e182c48b8b910160405180910390a161016054610163546040516370a0823160e01b8152306004820152611464929187916001600160a01b03909116906370a08231906024015b60206040518083038186803b15801561141157600080fd5b505afa158015611425573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144991906155db565b6114539190615bff565b61145d9190615bff565b8d8b613799565b61146e9085615b8c565b61016154610164546040516370a0823160e01b8152306004820152929d506114aa9286916001600160a01b0316906370a08231906024016113f9565b6114b49084615b8c565b9950505050505050506114ee565b6000806114cd610b93565b915091506114dc828886613799565b95506114e9818886613799565b945050505b6114f88484613d17565b6000806115058686613d33565b90925090507f4fde5dead35c5797dc8fe113e0d397a67df1fcc334818cd63aec8820d60db4576115358388615bff565b61153f8388615bff565b6040805192835260208301919091520160405180910390a185156115c157826115688882615bff565b33600090815261016960205260409020600101546115869190615bb8565b6115909190615ba4565b3360008181526101696020526040902060010191909155610163546115c1916001600160a01b039091169084613d55565b841561162b57826115d28882615bff565b33600090815261016960205260409020600201546115f09190615bb8565b6115fa9190615ba4565b33600081815261016960205260409020600201919091556101645461162b916001600160a01b039091169083613d55565b604080518881526020810184905290810182905233907f4c60206a5c1de41f3376d1d60f0949d96cb682033c90b1c2d9d9a62d4c4120c09060600160405180910390a25050505061167c6001606555565b915091565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156116ca5760405162461bcd60e51b8152600401610c7990615a0e565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611713600080516020615d8e833981519152546001600160a01b031690565b6001600160a01b0316146117395760405162461bcd60e51b8152600401610c7990615a5a565b6117428261330a565b61174e8282600161333c565b5050565b336117656097546001600160a01b031690565b6001600160a01b03161461178b5760405162461bcd60e51b8152600401610c7990615aa6565b60fd5415158061179e57506101685460ff165b156117bc57604051632a2c70bb60e11b815260040160405180910390fd5b6117c68282613dbf565b61016854610100900460ff1661174e57610168805461ff0019166101001790556040517f452a344f03203071e1daf66e007976c85cb2380deabf1c91f3c4fb1fca41204990600090a15050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118b35760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610c79565b50600080516020615d8e83398151915290565b336118d96097546001600160a01b031690565b6001600160a01b0316146118ff5760405162461bcd60e51b8152600401610c7990615aa6565b610162546000906001600160a01b031663514ea4bf61191c61275d565b6040518263ffffffff1660e01b815260040161193a91815260200190565b60a06040518083038186803b15801561195257600080fd5b505afa158015611966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198a91906157b1565b5050505090506000816001600160801b03161115611a845761015f54600281810b9163010000009004900b60008080806119c3876138b5565b604080516001600160801b038d16815260028c810b60208301528b900b818301526060810186905260808101859052905194985092965090945092507f6d7e1841bf97c0b736eafb2779459ba1e0af2305cead28a8e97533589ceb2f65919081900360a00190a1611a348282613c49565b611a3e8282613cb3565b60408051838152602081018390529294509092507fb841b8f9713db8d7cd9269d4f7f396d88cd5be4ddacf7d38da5ce8e182c48b8b910160405180910390a15050505050505b61015f805463010000008104600290810b900b62ffffff1662ffffff19909116179055610168805460ff19169055604051600081527fd9279952b347fd14af9b788aff1029c0d3b1299b7dcce164fc602a1b958c48809060200160405180910390a150565b33611afc6097546001600160a01b031690565b6001600160a01b031614611b225760405162461bcd60e51b8152600401610c7990615aa6565b6097546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3609780546001600160a01b0319169055565b600080600061016260009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015611bc057600080fd5b505afa158015611bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf89190615807565b5050610162549395506000945084938493508392508291506001600160a01b031663514ea4bf611c2661275d565b6040518263ffffffff1660e01b8152600401611c4491815260200190565b60a06040518083038186803b158015611c5c57600080fd5b505afa158015611c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9491906157b1565b94509450945094509450816001600160801b0316611cb56001868989613e7c565b611cbf9190615b8c565b9750806001600160801b0316611cd86000858989613e7c565b611ce29190615b8c565b9650611cee8888613cb3565b90999098509650505050505050565b33611d106097546001600160a01b031690565b6001600160a01b031614611d365760405162461bcd60e51b8152600401610c7990615aa6565b61123a614278565b61016080546101618054600093849055929055908115611d765760975461016354611d76916001600160a01b03918216911684613d55565b801561174e576097546101645461174e916001600160a01b03918216911683613d55565b606060ff8054610af890615c42565b600080600061016860019054906101000a900460ff16611ddc57604051630314872760e11b815260040160405180910390fd5b6000611de760fd5490565b90508015611e0657611dfa8187876142b6565b91955093509150611f22565b6101625460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e0929190829003018186803b158015611e4c57600080fd5b505afa158015611e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e849190615807565b50505050505090506000611ed082611eae61015f60009054906101000a900460020b60020b6143b9565b61015f54611ec99063010000009004600290810b900b6143b9565b8b8b6147d6565b61015f546001600160801b0382169550909150611f1a908390611ef990600290810b900b6143b9565b61015f54611f149063010000009004600290810b900b6143b9565b8461489a565b909650945050505b509250925092565b600080611f356135c4565b611f3d61361e565b61016854610100900460ff16611f6657604051630314872760e11b815260040160405180910390fd5b82611f845760405163199f5a0360e31b815260040160405180910390fd5b6000611f8f60fd5490565b610168546101625460408051633850c7bd60e01b8152905193945060ff909216926000926001600160a01b0390921691633850c7bd9160048083019260e0929190829003018186803b158015611fe457600080fd5b505afa158015611ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201c9190615807565b5050505050509050600083111561205d57600080612038610b93565b91509150612047828987614936565b9650612054818987614936565b955050506120c9565b81156120b05761015f546120a690829061207d90600290810b900b6143b9565b61015f546120989063010000009004600290810b900b6143b9565b6120a18a613848565b61489a565b90955093506120c9565b60405163344fa43b60e01b815260040160405180910390fd5b336000908152610169602052604090205460ff166121405733600081815261016960205260408120805460ff1916600190811790915561016a805491820181559091527f17da1ae71935bc1a620f4cc216c63f7b5576c3970bae66f4178d3166b99125440180546001600160a01b03191690911790555b841561218757336000908152610169602052604081206001018054879290612169908490615b8c565b909155505061016354612187906001600160a01b0316333088614984565b83156121ce573360009081526101696020526040812060020180548692906121b0908490615b8c565b9091555050610164546121ce906001600160a01b0316333087614984565b6121d833876149bc565b81156122bd5761015f5460009061221d9083906121fb90600290810b900b6143b9565b61015f546122169063010000009004600290810b900b6143b9565b89896147d6565b6101625461015f54604051633c8a7d8d60e01b81529293506001600160a01b0390911691633c8a7d8d91612268913091600281810b926301000000909204900b908790600401615929565b6040805180830381600087803b15801561228157600080fd5b505af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b99190615665565b5050505b604080518781526020810187905290810185905233907f5a3358a3d27a5373c0df2604662088d37894d56b7cfd27f315770440f4e0d9199060600160405180910390a250505061167c6001606555565b6000338161231b8286612732565b90508381101561237b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c79565b6123888286868403612d2b565b506001949350505050565b600033610b8981858561315f565b600080600061016260009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b1580156123f557600080fd5b505afa158015612409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242d9190615807565b505050505091505061243f8482612e4f565b9250925050915091565b606082158015612457575081155b156124635761016a5491505b600061246f8484615bff565b67ffffffffffffffff81111561249557634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156124f357816020015b6124e0604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b8152602001906001900390816124b35790505b5090506000845b8481101561261d576000610169600061016a848154811061252b57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528281019390935260409182019020815160608082018452825460ff161515825260018301549482019490945260029091015481830152815192830190915261016a80549193508291859081106125aa57634e487b7160e01b600052603260045260246000fd5b600091825260209182902001546001600160a01b03168252838101519082015260408084015191015284846125de81615c7d565b9550815181106125fe57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050808061261590615c7d565b9150506124fa565b5090949350505050565b610162546001600160a01b0316331461265257604051620b7d9960e41b815260040160405180910390fd5b83156126705761016354612670906001600160a01b03163386613d55565b82156111f357610164546111f3906001600160a01b03163385613d55565b336126a16097546001600160a01b031690565b6001600160a01b0316146126c75760405162461bcd60e51b8152600401610c7990615aa6565b6000806126d460006138b5565b9350935050506126e48282613c49565b6126ee8282613cb3565b60408051838152602081018390529294509092507fb841b8f9713db8d7cd9269d4f7f396d88cd5be4ddacf7d38da5ce8e182c48b8b91015b60405180910390a15050565b6001600160a01b03918216600090815260fc6020908152604080832093909416825291909152205490565b61015f546040516bffffffffffffffffffffffff193060601b166020820152600282810b810b60e890811b60348401526301000000909304810b900b90911b6037820152600090603a0160405160208183030381529060405280519060200120905090565b336127d56097546001600160a01b031690565b6001600160a01b0316146127fb5760405162461bcd60e51b8152600401610c7990615aa6565b6001600160a01b0381166128625760405162461bcd60e51b815260206004820152602860248201527f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401610c79565b6097546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3609780546001600160a01b0319166001600160a01b0392909216919091179055565b336128d16097546001600160a01b031690565b6001600160a01b0316146128f75760405162461bcd60e51b8152600401610c7990615aa6565b606461ffff8316111561291d576040516313f90f0b60e31b815260040160405180910390fd5b6103e861ffff8216111561294457604051630f14508d60e41b815260040160405180910390fd5b61015f805467ffff0000000000001916600160301b61ffff8581169182029290921790925561016b805461ffff191691841691821790556040805192835260208301919091527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c119101612726565b610162546001600160a01b031633146129dd57604051620b7d9960e41b815260040160405180910390fd5b6000841315612a0357610163546129fe906001600160a01b03163386613d55565b6111f3565b60008313156111f357610164546111f3906001600160a01b03163385613d55565b60008033612a3a6097546001600160a01b031690565b6001600160a01b031614612a605760405162461bcd60e51b8152600401610c7990615aa6565b612a6a8686614a7d565b6101625460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e0929190829003018186803b158015612ab057600080fd5b505afa158015612ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae89190615807565b50505050505090506000612b0e82612b028a60020b6143b9565b6122168a60020b6143b9565b90506001600160801b03811615612cd05761016254604051633c8a7d8d60e01b815260009182916001600160a01b0390911690633c8a7d8d90612b5b9030908e908e908990600401615929565b6040805180830381600087803b158015612b7457600080fd5b505af1158015612b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bac9190615665565b9092509050612bbb8289615bff565b9550612bc78188615bff565b61015f5490955060028b810b91810b900b141580612bf8575061015f5460028a810b6301000000909204810b900b14155b15612c725761015f805460028b810b62ffffff90811663010000000265ffffffffffff19909316918e900b16171790556040517f8e3ac6cc9b82795b40740ca4e954df8f6655fe35e80cdc6fb33d50c3423fcd1690612c69908c908c90600292830b8152910b602082015260400190565b60405180910390a15b604080516001600160801b038516815260028c810b60208301528b900b81830152606081018490526080810183905290517ffa715a0b1bc7287b5d3581c11478041b0455aad0c17361fc1e55fffbdd4b6c4f9181900360a00190a150505b6101685460ff16612d2057610168805460ff191660019081179091556040519081527fd9279952b347fd14af9b788aff1029c0d3b1299b7dcce164fc602a1b958c48809060200160405180910390a15b505094509492505050565b6001600160a01b038316612d8d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c79565b6001600160a01b038216612dee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c79565b6001600160a01b03838116600081815260fc602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b610162546000908190819081908190819081906001600160a01b031663514ea4bf612e7861275d565b6040518263ffffffff1660e01b8152600401612e9691815260200190565b60a06040518083038186803b158015612eae57600080fd5b505afa158015612ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee691906157b1565b94509450945094509450600080866001600160801b0316600014612f9a5761015f54612f3f908c90612f1e90600290810b900b6143b9565b61015f54612f399063010000009004600290810b900b6143b9565b8a61489a565b90995097506001600160801b038416612f5b6001888d8b613e7c565b612f659190615b8c565b9150826001600160801b0316612f7e6000878d8b613e7c565b612f889190615b8c565b9050612f948282613cb3565b90925090505b61016054610163546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612fe257600080fd5b505afa158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a91906155db565b6130249084615b8c565b61302e9190615bff565b613038908a615b8c565b61016154610164546040516370a0823160e01b8152306004820152929b5090916001600160a01b03909116906370a082319060240160206040518083038186803b15801561308557600080fd5b505afa158015613099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130bd91906155db565b6130c79083615b8c565b6130d19190615bff565b6130db9089615b8c565b9750505050505050509250929050565b60006130f78484612732565b905060001981146111f357818110156131525760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610c79565b6111f38484848403612d2b565b6001600160a01b0383166131c35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c79565b6001600160a01b0382166132255760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c79565b6001600160a01b038316600090815260fb60205260409020548181101561329d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c79565b6001600160a01b03808516600081815260fb602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906132fd9086815260200190565b60405180910390a36111f3565b610168546201000090046001600160a01b03163314610e7757604051631b1319e560e01b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156133745761336f83614b32565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156133ad57600080fd5b505afa9250505080156133dd575060408051601f3d908101601f191682019092526133da918101906155db565b60015b6134405760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610c79565b600080516020615d8e83398151915281146134af5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610c79565b5061336f838383614bce565b600054610100900460ff1661123a5760405162461bcd60e51b8152600401610c7990615ae8565b600054610100900460ff166135095760405162461bcd60e51b8152600401610c7990615ae8565b61123a614bf3565b600054610100900460ff166135385760405162461bcd60e51b8152600401610c7990615ae8565b61174e8282614c1a565b600054610100900460ff166135695760405162461bcd60e51b8152600401610c7990615ae8565b61123a614c68565b613579614c9c565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600260655414156136175760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c79565b6002606555565b61012d5460ff161561123a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c79565b6001600160a01b0382166136c55760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c79565b6001600160a01b038216600090815260fb6020526040902054818110156137395760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c79565b6001600160a01b038316600081815260fb60209081526040808320868603905560fd80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6000808060001985870985870292508281108382030391505080600014156137d357600084116137c857600080fd5b508290049050610d93565b8084116137df57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b60006001600160801b038211156138b15760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610c79565b5090565b61015f54610163546040516370a0823160e01b8152306004820152600092839283928392600281810b936301000000909204900b9184916001600160a01b0316906370a082319060240160206040518083038186803b15801561391757600080fd5b505afa15801561392b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061394f91906155db565b610164546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b15801561399957600080fd5b505afa1580156139ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139d191906155db565b6101625460405163a34123a760e01b8152600287810b600483015286900b60248201526001600160801b038c1660448201529192506001600160a01b03169063a34123a7906064016040805180830381600087803b158015613a3257600080fd5b505af1158015613a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a6a9190615665565b610162546040516309e3d67b60e31b8152306004820152600288810b602483015287900b60448201526001600160801b03606482018190526084820152929a509098506001600160a01b031690634f1eb3d89060a4016040805180830381600087803b158015613ad957600080fd5b505af1158015613aed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b11919061577f565b5050610163546040516370a0823160e01b8152306004820152899184916001600160a01b03909116906370a082319060240160206040518083038186803b158015613b5b57600080fd5b505afa158015613b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b9391906155db565b613b9d9190615bff565b613ba79190615bff565b610164546040516370a0823160e01b8152306004820152919750889183916001600160a01b0316906370a082319060240160206040518083038186803b158015613bf057600080fd5b505afa158015613c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c2891906155db565b613c329190615bff565b613c3c9190615bff565b9450505050509193509193565b61016b5461ffff16612710613c5e8285615bb8565b613c689190615ba4565b6101606000828254613c7a9190615b8c565b909155506127109050613c8d8284615bb8565b613c979190615ba4565b6101616000828254613ca99190615b8c565b9091555050505050565b61016b54600090819061ffff1681612710613cce8388615bb8565b613cd89190615ba4565b90506000612710613ce98488615bb8565b613cf39190615ba4565b9050613cff8288615bff565b9450613d0b8187615bff565b93505050509250929050565b61015f54600160301b900461ffff16612710613c5e8285615bb8565b61015f546000908190600160301b900461ffff1681612710613cce8388615bb8565b6040516001600160a01b03831660248201526044810182905261336f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614ce6565b6001606555565b613dc98282614a7d565b61015f8054600283810b62ffffff90811663010000000265ffffffffffff199093169186900b1617179055610168805460ff191660019081179091556040517fd9279952b347fd14af9b788aff1029c0d3b1299b7dcce164fc602a1b958c488091613e3991901515815260200190565b60405180910390a160408051600284810b825283900b60208201527f8e3ac6cc9b82795b40740ca4e954df8f6655fe35e80cdc6fb33d50c3423fcd169101612726565b60008060008087156140445761016260009054906101000a90046001600160a01b03166001600160a01b031663f30583996040518163ffffffff1660e01b815260040160206040518083038186803b158015613ed757600080fd5b505afa158015613eeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f0f91906155db565b6101625461015f5460405163f30dba9360e01b8152600291820b90910b60048201529192506001600160a01b03169063f30dba93906024016101006040518083038186803b158015613f6057600080fd5b505afa158015613f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f9891906156d9565b50506101625461015f5460405163f30dba9360e01b8152959a506001600160a01b03909116965063f30dba939550613fe394630100000090910460020b935060040191506159cd9050565b6101006040518083038186803b158015613ffc57600080fd5b505afa158015614010573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061403491906156d9565b509397506141fa95505050505050565b61016260009054906101000a90046001600160a01b03166001600160a01b031663461413196040518163ffffffff1660e01b815260040160206040518083038186803b15801561409357600080fd5b505afa1580156140a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140cb91906155db565b6101625461015f5460405163f30dba9360e01b8152600291820b90910b60048201529192506001600160a01b03169063f30dba93906024016101006040518083038186803b15801561411c57600080fd5b505afa158015614130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061415491906156d9565b50506101625461015f5460405163f30dba9360e01b8152949a506001600160a01b03909116965063f30dba93955061419e94506301000000900460020b9260040191506159cd9050565b6101006040518083038186803b1580156141b757600080fd5b505afa1580156141cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141ef91906156d9565b509297505050505050505b61015f54600090600290810b810b9088900b1261421857508261421d565b508281035b600061015f60039054906101000a900460020b60020b8860020b1215614244575082614249565b508282035b8183038190036142696001600160801b0389168b8303600160801b613799565b9b9a5050505050505050505050565b61428061361e565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135a73390565b60008060008060006142c6610b93565b915091508160001480156142da5750600081115b156142f1576142ea868983613799565b9250614394565b801580156142ff5750600082115b1561430f576142ea878984613799565b8115801561431b575080155b156143395760405163f912977760e01b815260040160405180910390fd5b6000614346888a85613799565b90506000614355888b85613799565b9050811580614362575080155b1561438057604051630856e64360e21b815260040160405180910390fd5b80821061438d578061438f565b815b945050505b61439f83838a614936565b94506143ac83828a614936565b9350505093509350939050565b60008060008360020b126143d0578260020b6143dd565b8260020b6143dd90615cef565b90506143ec620d89e719615cce565b60020b8111156144225760405162461bcd60e51b81526020600482015260016024820152601560fa1b6044820152606401610c79565b60006001821661443657600160801b614448565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615614487576080614482826ffff97272373d413259a46990580e213a615bb8565b901c90505b60048216156144b15760806144ac826ffff2e50f5f656932ef12357cf3c7fdcc615bb8565b901c90505b60088216156144db5760806144d6826fffe5caca7e10e4e61c3624eaa0941cd0615bb8565b901c90505b6010821615614505576080614500826fffcb9843d60f6159c9db58835c926644615bb8565b901c90505b602082161561452f57608061452a826fff973b41fa98c081472e6896dfb254c0615bb8565b901c90505b6040821615614559576080614554826fff2ea16466c96a3843ec78b326b52861615bb8565b901c90505b608082161561458357608061457e826ffe5dee046a99a2a811c461f1969c3053615bb8565b901c90505b6101008216156145ae5760806145a9826ffcbe86c7900a88aedcffc83b479aa3a4615bb8565b901c90505b6102008216156145d95760806145d4826ff987a7253ac413176f2b074cf7815e54615bb8565b901c90505b6104008216156146045760806145ff826ff3392b0822b70005940c7a398e4b70f3615bb8565b901c90505b61080082161561462f57608061462a826fe7159475a2c29b7443b29c7fa6e889d9615bb8565b901c90505b61100082161561465a576080614655826fd097f3bdfd2022b8845ad8f792aa5825615bb8565b901c90505b612000821615614685576080614680826fa9f746462d870fdf8a65dc1f90e061e5615bb8565b901c90505b6140008216156146b05760806146ab826f70d869a156d2a1b890bb3df62baf32f7615bb8565b901c90505b6180008216156146db5760806146d6826f31be135f97d08fd981231505542fcfa6615bb8565b901c90505b62010000821615614707576080614702826f09aa508b5b7a84e1c677de54f3e99bc9615bb8565b901c90505b6202000082161561473257608061472d826e5d6af8dedb81196699c329225ee604615bb8565b901c90505b6204000082161561475c576080614757826d2216e584f5fa1ea926041bedfe98615bb8565b901c90505b6208000082161561478457608061477f826b048a170391f7dc42444e8fa2615bb8565b901c90505b60008460020b131561479f5761479c81600019615ba4565b90505b6147ae64010000000082615cba565b156147ba5760016147bd565b60005b6147ce9060ff16602083901c615b8c565b949350505050565b6000836001600160a01b0316856001600160a01b031611156147f6579293925b846001600160a01b0316866001600160a01b0316116148215761481a858585614db8565b9050614891565b836001600160a01b0316866001600160a01b03161015614883576000614848878686614db8565b90506000614857878986614e22565b9050806001600160801b0316826001600160801b031610614878578061487a565b815b92505050614891565b61488e858584614e22565b90505b95945050505050565b600080836001600160a01b0316856001600160a01b031611156148bb579293925b846001600160a01b0316866001600160a01b0316116148e6576148df858585614e58565b915061492d565b836001600160a01b0316866001600160a01b0316101561491f5761490b868585614e58565b9150614918858785614ecb565b905061492d565b61492a858585614ecb565b90505b94509492505050565b6000614943848484613799565b90506000828061496357634e487b7160e01b600052601260045260246000fd5b8486091115610d9357600019811061497a57600080fd5b8061489181615c7d565b6040516001600160a01b03808516602483015283166044820152606481018290526111f39085906323b872dd60e01b90608401613d81565b6001600160a01b038216614a125760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c79565b8060fd6000828254614a249190615b8c565b90915550506001600160a01b038216600081815260fb60209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b620d89e719600283900b1280614aa45750614a9b620d89e719615cce565b60020b8160020b135b15614ac25760405163137b639d60e21b815260040160405180910390fd5b8060020b8260020b121580614af0575061016454614aea90600160a01b900460020b83615c98565b60020b15155b80614b14575061016454614b0e90600160a01b900460020b82615c98565b60020b15155b1561174e57604051633981390b60e11b815260040160405180910390fd5b6001600160a01b0381163b614b9f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610c79565b600080516020615d8e83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614bd783614f15565b600082511180614be45750805b1561336f576111f38383614f55565b600054610100900460ff16613db85760405162461bcd60e51b8152600401610c7990615ae8565b600054610100900460ff16614c415760405162461bcd60e51b8152600401610c7990615ae8565b8151614c549060fe9060208501906151fe565b50805161336f9060ff9060208401906151fe565b600054610100900460ff16614c8f5760405162461bcd60e51b8152600401610c7990615ae8565b61012d805460ff19169055565b61012d5460ff1661123a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c79565b6000614d3b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166150409092919063ffffffff16565b80519091501561336f5780806020019051810190614d59919061557e565b61336f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c79565b6000826001600160a01b0316846001600160a01b03161115614dd8579192915b6000614dfb856001600160a01b0316856001600160a01b0316600160601b613799565b9050614891614e1d8483614e0f8989615bd7565b6001600160a01b0316613799565b61504f565b6000826001600160a01b0316846001600160a01b03161115614e42579192915b6147ce614e1d83600160601b614e0f8888615bd7565b6000826001600160a01b0316846001600160a01b03161115614e78579192915b6001600160a01b038416614ec16fffffffffffffffffffffffffffffffff60601b606085901b16614ea98787615bd7565b6001600160a01b0316866001600160a01b0316613799565b6147ce9190615ba4565b6000826001600160a01b0316846001600160a01b03161115614eeb579192915b6147ce6001600160801b038316614f028686615bd7565b6001600160a01b0316600160601b613799565b614f1e81614b32565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b614fbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610c79565b600080846001600160a01b031684604051614fd8919061590d565b600060405180830381855af49150503d8060008114615013576040519150601f19603f3d011682016040523d82523d6000602084013e615018565b606091505b50915091506148918282604051806060016040528060278152602001615dae6027913961506a565b60606147ce8484600085615083565b806001600160801b038116811461506557600080fd5b919050565b60608315615079575081610d93565b610d93838361515e565b6060824710156150e45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c79565b600080866001600160a01b03168587604051615100919061590d565b60006040518083038185875af1925050503d806000811461513d576040519150601f19603f3d011682016040523d82523d6000602084013e615142565b606091505b509150915061515387838387615188565b979650505050505050565b81511561516e5781518083602001fd5b8060405162461bcd60e51b8152600401610c7991906159db565b606083156151f45782516151ed576001600160a01b0385163b6151ed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c79565b50816147ce565b6147ce838361515e565b82805461520a90615c42565b90600052602060002090601f01602090048101928261522c5760008555615272565b82601f1061524557805160ff1916838001178555615272565b82800160010185558215615272579182015b82811115615272578251825591602001919060010190615257565b506138b19291505b808211156138b1576000815560010161527a565b805161506581615d60565b60008083601f8401126152aa578182fd5b50813567ffffffffffffffff8111156152c1578182fd5b6020830191508360208285010111156152d957600080fd5b9250929050565b600082601f8301126152f0578081fd5b81356153036152fe82615b64565b615b33565b818152846020838601011115615317578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112615341578081fd5b815161534f6152fe82615b64565b818152846020838601011115615363578283fd5b6147ce826020830160208701615c16565b80516001600160801b038116811461506557600080fd5b60006020828403121561539c578081fd5b8135610d9381615d4b565b6000602082840312156153b8578081fd5b8151610d9381615d4b565b6000806000606084860312156153d7578182fd5b83516153e281615d4b565b602085015190935067ffffffffffffffff808211156153ff578384fd5b61540b87838801615331565b93506040860151915080821115615420578283fd5b5061542d86828701615331565b9150509250925092565b60008060408385031215615449578182fd5b823561545481615d4b565b9150602083013561546481615d4b565b809150509250929050565b600080600060608486031215615483578283fd5b833561548e81615d4b565b9250602084013561549e81615d4b565b929592945050506040919091013590565b600080604083850312156154c1578182fd5b82356154cc81615d4b565b9150602083013567ffffffffffffffff8111156154e7578182fd5b6154f3858286016152e0565b9150509250929050565b600080600060608486031215615511578081fd5b833561551c81615d4b565b9250602084013561552c81615d6e565b9150604084013567ffffffffffffffff811115615547578182fd5b61542d868287016152e0565b60008060408385031215615565578182fd5b823561557081615d4b565b946020939093013593505050565b60006020828403121561558f578081fd5b8151610d9381615d60565b6000806000606084860312156155ae578081fd5b83356155b981615d60565b92506020840135915060408401356155d081615d4b565b809150509250925092565b6000602082840312156155ec578081fd5b5051919050565b60008060408385031215615605578182fd5b823561561081615d6e565b9150602083013561546481615d6e565b60008060008060808587031215615635578182fd5b843561564081615d6e565b9350602085013561565081615d6e565b93969395505050506040820135916060013590565b60008060408385031215615677578182fd5b505080516020909101519092909150565b6000806000806060858703121561569d578182fd5b8435935060208501359250604085013567ffffffffffffffff8111156156c1578283fd5b6156cd87828801615299565b95989497509550505050565b600080600080600080600080610100898b0312156156f5578586fd5b6156fe89615374565b9750602089015180600f0b8114615713578687fd5b80975050604089015195506060890151945060808901518060060b8114615738578485fd5b60a08a015190945061574981615d4b565b60c08a015190935063ffffffff81168114615762578283fd5b915061577060e08a0161528e565b90509295985092959890939650565b60008060408385031215615791578182fd5b61579a83615374565b91506157a860208401615374565b90509250929050565b600080600080600060a086880312156157c8578283fd5b6157d186615374565b945060208601519350604086015192506157ed60608701615374565b91506157fb60808701615374565b90509295509295909350565b600080600080600080600060e0888a031215615821578081fd5b875161582c81615d4b565b602089015190975061583d81615d6e565b604089015190965061584e81615d7d565b606089015190955061585f81615d7d565b608089015190945061587081615d7d565b60a089015190935060ff81168114615886578182fd5b60c089015190925061589781615d60565b8091505092959891949750929550565b600080604083850312156158b9578182fd5b82356158c481615d7d565b9150602083013561546481615d7d565b6000602082840312156158e5578081fd5b5035919050565b600080604083850312156158fe578182fd5b50508035926020909101359150565b6000825161591f818460208701615c16565b9190910192915050565b6001600160a01b03949094168452600292830b6020850152910b60408301526001600160801b0316606082015260a06080820181905260009082015260c00190565b602080825282518282018190526000919060409081850190868401855b828110156159c057815180516001600160a01b0316855286810151878601528501518585015260609093019290850190600101615988565b5091979650505050505050565b60029190910b815260200190565b60208152600082518060208401526159fa816040850160208701615c16565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526022908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760408201526132b960f11b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715615b5c57615b5c615d35565b604052919050565b600067ffffffffffffffff821115615b7e57615b7e615d35565b50601f01601f191660200190565b60008219821115615b9f57615b9f615d09565b500190565b600082615bb357615bb3615d1f565b500490565b6000816000190483118215151615615bd257615bd2615d09565b500290565b60006001600160a01b0383811690831681811015615bf757615bf7615d09565b039392505050565b600082821015615c1157615c11615d09565b500390565b60005b83811015615c31578181015183820152602001615c19565b838111156111f35750506000910152565b600181811c90821680615c5657607f821691505b60208210811415615c7757634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615c9157615c91615d09565b5060010190565b60008260020b80615cab57615cab615d1f565b808360020b0791505092915050565b600082615cc957615cc9615d1f565b500690565b60008160020b627fffff19811415615ce857615ce8615d09565b9003919050565b6000600160ff1b821415615d0557615d05615d09565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e7757600080fd5b8015158114610e7757600080fd5b8060020b8114610e7757600080fd5b61ffff81168114610e7757600080fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220edc0a6288ce9835be103d58c9268043e83195ff0b2c1811557ce3c8ea9faef8364736f6c63430008040033

Deployed Bytecode

0x6080604052600436106103815760003560e01c806371908a03116101d1578063b670ed7d11610102578063d7e458b5116100a0578063f3d2350e1161006f578063f3d2350e14610a74578063f8c2e29b14610a94578063fa461e3314610aa9578063fd87f9aa14610ac957600080fd5b8063d7e458b514610a0a578063dd62ed3e14610a1f578063df28408a14610a3f578063f2fde38b14610a5457600080fd5b8063c653089f116100dc578063c653089f1461097a578063d0c93a7c146109a7578063d21220a7146109c9578063d3487997146109ea57600080fd5b8063b670ed7d1461091c578063c18d7e761461093c578063c45a01551461095357600080fd5b80639894f21a1161016f578063a457c2d711610149578063a457c2d7146108a5578063a9059cbb146108c5578063a9722cf3146108e5578063b1fbe9af1461090557600080fd5b80639894f21a1461082f5780639b1344ac1461086a578063a0712d681461088557600080fd5b806387788782116101ab57806387788782146107c85780639210b8f3146107e45780639403c1ae1461080557806395d89b411461081a57600080fd5b806371908a0314610769578063727dd2281461077e5780638456cb59146107b357600080fd5b80633d048c27116102b65780634fa62c5f1161025457806367b9a2861161022357806367b9a286146106f3578063708891651461070857806370a082311461071e578063715018a61461075457600080fd5b80634fa62c5f1461066f57806352d1902d1461068f5780635c975abb146106a4578063601b48a4146106bd57600080fd5b806342966c681161029057806342966c681461060757806342fb9d4414610627578063481c6a751461063e5780634f1ef2861461065c57600080fd5b80633d048c27146105b75780633f4ba83a146105d75780634043f5ca146105ec57600080fd5b8063195cd92c11610323578063313ce567116102fd578063313ce567146105395780633659cfe614610555578063365b98b214610577578063395093511461059757600080fd5b8063195cd92c1461049b57806323b872dd146104bb5780632958d031146104db57600080fd5b80630dfe16811161035f5780630dfe1681146104025780631322d9541461043b57806316f0115b1461046557806318160ddd1461048657600080fd5b8063065756db1461038657806306fdde03146103b0578063095ea7b3146103d2575b600080fd5b34801561039257600080fd5b5061039d6101605481565b6040519081526020015b60405180910390f35b3480156103bc57600080fd5b506103c5610ae9565b6040516103a791906159db565b3480156103de57600080fd5b506103f26103ed366004615553565b610b7b565b60405190151581526020016103a7565b34801561040e57600080fd5b5061016354610423906001600160a01b031681565b6040516001600160a01b0390911681526020016103a7565b34801561044757600080fd5b50610450610b93565b604080519283526020830191909152016103a7565b34801561047157600080fd5b5061016254610423906001600160a01b031681565b34801561049257600080fd5b5060fd5461039d565b3480156104a757600080fd5b506104506104b636600461559a565b610c3d565b3480156104c757600080fd5b506103f26104d636600461546f565b610d74565b3480156104e757600080fd5b5061051c6104f636600461538b565b6101696020526000908152604090208054600182015460029092015460ff909116919083565b6040805193151584526020840192909252908201526060016103a7565b34801561054557600080fd5b50604051601281526020016103a7565b34801561056157600080fd5b5061057561057036600461538b565b610d9a565b005b34801561058357600080fd5b506104236105923660046158d4565b610e7a565b3480156105a357600080fd5b506103f26105b2366004615553565b610ea5565b3480156105c357600080fd5b506105756105d23660046154fd565b610ec7565b3480156105e357600080fd5b506105756111f9565b3480156105f857600080fd5b50610168546103f29060ff1681565b34801561061357600080fd5b506104506106223660046158d4565b61123c565b34801561063357600080fd5b5061039d6101615481565b34801561064a57600080fd5b506097546001600160a01b0316610423565b61057561066a3660046154af565b611681565b34801561067b57600080fd5b5061057561068a3660046155f3565b611752565b34801561069b57600080fd5b5061039d611813565b3480156106b057600080fd5b5061012d5460ff166103f2565b3480156106c957600080fd5b5061015f546106e090600160301b900461ffff1681565b60405161ffff90911681526020016103a7565b3480156106ff57600080fd5b506105756118c6565b34801561071457600080fd5b506106e06103e881565b34801561072a57600080fd5b5061039d61073936600461538b565b6001600160a01b0316600090815260fb602052604090205490565b34801561076057600080fd5b50610575611ae9565b34801561077557600080fd5b50610450611b6c565b34801561078a57600080fd5b5061015f546107a0906301000000900460020b81565b60405160029190910b81526020016103a7565b3480156107bf57600080fd5b50610575611cfd565b3480156107d457600080fd5b5061016b546106e09061ffff1681565b3480156107f057600080fd5b5061016554610423906001600160a01b031681565b34801561081157600080fd5b50610575611d3e565b34801561082657600080fd5b506103c5611d9a565b34801561083b57600080fd5b5061084f61084a3660046158ec565b611da9565b604080519384526020840192909252908201526060016103a7565b34801561087657600080fd5b5061015f546107a09060020b81565b34801561089157600080fd5b506104506108a03660046158d4565b611f2a565b3480156108b157600080fd5b506103f26108c0366004615553565b61230d565b3480156108d157600080fd5b506103f26108e0366004615553565b612393565b3480156108f157600080fd5b50610168546103f290610100900460ff1681565b34801561091157600080fd5b5061039d6101665481565b34801561092857600080fd5b5061045061093736600461538b565b6123a1565b34801561094857600080fd5b5061039d6101675481565b34801561095f57600080fd5b5061016854610423906201000090046001600160a01b031681565b34801561098657600080fd5b5061099a6109953660046158ec565b612449565b6040516103a7919061596b565b3480156109b357600080fd5b50610164546107a090600160a01b900460020b81565b3480156109d557600080fd5b5061016454610423906001600160a01b031681565b3480156109f657600080fd5b50610575610a05366004615688565b612627565b348015610a1657600080fd5b5061057561268e565b348015610a2b57600080fd5b5061039d610a3a366004615437565b612732565b348015610a4b57600080fd5b5061039d61275d565b348015610a6057600080fd5b50610575610a6f36600461538b565b6127c2565b348015610a8057600080fd5b50610575610a8f3660046158a7565b6128be565b348015610aa057600080fd5b506106e0606481565b348015610ab557600080fd5b50610575610ac4366004615688565b6129b2565b348015610ad557600080fd5b50610450610ae4366004615620565b612a24565b606060fe8054610af890615c42565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2490615c42565b8015610b715780601f10610b4657610100808354040283529160200191610b71565b820191906000526020600020905b815481529060010190602001808311610b5457829003601f168201915b5050505050905090565b600033610b89818585612d2b565b5060019392505050565b60008060008061016260009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610be857600080fd5b505afa158015610bfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c209190615807565b505050505091509150610c338282612e4f565b9350935050509091565b60008033610c536097546001600160a01b031690565b6001600160a01b031614610c825760405162461bcd60e51b8152600401610c7990615aa6565b60405180910390fd5b61016254604051630251596160e31b81523060048201528615156024820152604481018690526001600160a01b03858116606483015260a06084830152600060a48301529091169063128acb089060c4016040805180830381600087803b158015610cec57600080fd5b505af1158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d249190615665565b6040805188151581526020810184905290810182905291935091507fbf511038cfa32cfb7971e976074c0e6aeda010e6afcbb38d87b4f910305014949060600160405180910390a1935093915050565b600033610d828582856130eb565b610d8d85858561315f565b60019150505b9392505050565b306001600160a01b037f000000000000000000000000ad1de7b91b332972d76f4fd7690d1dc47543b1c1161415610de35760405162461bcd60e51b8152600401610c7990615a0e565b7f000000000000000000000000ad1de7b91b332972d76f4fd7690d1dc47543b1c16001600160a01b0316610e2c600080516020615d8e833981519152546001600160a01b031690565b6001600160a01b031614610e525760405162461bcd60e51b8152600401610c7990615a5a565b610e5b8161330a565b60408051600080825260208201909252610e779183919061333c565b50565b61016a8181548110610e8b57600080fd5b6000918252602090912001546001600160a01b0316905081565b600033610b89818585610eb88383612732565b610ec29190615b8c565b612d2b565b600054610100900460ff1615808015610ee75750600054600160ff909116105b80610f015750303b158015610f01575060005460ff166001145b610f645760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c79565b6000805460ff191660011790558015610f87576000805461ff0019166101001790555b600080600084806020019051810190610fa091906153c3565b925092509250610fae6134bb565b610fb66134e2565b610fc08282613511565b610fc8613542565b61016280546001600160a01b0319166001600160a01b03891690811790915560408051630dfe168160e01b81529051630dfe168191600480820192602092909190829003018186803b15801561101d57600080fd5b505afa158015611031573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105591906153a7565b61016380546001600160a01b0319166001600160a01b03928316179055610162546040805163d21220a760e01b81529051919092169163d21220a7916004808301926020929190829003018186803b1580156110b057600080fd5b505afa1580156110c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e891906153a7565b61016480546001600160a01b039283166001600160b81b031990911617600160a01b62ffffff60028b900b1602179055610168805462010000600160b01b03191633620100000217905561016b805460fa61ffff19909116811790915561015f805467ffff00000000000019169055609780546001600160a01b03191692861692909217909155604080516000815260208101929092527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c11910160405180910390a150505080156111f3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b3361120c6097546001600160a01b031690565b6001600160a01b0316146112325760405162461bcd60e51b8152600401610c7990615aa6565b61123a613571565b565b6000806112476135c4565b61124f61361e565b8261126d576040516302075cc160e41b815260040160405180910390fd5b600061127860fd5490565b33600081815260fb60205260409020549192506112959086613665565b6101685460ff16156114c257610162546000906001600160a01b031663514ea4bf6112be61275d565b6040518263ffffffff1660e01b81526004016112dc91815260200190565b60a06040518083038186803b1580156112f457600080fd5b505afa158015611308573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132c91906157b1565b505050509050600061134887836001600160801b031686613799565b9050600061135582613848565b9050600080600080611366856138b5565b93509350935093506113788282613c49565b6113828282613cb3565b60408051838152602081018390529294509092507fb841b8f9713db8d7cd9269d4f7f396d88cd5be4ddacf7d38da5ce8e182c48b8b910160405180910390a161016054610163546040516370a0823160e01b8152306004820152611464929187916001600160a01b03909116906370a08231906024015b60206040518083038186803b15801561141157600080fd5b505afa158015611425573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144991906155db565b6114539190615bff565b61145d9190615bff565b8d8b613799565b61146e9085615b8c565b61016154610164546040516370a0823160e01b8152306004820152929d506114aa9286916001600160a01b0316906370a08231906024016113f9565b6114b49084615b8c565b9950505050505050506114ee565b6000806114cd610b93565b915091506114dc828886613799565b95506114e9818886613799565b945050505b6114f88484613d17565b6000806115058686613d33565b90925090507f4fde5dead35c5797dc8fe113e0d397a67df1fcc334818cd63aec8820d60db4576115358388615bff565b61153f8388615bff565b6040805192835260208301919091520160405180910390a185156115c157826115688882615bff565b33600090815261016960205260409020600101546115869190615bb8565b6115909190615ba4565b3360008181526101696020526040902060010191909155610163546115c1916001600160a01b039091169084613d55565b841561162b57826115d28882615bff565b33600090815261016960205260409020600201546115f09190615bb8565b6115fa9190615ba4565b33600081815261016960205260409020600201919091556101645461162b916001600160a01b039091169083613d55565b604080518881526020810184905290810182905233907f4c60206a5c1de41f3376d1d60f0949d96cb682033c90b1c2d9d9a62d4c4120c09060600160405180910390a25050505061167c6001606555565b915091565b306001600160a01b037f000000000000000000000000ad1de7b91b332972d76f4fd7690d1dc47543b1c11614156116ca5760405162461bcd60e51b8152600401610c7990615a0e565b7f000000000000000000000000ad1de7b91b332972d76f4fd7690d1dc47543b1c16001600160a01b0316611713600080516020615d8e833981519152546001600160a01b031690565b6001600160a01b0316146117395760405162461bcd60e51b8152600401610c7990615a5a565b6117428261330a565b61174e8282600161333c565b5050565b336117656097546001600160a01b031690565b6001600160a01b03161461178b5760405162461bcd60e51b8152600401610c7990615aa6565b60fd5415158061179e57506101685460ff165b156117bc57604051632a2c70bb60e11b815260040160405180910390fd5b6117c68282613dbf565b61016854610100900460ff1661174e57610168805461ff0019166101001790556040517f452a344f03203071e1daf66e007976c85cb2380deabf1c91f3c4fb1fca41204990600090a15050565b6000306001600160a01b037f000000000000000000000000ad1de7b91b332972d76f4fd7690d1dc47543b1c116146118b35760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610c79565b50600080516020615d8e83398151915290565b336118d96097546001600160a01b031690565b6001600160a01b0316146118ff5760405162461bcd60e51b8152600401610c7990615aa6565b610162546000906001600160a01b031663514ea4bf61191c61275d565b6040518263ffffffff1660e01b815260040161193a91815260200190565b60a06040518083038186803b15801561195257600080fd5b505afa158015611966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198a91906157b1565b5050505090506000816001600160801b03161115611a845761015f54600281810b9163010000009004900b60008080806119c3876138b5565b604080516001600160801b038d16815260028c810b60208301528b900b818301526060810186905260808101859052905194985092965090945092507f6d7e1841bf97c0b736eafb2779459ba1e0af2305cead28a8e97533589ceb2f65919081900360a00190a1611a348282613c49565b611a3e8282613cb3565b60408051838152602081018390529294509092507fb841b8f9713db8d7cd9269d4f7f396d88cd5be4ddacf7d38da5ce8e182c48b8b910160405180910390a15050505050505b61015f805463010000008104600290810b900b62ffffff1662ffffff19909116179055610168805460ff19169055604051600081527fd9279952b347fd14af9b788aff1029c0d3b1299b7dcce164fc602a1b958c48809060200160405180910390a150565b33611afc6097546001600160a01b031690565b6001600160a01b031614611b225760405162461bcd60e51b8152600401610c7990615aa6565b6097546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3609780546001600160a01b0319169055565b600080600061016260009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015611bc057600080fd5b505afa158015611bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf89190615807565b5050610162549395506000945084938493508392508291506001600160a01b031663514ea4bf611c2661275d565b6040518263ffffffff1660e01b8152600401611c4491815260200190565b60a06040518083038186803b158015611c5c57600080fd5b505afa158015611c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9491906157b1565b94509450945094509450816001600160801b0316611cb56001868989613e7c565b611cbf9190615b8c565b9750806001600160801b0316611cd86000858989613e7c565b611ce29190615b8c565b9650611cee8888613cb3565b90999098509650505050505050565b33611d106097546001600160a01b031690565b6001600160a01b031614611d365760405162461bcd60e51b8152600401610c7990615aa6565b61123a614278565b61016080546101618054600093849055929055908115611d765760975461016354611d76916001600160a01b03918216911684613d55565b801561174e576097546101645461174e916001600160a01b03918216911683613d55565b606060ff8054610af890615c42565b600080600061016860019054906101000a900460ff16611ddc57604051630314872760e11b815260040160405180910390fd5b6000611de760fd5490565b90508015611e0657611dfa8187876142b6565b91955093509150611f22565b6101625460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e0929190829003018186803b158015611e4c57600080fd5b505afa158015611e60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e849190615807565b50505050505090506000611ed082611eae61015f60009054906101000a900460020b60020b6143b9565b61015f54611ec99063010000009004600290810b900b6143b9565b8b8b6147d6565b61015f546001600160801b0382169550909150611f1a908390611ef990600290810b900b6143b9565b61015f54611f149063010000009004600290810b900b6143b9565b8461489a565b909650945050505b509250925092565b600080611f356135c4565b611f3d61361e565b61016854610100900460ff16611f6657604051630314872760e11b815260040160405180910390fd5b82611f845760405163199f5a0360e31b815260040160405180910390fd5b6000611f8f60fd5490565b610168546101625460408051633850c7bd60e01b8152905193945060ff909216926000926001600160a01b0390921691633850c7bd9160048083019260e0929190829003018186803b158015611fe457600080fd5b505afa158015611ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201c9190615807565b5050505050509050600083111561205d57600080612038610b93565b91509150612047828987614936565b9650612054818987614936565b955050506120c9565b81156120b05761015f546120a690829061207d90600290810b900b6143b9565b61015f546120989063010000009004600290810b900b6143b9565b6120a18a613848565b61489a565b90955093506120c9565b60405163344fa43b60e01b815260040160405180910390fd5b336000908152610169602052604090205460ff166121405733600081815261016960205260408120805460ff1916600190811790915561016a805491820181559091527f17da1ae71935bc1a620f4cc216c63f7b5576c3970bae66f4178d3166b99125440180546001600160a01b03191690911790555b841561218757336000908152610169602052604081206001018054879290612169908490615b8c565b909155505061016354612187906001600160a01b0316333088614984565b83156121ce573360009081526101696020526040812060020180548692906121b0908490615b8c565b9091555050610164546121ce906001600160a01b0316333087614984565b6121d833876149bc565b81156122bd5761015f5460009061221d9083906121fb90600290810b900b6143b9565b61015f546122169063010000009004600290810b900b6143b9565b89896147d6565b6101625461015f54604051633c8a7d8d60e01b81529293506001600160a01b0390911691633c8a7d8d91612268913091600281810b926301000000909204900b908790600401615929565b6040805180830381600087803b15801561228157600080fd5b505af1158015612295573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b99190615665565b5050505b604080518781526020810187905290810185905233907f5a3358a3d27a5373c0df2604662088d37894d56b7cfd27f315770440f4e0d9199060600160405180910390a250505061167c6001606555565b6000338161231b8286612732565b90508381101561237b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c79565b6123888286868403612d2b565b506001949350505050565b600033610b8981858561315f565b600080600061016260009054906101000a90046001600160a01b03166001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b1580156123f557600080fd5b505afa158015612409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061242d9190615807565b505050505091505061243f8482612e4f565b9250925050915091565b606082158015612457575081155b156124635761016a5491505b600061246f8484615bff565b67ffffffffffffffff81111561249557634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156124f357816020015b6124e0604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b8152602001906001900390816124b35790505b5090506000845b8481101561261d576000610169600061016a848154811061252b57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528281019390935260409182019020815160608082018452825460ff161515825260018301549482019490945260029091015481830152815192830190915261016a80549193508291859081106125aa57634e487b7160e01b600052603260045260246000fd5b600091825260209182902001546001600160a01b03168252838101519082015260408084015191015284846125de81615c7d565b9550815181106125fe57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050808061261590615c7d565b9150506124fa565b5090949350505050565b610162546001600160a01b0316331461265257604051620b7d9960e41b815260040160405180910390fd5b83156126705761016354612670906001600160a01b03163386613d55565b82156111f357610164546111f3906001600160a01b03163385613d55565b336126a16097546001600160a01b031690565b6001600160a01b0316146126c75760405162461bcd60e51b8152600401610c7990615aa6565b6000806126d460006138b5565b9350935050506126e48282613c49565b6126ee8282613cb3565b60408051838152602081018390529294509092507fb841b8f9713db8d7cd9269d4f7f396d88cd5be4ddacf7d38da5ce8e182c48b8b91015b60405180910390a15050565b6001600160a01b03918216600090815260fc6020908152604080832093909416825291909152205490565b61015f546040516bffffffffffffffffffffffff193060601b166020820152600282810b810b60e890811b60348401526301000000909304810b900b90911b6037820152600090603a0160405160208183030381529060405280519060200120905090565b336127d56097546001600160a01b031690565b6001600160a01b0316146127fb5760405162461bcd60e51b8152600401610c7990615aa6565b6001600160a01b0381166128625760405162461bcd60e51b815260206004820152602860248201527f4f776e61626c653a206e6577206d616e6167657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401610c79565b6097546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3609780546001600160a01b0319166001600160a01b0392909216919091179055565b336128d16097546001600160a01b031690565b6001600160a01b0316146128f75760405162461bcd60e51b8152600401610c7990615aa6565b606461ffff8316111561291d576040516313f90f0b60e31b815260040160405180910390fd5b6103e861ffff8216111561294457604051630f14508d60e41b815260040160405180910390fd5b61015f805467ffff0000000000001916600160301b61ffff8581169182029290921790925561016b805461ffff191691841691821790556040805192835260208301919091527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c119101612726565b610162546001600160a01b031633146129dd57604051620b7d9960e41b815260040160405180910390fd5b6000841315612a0357610163546129fe906001600160a01b03163386613d55565b6111f3565b60008313156111f357610164546111f3906001600160a01b03163385613d55565b60008033612a3a6097546001600160a01b031690565b6001600160a01b031614612a605760405162461bcd60e51b8152600401610c7990615aa6565b612a6a8686614a7d565b6101625460408051633850c7bd60e01b815290516000926001600160a01b031691633850c7bd9160048083019260e0929190829003018186803b158015612ab057600080fd5b505afa158015612ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae89190615807565b50505050505090506000612b0e82612b028a60020b6143b9565b6122168a60020b6143b9565b90506001600160801b03811615612cd05761016254604051633c8a7d8d60e01b815260009182916001600160a01b0390911690633c8a7d8d90612b5b9030908e908e908990600401615929565b6040805180830381600087803b158015612b7457600080fd5b505af1158015612b88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bac9190615665565b9092509050612bbb8289615bff565b9550612bc78188615bff565b61015f5490955060028b810b91810b900b141580612bf8575061015f5460028a810b6301000000909204810b900b14155b15612c725761015f805460028b810b62ffffff90811663010000000265ffffffffffff19909316918e900b16171790556040517f8e3ac6cc9b82795b40740ca4e954df8f6655fe35e80cdc6fb33d50c3423fcd1690612c69908c908c90600292830b8152910b602082015260400190565b60405180910390a15b604080516001600160801b038516815260028c810b60208301528b900b81830152606081018490526080810183905290517ffa715a0b1bc7287b5d3581c11478041b0455aad0c17361fc1e55fffbdd4b6c4f9181900360a00190a150505b6101685460ff16612d2057610168805460ff191660019081179091556040519081527fd9279952b347fd14af9b788aff1029c0d3b1299b7dcce164fc602a1b958c48809060200160405180910390a15b505094509492505050565b6001600160a01b038316612d8d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c79565b6001600160a01b038216612dee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c79565b6001600160a01b03838116600081815260fc602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b610162546000908190819081908190819081906001600160a01b031663514ea4bf612e7861275d565b6040518263ffffffff1660e01b8152600401612e9691815260200190565b60a06040518083038186803b158015612eae57600080fd5b505afa158015612ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee691906157b1565b94509450945094509450600080866001600160801b0316600014612f9a5761015f54612f3f908c90612f1e90600290810b900b6143b9565b61015f54612f399063010000009004600290810b900b6143b9565b8a61489a565b90995097506001600160801b038416612f5b6001888d8b613e7c565b612f659190615b8c565b9150826001600160801b0316612f7e6000878d8b613e7c565b612f889190615b8c565b9050612f948282613cb3565b90925090505b61016054610163546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015612fe257600080fd5b505afa158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a91906155db565b6130249084615b8c565b61302e9190615bff565b613038908a615b8c565b61016154610164546040516370a0823160e01b8152306004820152929b5090916001600160a01b03909116906370a082319060240160206040518083038186803b15801561308557600080fd5b505afa158015613099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130bd91906155db565b6130c79083615b8c565b6130d19190615bff565b6130db9089615b8c565b9750505050505050509250929050565b60006130f78484612732565b905060001981146111f357818110156131525760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610c79565b6111f38484848403612d2b565b6001600160a01b0383166131c35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610c79565b6001600160a01b0382166132255760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c79565b6001600160a01b038316600090815260fb60205260409020548181101561329d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c79565b6001600160a01b03808516600081815260fb602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906132fd9086815260200190565b60405180910390a36111f3565b610168546201000090046001600160a01b03163314610e7757604051631b1319e560e01b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156133745761336f83614b32565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156133ad57600080fd5b505afa9250505080156133dd575060408051601f3d908101601f191682019092526133da918101906155db565b60015b6134405760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610c79565b600080516020615d8e83398151915281146134af5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610c79565b5061336f838383614bce565b600054610100900460ff1661123a5760405162461bcd60e51b8152600401610c7990615ae8565b600054610100900460ff166135095760405162461bcd60e51b8152600401610c7990615ae8565b61123a614bf3565b600054610100900460ff166135385760405162461bcd60e51b8152600401610c7990615ae8565b61174e8282614c1a565b600054610100900460ff166135695760405162461bcd60e51b8152600401610c7990615ae8565b61123a614c68565b613579614c9c565b61012d805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600260655414156136175760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c79565b6002606555565b61012d5460ff161561123a5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610c79565b6001600160a01b0382166136c55760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610c79565b6001600160a01b038216600090815260fb6020526040902054818110156137395760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610c79565b6001600160a01b038316600081815260fb60209081526040808320868603905560fd80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6000808060001985870985870292508281108382030391505080600014156137d357600084116137c857600080fd5b508290049050610d93565b8084116137df57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b60006001600160801b038211156138b15760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b6064820152608401610c79565b5090565b61015f54610163546040516370a0823160e01b8152306004820152600092839283928392600281810b936301000000909204900b9184916001600160a01b0316906370a082319060240160206040518083038186803b15801561391757600080fd5b505afa15801561392b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061394f91906155db565b610164546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b15801561399957600080fd5b505afa1580156139ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139d191906155db565b6101625460405163a34123a760e01b8152600287810b600483015286900b60248201526001600160801b038c1660448201529192506001600160a01b03169063a34123a7906064016040805180830381600087803b158015613a3257600080fd5b505af1158015613a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a6a9190615665565b610162546040516309e3d67b60e31b8152306004820152600288810b602483015287900b60448201526001600160801b03606482018190526084820152929a509098506001600160a01b031690634f1eb3d89060a4016040805180830381600087803b158015613ad957600080fd5b505af1158015613aed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b11919061577f565b5050610163546040516370a0823160e01b8152306004820152899184916001600160a01b03909116906370a082319060240160206040518083038186803b158015613b5b57600080fd5b505afa158015613b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b9391906155db565b613b9d9190615bff565b613ba79190615bff565b610164546040516370a0823160e01b8152306004820152919750889183916001600160a01b0316906370a082319060240160206040518083038186803b158015613bf057600080fd5b505afa158015613c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c2891906155db565b613c329190615bff565b613c3c9190615bff565b9450505050509193509193565b61016b5461ffff16612710613c5e8285615bb8565b613c689190615ba4565b6101606000828254613c7a9190615b8c565b909155506127109050613c8d8284615bb8565b613c979190615ba4565b6101616000828254613ca99190615b8c565b9091555050505050565b61016b54600090819061ffff1681612710613cce8388615bb8565b613cd89190615ba4565b90506000612710613ce98488615bb8565b613cf39190615ba4565b9050613cff8288615bff565b9450613d0b8187615bff565b93505050509250929050565b61015f54600160301b900461ffff16612710613c5e8285615bb8565b61015f546000908190600160301b900461ffff1681612710613cce8388615bb8565b6040516001600160a01b03831660248201526044810182905261336f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614ce6565b6001606555565b613dc98282614a7d565b61015f8054600283810b62ffffff90811663010000000265ffffffffffff199093169186900b1617179055610168805460ff191660019081179091556040517fd9279952b347fd14af9b788aff1029c0d3b1299b7dcce164fc602a1b958c488091613e3991901515815260200190565b60405180910390a160408051600284810b825283900b60208201527f8e3ac6cc9b82795b40740ca4e954df8f6655fe35e80cdc6fb33d50c3423fcd169101612726565b60008060008087156140445761016260009054906101000a90046001600160a01b03166001600160a01b031663f30583996040518163ffffffff1660e01b815260040160206040518083038186803b158015613ed757600080fd5b505afa158015613eeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f0f91906155db565b6101625461015f5460405163f30dba9360e01b8152600291820b90910b60048201529192506001600160a01b03169063f30dba93906024016101006040518083038186803b158015613f6057600080fd5b505afa158015613f74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f9891906156d9565b50506101625461015f5460405163f30dba9360e01b8152959a506001600160a01b03909116965063f30dba939550613fe394630100000090910460020b935060040191506159cd9050565b6101006040518083038186803b158015613ffc57600080fd5b505afa158015614010573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061403491906156d9565b509397506141fa95505050505050565b61016260009054906101000a90046001600160a01b03166001600160a01b031663461413196040518163ffffffff1660e01b815260040160206040518083038186803b15801561409357600080fd5b505afa1580156140a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140cb91906155db565b6101625461015f5460405163f30dba9360e01b8152600291820b90910b60048201529192506001600160a01b03169063f30dba93906024016101006040518083038186803b15801561411c57600080fd5b505afa158015614130573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061415491906156d9565b50506101625461015f5460405163f30dba9360e01b8152949a506001600160a01b03909116965063f30dba93955061419e94506301000000900460020b9260040191506159cd9050565b6101006040518083038186803b1580156141b757600080fd5b505afa1580156141cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141ef91906156d9565b509297505050505050505b61015f54600090600290810b810b9088900b1261421857508261421d565b508281035b600061015f60039054906101000a900460020b60020b8860020b1215614244575082614249565b508282035b8183038190036142696001600160801b0389168b8303600160801b613799565b9b9a5050505050505050505050565b61428061361e565b61012d805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135a73390565b60008060008060006142c6610b93565b915091508160001480156142da5750600081115b156142f1576142ea868983613799565b9250614394565b801580156142ff5750600082115b1561430f576142ea878984613799565b8115801561431b575080155b156143395760405163f912977760e01b815260040160405180910390fd5b6000614346888a85613799565b90506000614355888b85613799565b9050811580614362575080155b1561438057604051630856e64360e21b815260040160405180910390fd5b80821061438d578061438f565b815b945050505b61439f83838a614936565b94506143ac83828a614936565b9350505093509350939050565b60008060008360020b126143d0578260020b6143dd565b8260020b6143dd90615cef565b90506143ec620d89e719615cce565b60020b8111156144225760405162461bcd60e51b81526020600482015260016024820152601560fa1b6044820152606401610c79565b60006001821661443657600160801b614448565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615614487576080614482826ffff97272373d413259a46990580e213a615bb8565b901c90505b60048216156144b15760806144ac826ffff2e50f5f656932ef12357cf3c7fdcc615bb8565b901c90505b60088216156144db5760806144d6826fffe5caca7e10e4e61c3624eaa0941cd0615bb8565b901c90505b6010821615614505576080614500826fffcb9843d60f6159c9db58835c926644615bb8565b901c90505b602082161561452f57608061452a826fff973b41fa98c081472e6896dfb254c0615bb8565b901c90505b6040821615614559576080614554826fff2ea16466c96a3843ec78b326b52861615bb8565b901c90505b608082161561458357608061457e826ffe5dee046a99a2a811c461f1969c3053615bb8565b901c90505b6101008216156145ae5760806145a9826ffcbe86c7900a88aedcffc83b479aa3a4615bb8565b901c90505b6102008216156145d95760806145d4826ff987a7253ac413176f2b074cf7815e54615bb8565b901c90505b6104008216156146045760806145ff826ff3392b0822b70005940c7a398e4b70f3615bb8565b901c90505b61080082161561462f57608061462a826fe7159475a2c29b7443b29c7fa6e889d9615bb8565b901c90505b61100082161561465a576080614655826fd097f3bdfd2022b8845ad8f792aa5825615bb8565b901c90505b612000821615614685576080614680826fa9f746462d870fdf8a65dc1f90e061e5615bb8565b901c90505b6140008216156146b05760806146ab826f70d869a156d2a1b890bb3df62baf32f7615bb8565b901c90505b6180008216156146db5760806146d6826f31be135f97d08fd981231505542fcfa6615bb8565b901c90505b62010000821615614707576080614702826f09aa508b5b7a84e1c677de54f3e99bc9615bb8565b901c90505b6202000082161561473257608061472d826e5d6af8dedb81196699c329225ee604615bb8565b901c90505b6204000082161561475c576080614757826d2216e584f5fa1ea926041bedfe98615bb8565b901c90505b6208000082161561478457608061477f826b048a170391f7dc42444e8fa2615bb8565b901c90505b60008460020b131561479f5761479c81600019615ba4565b90505b6147ae64010000000082615cba565b156147ba5760016147bd565b60005b6147ce9060ff16602083901c615b8c565b949350505050565b6000836001600160a01b0316856001600160a01b031611156147f6579293925b846001600160a01b0316866001600160a01b0316116148215761481a858585614db8565b9050614891565b836001600160a01b0316866001600160a01b03161015614883576000614848878686614db8565b90506000614857878986614e22565b9050806001600160801b0316826001600160801b031610614878578061487a565b815b92505050614891565b61488e858584614e22565b90505b95945050505050565b600080836001600160a01b0316856001600160a01b031611156148bb579293925b846001600160a01b0316866001600160a01b0316116148e6576148df858585614e58565b915061492d565b836001600160a01b0316866001600160a01b0316101561491f5761490b868585614e58565b9150614918858785614ecb565b905061492d565b61492a858585614ecb565b90505b94509492505050565b6000614943848484613799565b90506000828061496357634e487b7160e01b600052601260045260246000fd5b8486091115610d9357600019811061497a57600080fd5b8061489181615c7d565b6040516001600160a01b03808516602483015283166044820152606481018290526111f39085906323b872dd60e01b90608401613d81565b6001600160a01b038216614a125760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610c79565b8060fd6000828254614a249190615b8c565b90915550506001600160a01b038216600081815260fb60209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b620d89e719600283900b1280614aa45750614a9b620d89e719615cce565b60020b8160020b135b15614ac25760405163137b639d60e21b815260040160405180910390fd5b8060020b8260020b121580614af0575061016454614aea90600160a01b900460020b83615c98565b60020b15155b80614b14575061016454614b0e90600160a01b900460020b82615c98565b60020b15155b1561174e57604051633981390b60e11b815260040160405180910390fd5b6001600160a01b0381163b614b9f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610c79565b600080516020615d8e83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614bd783614f15565b600082511180614be45750805b1561336f576111f38383614f55565b600054610100900460ff16613db85760405162461bcd60e51b8152600401610c7990615ae8565b600054610100900460ff16614c415760405162461bcd60e51b8152600401610c7990615ae8565b8151614c549060fe9060208501906151fe565b50805161336f9060ff9060208401906151fe565b600054610100900460ff16614c8f5760405162461bcd60e51b8152600401610c7990615ae8565b61012d805460ff19169055565b61012d5460ff1661123a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c79565b6000614d3b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166150409092919063ffffffff16565b80519091501561336f5780806020019051810190614d59919061557e565b61336f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610c79565b6000826001600160a01b0316846001600160a01b03161115614dd8579192915b6000614dfb856001600160a01b0316856001600160a01b0316600160601b613799565b9050614891614e1d8483614e0f8989615bd7565b6001600160a01b0316613799565b61504f565b6000826001600160a01b0316846001600160a01b03161115614e42579192915b6147ce614e1d83600160601b614e0f8888615bd7565b6000826001600160a01b0316846001600160a01b03161115614e78579192915b6001600160a01b038416614ec16fffffffffffffffffffffffffffffffff60601b606085901b16614ea98787615bd7565b6001600160a01b0316866001600160a01b0316613799565b6147ce9190615ba4565b6000826001600160a01b0316846001600160a01b03161115614eeb579192915b6147ce6001600160801b038316614f028686615bd7565b6001600160a01b0316600160601b613799565b614f1e81614b32565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b614fbd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610c79565b600080846001600160a01b031684604051614fd8919061590d565b600060405180830381855af49150503d8060008114615013576040519150601f19603f3d011682016040523d82523d6000602084013e615018565b606091505b50915091506148918282604051806060016040528060278152602001615dae6027913961506a565b60606147ce8484600085615083565b806001600160801b038116811461506557600080fd5b919050565b60608315615079575081610d93565b610d93838361515e565b6060824710156150e45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610c79565b600080866001600160a01b03168587604051615100919061590d565b60006040518083038185875af1925050503d806000811461513d576040519150601f19603f3d011682016040523d82523d6000602084013e615142565b606091505b509150915061515387838387615188565b979650505050505050565b81511561516e5781518083602001fd5b8060405162461bcd60e51b8152600401610c7991906159db565b606083156151f45782516151ed576001600160a01b0385163b6151ed5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c79565b50816147ce565b6147ce838361515e565b82805461520a90615c42565b90600052602060002090601f01602090048101928261522c5760008555615272565b82601f1061524557805160ff1916838001178555615272565b82800160010185558215615272579182015b82811115615272578251825591602001919060010190615257565b506138b19291505b808211156138b1576000815560010161527a565b805161506581615d60565b60008083601f8401126152aa578182fd5b50813567ffffffffffffffff8111156152c1578182fd5b6020830191508360208285010111156152d957600080fd5b9250929050565b600082601f8301126152f0578081fd5b81356153036152fe82615b64565b615b33565b818152846020838601011115615317578283fd5b816020850160208301379081016020019190915292915050565b600082601f830112615341578081fd5b815161534f6152fe82615b64565b818152846020838601011115615363578283fd5b6147ce826020830160208701615c16565b80516001600160801b038116811461506557600080fd5b60006020828403121561539c578081fd5b8135610d9381615d4b565b6000602082840312156153b8578081fd5b8151610d9381615d4b565b6000806000606084860312156153d7578182fd5b83516153e281615d4b565b602085015190935067ffffffffffffffff808211156153ff578384fd5b61540b87838801615331565b93506040860151915080821115615420578283fd5b5061542d86828701615331565b9150509250925092565b60008060408385031215615449578182fd5b823561545481615d4b565b9150602083013561546481615d4b565b809150509250929050565b600080600060608486031215615483578283fd5b833561548e81615d4b565b9250602084013561549e81615d4b565b929592945050506040919091013590565b600080604083850312156154c1578182fd5b82356154cc81615d4b565b9150602083013567ffffffffffffffff8111156154e7578182fd5b6154f3858286016152e0565b9150509250929050565b600080600060608486031215615511578081fd5b833561551c81615d4b565b9250602084013561552c81615d6e565b9150604084013567ffffffffffffffff811115615547578182fd5b61542d868287016152e0565b60008060408385031215615565578182fd5b823561557081615d4b565b946020939093013593505050565b60006020828403121561558f578081fd5b8151610d9381615d60565b6000806000606084860312156155ae578081fd5b83356155b981615d60565b92506020840135915060408401356155d081615d4b565b809150509250925092565b6000602082840312156155ec578081fd5b5051919050565b60008060408385031215615605578182fd5b823561561081615d6e565b9150602083013561546481615d6e565b60008060008060808587031215615635578182fd5b843561564081615d6e565b9350602085013561565081615d6e565b93969395505050506040820135916060013590565b60008060408385031215615677578182fd5b505080516020909101519092909150565b6000806000806060858703121561569d578182fd5b8435935060208501359250604085013567ffffffffffffffff8111156156c1578283fd5b6156cd87828801615299565b95989497509550505050565b600080600080600080600080610100898b0312156156f5578586fd5b6156fe89615374565b9750602089015180600f0b8114615713578687fd5b80975050604089015195506060890151945060808901518060060b8114615738578485fd5b60a08a015190945061574981615d4b565b60c08a015190935063ffffffff81168114615762578283fd5b915061577060e08a0161528e565b90509295985092959890939650565b60008060408385031215615791578182fd5b61579a83615374565b91506157a860208401615374565b90509250929050565b600080600080600060a086880312156157c8578283fd5b6157d186615374565b945060208601519350604086015192506157ed60608701615374565b91506157fb60808701615374565b90509295509295909350565b600080600080600080600060e0888a031215615821578081fd5b875161582c81615d4b565b602089015190975061583d81615d6e565b604089015190965061584e81615d7d565b606089015190955061585f81615d7d565b608089015190945061587081615d7d565b60a089015190935060ff81168114615886578182fd5b60c089015190925061589781615d60565b8091505092959891949750929550565b600080604083850312156158b9578182fd5b82356158c481615d7d565b9150602083013561546481615d7d565b6000602082840312156158e5578081fd5b5035919050565b600080604083850312156158fe578182fd5b50508035926020909101359150565b6000825161591f818460208701615c16565b9190910192915050565b6001600160a01b03949094168452600292830b6020850152910b60408301526001600160801b0316606082015260a06080820181905260009082015260c00190565b602080825282518282018190526000919060409081850190868401855b828110156159c057815180516001600160a01b0316855286810151878601528501518585015260609093019290850190600101615988565b5091979650505050505050565b60029190910b815260200190565b60208152600082518060208401526159fa816040850160208701615c16565b601f01601f19169190910160400192915050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526022908201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206d616e616760408201526132b960f11b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715615b5c57615b5c615d35565b604052919050565b600067ffffffffffffffff821115615b7e57615b7e615d35565b50601f01601f191660200190565b60008219821115615b9f57615b9f615d09565b500190565b600082615bb357615bb3615d1f565b500490565b6000816000190483118215151615615bd257615bd2615d09565b500290565b60006001600160a01b0383811690831681811015615bf757615bf7615d09565b039392505050565b600082821015615c1157615c11615d09565b500390565b60005b83811015615c31578181015183820152602001615c19565b838111156111f35750506000910152565b600181811c90821680615c5657607f821691505b60208210811415615c7757634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615c9157615c91615d09565b5060010190565b60008260020b80615cab57615cab615d1f565b808360020b0791505092915050565b600082615cc957615cc9615d1f565b500690565b60008160020b627fffff19811415615ce857615ce8615d09565b9003919050565b6000600160ff1b821415615d0557615d05615d09565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610e7757600080fd5b8015158114610e7757600080fd5b8060020b8114610e7757600080fd5b61ffff81168114610e7757600080fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220edc0a6288ce9835be103d58c9268043e83195ff0b2c1811557ce3c8ea9faef8364736f6c63430008040033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.