HYPE Price: $36.47 (+6.69%)
 

Overview

HYPE Balance

HyperEVM LogoHyperEVM LogoHyperEVM Logo0 HYPE

HYPE Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Assistant

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 100000 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Interfaces
import {IQuoter} from "./interfaces/IQuoter.sol";
import {IVault} from "core/interfaces/IVault.sol";
import {IOracle} from "core/interfaces/IOracle.sol";
import {IUniswapV3Pool} from "v3-core/interfaces/IUniswapV3Pool.sol";

// Contracts and libraries
import {SirStructs} from "core/libraries/SirStructs.sol";
import {SystemConstants} from "core/libraries/SystemConstants.sol";
import {FullMath} from "core/libraries/FullMath.sol";
import {IERC20} from "core/interfaces/IWETH9.sol";
import {UniswapPoolAddress} from "core/libraries/UniswapPoolAddress.sol";
import {AddressClone} from "core/libraries/AddressClone.sol";
import {TickMath} from "v3-core/libraries/TickMath.sol";

/**
 * @notice Helper functions for SIR protocol
 */
contract Assistant {
    IVault public immutable VAULT;
    IOracle private immutable SIR_ORACLE;
    address private immutable UNISWAPV3_FACTORY;
    IQuoter private immutable UNISWAPV3_QUOTER;

    error VaultDoesNotExist();
    error AmountTooLow();
    error TooMuchCollateral();
    error TEAMaxSupplyExceeded();

    enum VaultStatus {
        InvalidVault,
        NoUniswapPool,
        VaultCanBeCreated,
        VaultAlreadyExists
    }

    constructor(address vault, address oracle, address uniswapV3Factory) {
        VAULT = IVault(vault);
        SIR_ORACLE = IOracle(oracle);
        UNISWAPV3_FACTORY = uniswapV3Factory;

        if (block.chainid == 999) UNISWAPV3_QUOTER = IQuoter(0xe57Aff86A500849F66BaA948C6C69c2A5E9951dF);
        else if (block.chainid == 998) UNISWAPV3_QUOTER = IQuoter(0x7F3856d63E74516EF142A51c7445fBBc373fed5a);
        else revert("Network not supported. Use chain 998 (testnet) or 999 (mainnet)");
    }

    /**
     *  @notice It returns the reserves of the vaults specified in vaultIds
     */
    function getReserves(uint48[] calldata vaultIds) external view returns (SirStructs.Reserves[] memory reserves) {
        reserves = new SirStructs.Reserves[](vaultIds.length);
        SirStructs.VaultParameters memory vaultParams;
        for (uint256 i = 0; i < vaultIds.length; i++) {
            vaultParams = VAULT.paramsById(vaultIds[i]);
            reserves[i] = VAULT.getReserves(vaultParams);
        }
    }

    /**
     *  @notice It returns the balances of the user in vaults [offset + 1, offset + numVaults].
     *  @param user The address of the user.
     *  @param offset The offset of the vaults.
     *  @param numVaults The number of vaults.
     */
    function getUserBalances(
        address user,
        uint offset,
        uint numVaults
    )
        external
        view
        returns (uint256[] memory apeBalances, uint256[] memory teaBalances, uint80[] memory unclaimedSirRewards)
    {
        IERC20 ape;
        apeBalances = new uint256[](numVaults);
        teaBalances = new uint256[](numVaults);
        unclaimedSirRewards = new uint80[](numVaults);
        for (uint256 vaultId = offset + 1; vaultId <= offset + numVaults; vaultId++) {
            ape = IERC20(AddressClone.getAddress(address(VAULT), vaultId));
            apeBalances[vaultId - offset - 1] = ape.balanceOf(user);
            teaBalances[vaultId - offset - 1] = VAULT.balanceOf(user, vaultId);
            unclaimedSirRewards[vaultId - offset - 1] = VAULT.unclaimedRewards(vaultId, user);
        }
    }

    /**
     * @notice It returns the ideal price of TEA.
     * To get the price as [units of Collateral][per unit of TEA], divide num by den.
     */
    function priceOfTEA(
        SirStructs.VaultParameters calldata vaultParams
    ) external view returns (uint256 num, uint256 den) {
        // Get current reserves
        SirStructs.Reserves memory reserves = VAULT.getReserves(vaultParams);
        num = reserves.reserveLPers;

        // Get supply of TEA
        SirStructs.VaultState memory vaultState = VAULT.vaultStates(vaultParams);
        den = VAULT.totalSupply(vaultState.vaultId);
    }

    /**
     * @notice It returns the price of the APE token.
     * To get the price as [units of Collateral][per unit of APE], divide num by den.
     */
    function priceOfAPE(
        SirStructs.VaultParameters calldata vaultParams
    ) external view returns (uint256 num, uint256 den) {
        // Get current reserves
        SirStructs.Reserves memory reserves = VAULT.getReserves(vaultParams);

        // Get system parameters
        SirStructs.SystemParameters memory systemParams = VAULT.systemParams();

        // Substract fees
        num = _feeAPE(reserves.reserveApes, systemParams.baseFee.fee, vaultParams.leverageTier);

        // Get supply of APE
        SirStructs.VaultState memory vaultState = VAULT.vaultStates(vaultParams);
        den = IERC20(getAddressAPE(vaultState.vaultId)).totalSupply();
    }

    /**
     * @notice It returns the status of the vault.
     * 0: InvalidVault - returned when the ERC20 tokens are not valid.
     * 1: NoUniswapPool - returned when no Uniswap pool of the two tokens does not exist.
     * 2: VaultCanBeCreated - vault does not exist and it can be created.
     * 3: VaultAlreadyExists - vault already exists.
     */
    function getVaultStatus(SirStructs.VaultParameters calldata vaultParams) external view returns (VaultStatus) {
        // Check if the token addresses are a smart contract
        if (vaultParams.collateralToken.code.length == 0) return VaultStatus.InvalidVault;
        if (vaultParams.debtToken.code.length == 0) return VaultStatus.InvalidVault;

        // Check if the token returns total supply
        (bool success, ) = vaultParams.collateralToken.staticcall(abi.encodeWithSelector(IERC20.totalSupply.selector));
        if (!success) return VaultStatus.InvalidVault;
        (success, ) = vaultParams.debtToken.staticcall(abi.encodeWithSelector(IERC20.totalSupply.selector));
        if (!success) return VaultStatus.InvalidVault;

        // Check if the leverage tier is valid
        if (
            vaultParams.leverageTier < SystemConstants.MIN_LEVERAGE_TIER ||
            vaultParams.leverageTier > SystemConstants.MAX_LEVERAGE_TIER
        ) return VaultStatus.InvalidVault;

        // Check if a Uniswap pool exists
        if (
            !_checkFeeTierExists(vaultParams, 100) &&
            !_checkFeeTierExists(vaultParams, 500) &&
            !_checkFeeTierExists(vaultParams, 3000) &&
            !_checkFeeTierExists(vaultParams, 10000)
        ) return VaultStatus.NoUniswapPool;

        // Check if vault already exists
        SirStructs.VaultState memory vaultState = VAULT.vaultStates(vaultParams);
        if (vaultState.vaultId == 0) return VaultStatus.VaultCanBeCreated;
        return VaultStatus.VaultAlreadyExists;
    }

    function getAddressAPE(uint48 vaultId) public view returns (address) {
        return AddressClone.getAddress(address(VAULT), vaultId);
    }

    /*////////////////////////////////////////////////////////////////
                            QUOTE FUNCTIONS
    ////////////////////////////////////////////////////////////////*/

    /**
     * @notice It returns the amount of TEA/APE tokens that would be obtained by depositing collateral token.
     * @dev If quoteMint reverts, mint will revert as well; vice versa is not necessarily true.
     * @return amountTokens that would be obtained by depositing amountCollateral.
     */
    function quoteMint(
        bool isAPE,
        SirStructs.VaultParameters calldata vaultParams,
        uint144 amountCollateral
    ) public view returns (uint256 amountTokens) {
        // Get vault state
        SirStructs.VaultState memory vaultState = VAULT.vaultStates(vaultParams);
        if (vaultState.vaultId == 0) revert VaultDoesNotExist();
        if (amountCollateral == 0) revert AmountTooLow();

        // Get current reserves
        SirStructs.Reserves memory reserves = VAULT.getReserves(vaultParams);

        SirStructs.SystemParameters memory systemParams = VAULT.systemParams();
        if (isAPE) {
            // Compute how much collateral actually gets deposited
            uint256 collateralIn = _feeAPE(amountCollateral, systemParams.baseFee.fee, vaultParams.leverageTier);

            // Get supply of APE
            address ape = getAddressAPE(vaultState.vaultId);
            uint256 supplyAPE = IERC20(ape).totalSupply();

            // Calculate tokens
            amountTokens = supplyAPE == 0
                ? collateralIn + reserves.reserveApes
                : FullMath.mulDiv(supplyAPE, collateralIn, reserves.reserveApes);
        } else {
            // Get collateralIn
            uint256 collateralIn = _feeMintTEA(amountCollateral, systemParams.lpFee.fee);

            // Get supply of TEA
            uint256 supplyTEA = VAULT.totalSupply(vaultState.vaultId);

            // Calculate tokens
            amountTokens = supplyTEA == 0
                ? _amountFirstMint(vaultParams.collateralToken, amountCollateral + reserves.reserveLPers)
                : FullMath.mulDiv(supplyTEA, amountCollateral, reserves.reserveLPers);

            // Check that total supply does not overflow
            if (amountTokens > SystemConstants.TEA_MAX_SUPPLY - supplyTEA) revert TEAMaxSupplyExceeded();

            // Minter's share of TEA
            amountTokens = FullMath.mulDiv(
                amountTokens,
                collateralIn,
                supplyTEA == 0
                    ? amountCollateral + reserves.reserveLPers // In the first mint, reserveLPers contains orphaned fees from apes
                    : amountCollateral
            );
        }

        if (amountTokens == 0) revert AmountTooLow();
    }

    /**
     * @notice It returns the amount of TEA/APE tokens that would be obtained by depositing debt token
     * @dev If quoteMint reverts, mint will revert as well; vice versa is not necessarily true.
     * @return amountTokens that would be obtained.
     */
    function quoteMintWithDebtToken(
        bool isAPE,
        SirStructs.VaultParameters calldata vaultParams,
        uint256 amountDebtToken
    ) external view returns (uint256 amountTokens, uint256 amountCollateral, uint256 amountCollateralIdeal) {
        if (amountDebtToken == 0) revert AmountTooLow();

        // Get fee tier
        uint24 feeTier = SIR_ORACLE.uniswapFeeTierOf(vaultParams.debtToken, vaultParams.collateralToken);

        // Quote Uniswap v3
        (amountCollateral, , , ) = UNISWAPV3_QUOTER.quoteExactInputSingle(
            IQuoter.QuoteExactInputSingleParams({
                tokenIn: vaultParams.debtToken,
                tokenOut: vaultParams.collateralToken,
                amountIn: amountDebtToken,
                fee: feeTier,
                sqrtPriceLimitX96: 0
            })
        );

        // Check that amountCollateral does not overflow
        if (amountCollateral > type(uint144).max) revert TooMuchCollateral();

        // Calculate ideal collateral amount using instant pool price (no slippage)
        // Get Uniswap pool
        address uniswapPool = SIR_ORACLE.uniswapFeeTierAddressOf(vaultParams.debtToken, vaultParams.collateralToken);

        // Get current price
        (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(uniswapPool).slot0();

        // Calculate price fraction with better precision if it doesn't overflow when multiplied by itself
        bool inverse = vaultParams.collateralToken == IUniswapV3Pool(uniswapPool).token1();
        if (sqrtPriceX96 <= type(uint128).max) {
            uint256 priceX192 = uint256(sqrtPriceX96) * sqrtPriceX96;
            amountCollateralIdeal = inverse
                ? FullMath.mulDiv(priceX192, amountDebtToken, 1 << 192)
                : FullMath.mulDiv(1 << 192, amountDebtToken, priceX192);
        } else {
            uint256 priceX128 = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, 1 << 64);
            amountCollateralIdeal = inverse
                ? FullMath.mulDiv(priceX128, amountDebtToken, 1 << 128)
                : FullMath.mulDiv(1 << 128, amountDebtToken, priceX128);
        }

        // Given that we know how much collateral we will get from Uniswap, we can now use the quoteMint function
        amountTokens = quoteMint(isAPE, vaultParams, uint144(amountCollateral));
    }

    function quoteCollateralToDebtToken(
        address debtToken,
        address collateralToken,
        uint256 amountCollateral
    ) external view returns (uint256 amountDebtToken) {
        // Get Uniswap pool
        address uniswapPool = SIR_ORACLE.uniswapFeeTierAddressOf(debtToken, collateralToken);

        // Get current price
        (uint160 sqrtPriceX96, , , , , , ) = IUniswapV3Pool(uniswapPool).slot0();

        // Calculate price fraction with better precision if it doesn't overflow when multiplied by itself
        bool inverse = collateralToken == IUniswapV3Pool(uniswapPool).token1();
        if (sqrtPriceX96 <= type(uint128).max) {
            uint256 priceX192 = uint256(sqrtPriceX96) * sqrtPriceX96;
            return
                !inverse
                    ? FullMath.mulDiv(priceX192, amountCollateral, 1 << 192)
                    : FullMath.mulDiv(1 << 192, amountCollateral, priceX192);
        } else {
            uint256 priceX128 = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, 1 << 64);
            return
                !inverse
                    ? FullMath.mulDiv(priceX128, amountCollateral, 1 << 128)
                    : FullMath.mulDiv(1 << 128, amountCollateral, priceX128);
        }
    }

    /**
     * @notice If quoteBurn reverts, burn in Vault.sol will revert as well; vice versa is not necessarily true.
     * @return amountCollateral that would be obtained by burning amountTokens.
     * @return amountDebtToken the equivalent amount in debt token using Oracle TWAP price.
     */
    function quoteBurn(
        bool isAPE,
        SirStructs.VaultParameters calldata vaultParams,
        uint256 amountTokens
    ) external view returns (uint144 amountCollateral, uint256 amountDebtToken) {
        // Get vault state
        SirStructs.VaultState memory vaultState = VAULT.vaultStates(vaultParams);
        if (vaultState.vaultId == 0) revert VaultDoesNotExist();
        if (amountTokens == 0) revert AmountTooLow();

        // Get current reserves
        SirStructs.Reserves memory reserves = VAULT.getReserves(vaultParams);

        if (isAPE) {
            // Get supply of APE
            address ape = getAddressAPE(vaultState.vaultId);
            uint256 supplyAPE = IERC20(ape).totalSupply();

            // Get collateralOut
            uint144 collateralOut = uint144(FullMath.mulDiv(reserves.reserveApes, amountTokens, supplyAPE));

            // Get system parameters
            SirStructs.SystemParameters memory systemParams = VAULT.systemParams();

            // Get collateral withdrawn
            amountCollateral = _feeAPE(collateralOut, systemParams.baseFee.fee, vaultParams.leverageTier);
        } else {
            // Get supply of TEA
            uint256 supplyTEA = VAULT.totalSupply(vaultState.vaultId);

            // Get amount of collateral that would be withdrawn
            amountCollateral = uint144(FullMath.mulDiv(reserves.reserveLPers, amountTokens, supplyTEA));
        }

        // Convert collateral amount to debt token amount using Oracle TWAP
        amountDebtToken = _convertCollateralToDebtTokenUsingTWAP(
            vaultParams.collateralToken,
            vaultParams.debtToken,
            amountCollateral
        );
    }

    /**
     * @notice Converts collateral amount to debt token amount using the Oracle's TWAP price.
     * @dev This uses the same TWAP price calculation as the Oracle contract for consistency.
     * @param collateralToken The collateral token address.
     * @param debtToken The debt token address.
     * @param amountCollateral The amount of collateral to convert.
     * @return amountDebtToken The equivalent amount in debt tokens.
     */
    function _convertCollateralToDebtTokenUsingTWAP(
        address collateralToken,
        address debtToken,
        uint256 amountCollateral
    ) private view returns (uint256 amountDebtToken) {
        // Get the pool address from Oracle
        address poolAddress = SIR_ORACLE.uniswapFeeTierAddressOf(collateralToken, debtToken);

        IUniswapV3Pool pool = IUniswapV3Pool(poolAddress);

        // Get TWAP observation data similar to Oracle
        uint32[] memory secondsAgos = new uint32[](2);
        secondsAgos[0] = 1800; // 30 minutes (TWAP_DURATION from Oracle)
        secondsAgos[1] = 0;

        int56[] memory tickCumulatives;

        try pool.observe(secondsAgos) returns (int56[] memory tickCumulatives_, uint160[] memory) {
            tickCumulatives = tickCumulatives_;
        } catch {
            // If 30-minute TWAP not available, try to get the oldest available observation
            // This mimics Oracle's fallback behavior
            (, , uint16 observationIndex, uint16 observationCardinality, , , ) = pool.slot0();

            if (observationCardinality > 1) {
                // Get oldest observation
                uint32 oldestObservationSeconds;
                int56 oldestTickCumulative;
                bool initialized;

                // Try to get the oldest initialized observation
                uint16 oldestIndex = (observationIndex + 1) % observationCardinality;
                (oldestObservationSeconds, oldestTickCumulative, , initialized) = pool.observations(oldestIndex);

                if (!initialized) {
                    // Fallback to index 0 which is always initialized
                    (oldestObservationSeconds, oldestTickCumulative, , ) = pool.observations(0);
                }

                // Calculate time difference
                uint32 timeElapsed = uint32(block.timestamp) - oldestObservationSeconds;

                if (timeElapsed > 0) {
                    // Get current observation
                    secondsAgos[0] = timeElapsed;
                    tickCumulatives = new int56[](2);
                    (tickCumulatives, ) = pool.observe(secondsAgos);
                } else {
                    // Use spot price if no TWAP available
                    (, int24 currentTick, , , , , ) = pool.slot0();
                    tickCumulatives = new int56[](2);
                    tickCumulatives[0] = currentTick;
                    tickCumulatives[1] = currentTick;
                    secondsAgos[0] = 1; // Avoid division by zero
                }
            } else {
                // Use spot price if cardinality is 1
                (, int24 currentTick, , , , , ) = pool.slot0();
                tickCumulatives = new int56[](2);
                tickCumulatives[0] = currentTick;
                tickCumulatives[1] = currentTick;
                secondsAgos[0] = 1; // Avoid division by zero
            }
        }

        // Calculate average tick over the period
        int24 arithmeticMeanTick = int24((tickCumulatives[1] - tickCumulatives[0]) / int56(uint56(secondsAgos[0])));

        // Convert tick to price
        // The price is in terms of token1/token0 in the pool
        bool collateralIsToken0 = collateralToken < debtToken;

        // Calculate sqrt price from tick
        uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(arithmeticMeanTick);

        // Calculate the amount of debt tokens
        // Price calculation depends on token order in the pool
        if (collateralIsToken0) {
            // collateral is token0, debt is token1
            // Price is debt/collateral (token1/token0)
            // amountDebtToken = amountCollateral * price
            if (sqrtPriceX96 <= type(uint128).max) {
                uint256 priceX192 = uint256(sqrtPriceX96) * sqrtPriceX96;
                amountDebtToken = FullMath.mulDiv(amountCollateral, priceX192, 1 << 192);
            } else {
                uint256 priceX128 = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, 1 << 64);
                amountDebtToken = FullMath.mulDiv(amountCollateral, priceX128, 1 << 128);
            }
        } else {
            // collateral is token1, debt is token0
            // Price is still token1/token0, but we need debt/collateral
            // So we need to invert: amountDebtToken = amountCollateral / price
            if (sqrtPriceX96 <= type(uint128).max) {
                uint256 priceX192 = uint256(sqrtPriceX96) * sqrtPriceX96;
                amountDebtToken = FullMath.mulDiv(amountCollateral, 1 << 192, priceX192);
            } else {
                uint256 priceX128 = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, 1 << 64);
                amountDebtToken = FullMath.mulDiv(amountCollateral, 1 << 128, priceX128);
            }
        }
    }

    /*////////////////////////////////////////////////////////////////
                            PRIVATE FUNCTIONS
    ////////////////////////////////////////////////////////////////*/

    function _feeAPE(
        uint144 collateralDepositedOrOut,
        uint16 baseFee,
        int256 leverageTier
    ) private pure returns (uint144 collateralInOrWithdrawn) {
        unchecked {
            uint256 feeNum;
            uint256 feeDen;
            if (leverageTier >= 0) {
                feeNum = 10000; // baseFee is uint16, leverageTier is int8, so feeNum does not require more than 24 bits
                feeDen = 10000 + (uint256(baseFee) << uint256(leverageTier));
            } else {
                uint256 temp = 10000 << uint256(-leverageTier);
                feeNum = temp;
                feeDen = temp + uint256(baseFee);
            }

            collateralInOrWithdrawn = uint144((uint256(collateralDepositedOrOut) * feeNum) / feeDen);
        }
    }

    function _feeMintTEA(uint144 collateralDeposited, uint16 lpFee) private pure returns (uint144 collateralIn) {
        unchecked {
            uint256 feeNum = 10000;
            uint256 feeDen = 10000 + uint256(lpFee);

            collateralIn = uint144((uint256(collateralDeposited) * feeNum) / feeDen);
        }
    }

    function _checkFeeTierExists(
        SirStructs.VaultParameters calldata vaultParams,
        uint24 feeTier
    ) private view returns (bool) {
        address poolAddress = UniswapPoolAddress.computeAddress(
            UNISWAPV3_FACTORY,
            UniswapPoolAddress.getPoolKey(vaultParams.collateralToken, vaultParams.debtToken, feeTier)
        );

        // Check if pool exists
        if (poolAddress.code.length == 0) {
            return false;
        }

        // Check if pool has liquidity
        return IUniswapV3Pool(poolAddress).liquidity() > 0;
    }

    function _amountFirstMint(address collateral, uint144 collateralDeposited) private view returns (uint256 amount) {
        uint256 collateralTotalSupply = IERC20(collateral).totalSupply();
        amount = collateralTotalSupply > SystemConstants.TEA_MAX_SUPPLY / 1e6
            ? FullMath.mulDiv(SystemConstants.TEA_MAX_SUPPLY, collateralDeposited, collateralTotalSupply)
            : collateralDeposited * 1e6;
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
pragma abicoder v2;

/// @title Quoter Interface
/// @notice Supports quoting the calculated amounts from exact input or exact output swaps
/// @dev These functions are not marked view because they rely on calling non-view functions and reverting
/// to compute the result. They are also not gas efficient and should not be called on-chain.
interface IQuoter {
    /// @notice Returns the amount out received for a given exact input swap without executing the swap
    /// @param path The path of the swap, i.e. each token pair and the pool fee
    /// @param amountIn The amount of the first token to swap
    /// @return amountOut The amount of the last token that would be received
    /// @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path
    /// @return initializedTicksCrossedList List of the initialized ticks that the swap crossed for each pool in the path
    /// @return gasEstimate The estimate of the gas that the swap consumes
    function quoteExactInput(bytes memory path, uint256 amountIn)
        external
        view
        returns (
            uint256 amountOut,
            uint160[] memory sqrtPriceX96AfterList,
            uint32[] memory initializedTicksCrossedList,
            uint256 gasEstimate
        );

    struct QuoteExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint256 amountIn;
        uint24 fee;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Returns the amount out received for a given exact input but for a swap of a single pool
    /// @param params The params for the quote, encoded as `QuoteExactInputSingleParams`
    /// tokenIn The token being swapped in
    /// tokenOut The token being swapped out
    /// fee The fee of the token pool to consider for the pair
    /// amountIn The desired input amount
    /// sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
    /// @return amountOut The amount of `tokenOut` that would be received
    /// @return sqrtPriceX96After The sqrt price of the pool after the swap
    /// @return initializedTicksCrossed The number of initialized ticks that the swap crossed
    /// @return gasEstimate The estimate of the gas that the swap consumes
    function quoteExactInputSingle(QuoteExactInputSingleParams memory params)
        external
        view
        returns (
            uint256 amountOut,
            uint160 sqrtPriceX96After,
            uint32 initializedTicksCrossed,
            uint256 gasEstimate
        );

    /// @notice Returns the amount in required for a given exact output swap without executing the swap
    /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order
    /// @param amountOut The amount of the last token to receive
    /// @return amountIn The amount of first token required to be paid
    /// @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path
    /// @return initializedTicksCrossedList List of the initialized ticks that the swap crossed for each pool in the path
    /// @return gasEstimate The estimate of the gas that the swap consumes
    function quoteExactOutput(bytes memory path, uint256 amountOut)
        external
        view
        returns (
            uint256 amountIn,
            uint160[] memory sqrtPriceX96AfterList,
            uint32[] memory initializedTicksCrossedList,
            uint256 gasEstimate
        );

    struct QuoteExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint256 amount;
        uint24 fee;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool
    /// @param params The params for the quote, encoded as `QuoteExactOutputSingleParams`
    /// tokenIn The token being swapped in
    /// tokenOut The token being swapped out
    /// amount The desired output amount
    /// fee The fee of the token pool to consider for the pair
    /// sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
    /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`
    /// @return sqrtPriceX96After The sqrt price of the pool after the swap
    /// @return initializedTicksCrossed The number of initialized ticks that the swap crossed
    /// @return gasEstimate The estimate of the gas that the swap consumes
    function quoteExactOutputSingle(QuoteExactOutputSingleParams memory params)
        external
        view
        returns (
            uint256 amountIn,
            uint160 sqrtPriceX96After,
            uint32 initializedTicksCrossed,
            uint256 gasEstimate
        );
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {SirStructs} from "../libraries/SirStructs.sol";

interface IVault {
    error AmountTooLow();
    error DeadlineExceeded();
    error ExcessiveDeposit();
    error InsufficientCollateralReceivedFromUniswap();
    error InsufficientDeposit();
    error LengthMismatch();
    error LeverageTierOutOfRange();
    error Locked();
    error NotAWETHVault();
    error NotAuthorized();
    error StringsInsufficientHexLength(uint256 value, uint256 length);
    error TEAMaxSupplyExceeded();
    error TransferToZeroAddress();
    error UnsafeRecipient();
    error VaultAlreadyInitialized();
    error VaultDoesNotExist();

    event ApprovalForAll(address indexed account, address indexed operator, bool approved);
    event ReservesChanged(uint48 indexed vaultId, bool isAPE, bool isMint, uint144 reserveLPers, uint144 reserveApes);
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] vaultIds,
        uint256[] amounts
    );
    event TransferSingle(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 id,
        uint256 amount
    );
    event URI(string value, uint256 indexed id);
    event VaultInitialized(
        address indexed debtToken,
        address indexed collateralToken,
        int8 indexed leverageTier,
        uint256 vaultId,
        address ape
    );
    event VaultNewTax(uint48 indexed vault, uint8 tax, uint16 cumulativeTax);

    function APE_IMPLEMENTATION() external view returns (address);
    function ORACLE() external view returns (address);
    function SIR() external view returns (address);
    function SYSTEM_CONTROL() external view returns (address);
    function TIMESTAMP_ISSUANCE_START() external view returns (uint40);
    function balanceOf(address account, uint256 vaultId) external view returns (uint256);
    function balanceOfBatch(
        address[] memory owners,
        uint256[] memory vaultIds
    ) external view returns (uint256[] memory balances_);
    function burn(
        bool isAPE,
        SirStructs.VaultParameters memory vaultParams,
        uint256 amount,
        uint40 deadline
    ) external returns (uint144);
    function claimSIR(uint256 vaultId, address lper) external returns (uint80);
    function cumulativeSIRPerTEA(uint256 vaultId) external view returns (uint176 cumulativeSIRPerTEAx96);
    function getReserves(
        SirStructs.VaultParameters memory vaultParams
    ) external view returns (SirStructs.Reserves memory);
    function initialize(SirStructs.VaultParameters memory vaultParams) external;
    function isApprovedForAll(address, address) external view returns (bool);
    function mint(
        bool isAPE,
        SirStructs.VaultParameters memory vaultParams,
        uint256 amountToDeposit,
        uint144 collateralToDepositMin,
        uint40 deadline
    ) external payable returns (uint256 amount);
    function numberOfVaults() external view returns (uint48);
    function paramsById(uint48 vaultId) external view returns (SirStructs.VaultParameters memory);
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory vaultIds,
        uint256[] memory amounts,
        bytes memory data
    ) external;
    function safeTransferFrom(address from, address to, uint256 vaultId, uint256 amount, bytes memory data) external;
    function setApprovalForAll(address operator, bool approved) external;
    function supportsInterface(bytes4 interfaceId) external pure returns (bool);
    function systemParams() external view returns (SirStructs.SystemParameters memory systemParams_);
    function totalReserves(address collateral) external view returns (uint256);
    function totalSupply(uint256 vaultId) external view returns (uint256);
    function unclaimedRewards(uint256 vaultId, address lper) external view returns (uint80);
    function hyperswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes memory data) external;
    function updateSystemState(uint16 baseFee, uint16 lpFee, bool mintingStopped) external;
    function updateVaults(
        uint48[] memory oldVaults,
        uint48[] memory newVaults,
        uint8[] memory newTaxes,
        uint16 cumulativeTax
    ) external;
    function uri(uint256 vaultId) external view returns (string memory);
    function vaultStates(
        SirStructs.VaultParameters memory vaultParams
    ) external view returns (SirStructs.VaultState memory);
    function vaultTax(uint48 vaultId) external view returns (uint8);
    function withdrawFees(address token) external returns (uint256 totalFeesToStakers);
    function withdrawToSaveSystem(address[] memory tokens, address to) external returns (uint256[] memory amounts);
}

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {SirStructs} from "../libraries/SirStructs.sol";

interface IOracle {
    error NoUniswapPool();
    error OracleNotInitialized();
    error UniswapFeeTierIndexOutOfBounds();

    event OracleFeeTierChanged(uint24 feeTierPrevious, uint24 feeTierSelected);
    event OracleInitialized(
        address indexed token0,
        address indexed token1,
        uint24 feeTierSelected,
        uint136 avLiquidity,
        uint40 period
    );
    event PriceUpdated(address indexed token0, address indexed token1, bool priceTruncated, int64 priceTickX42);
    event UniswapFeeTierAdded(uint24 fee);
    event UniswapOracleProbed(uint24 fee, uint136 avLiquidity, uint40 period, uint16 cardinalityToIncrease);

    function TWAP_DURATION() external view returns (uint40);
    function getPrice(address collateralToken, address debtToken) external view returns (int64);
    function getUniswapFeeTiers() external view returns (SirStructs.UniswapFeeTier[] memory uniswapFeeTiers);
    function initialize(address tokenA, address tokenB) external;
    function newUniswapFeeTier(uint24 fee) external;
    function state(address token0, address token1) external view returns (SirStructs.OracleState memory);
    function uniswapFeeTierAddressOf(address tokenA, address tokenB) external view returns (address);
    function uniswapFeeTierOf(address tokenA, address tokenB) external view returns (uint24);
    function updateOracleState(
        address collateralToken,
        address debtToken
    ) external returns (int64 tickPriceX42, address uniswapPoolAddress);
}

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

import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol';
import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol';
import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol';
import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol';
import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol';
import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol';
import {IUniswapV3PoolEvents} from './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,
    IUniswapV3PoolErrors,
    IUniswapV3PoolEvents
{

}

File 6 of 20 : SirStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library SirStructs {
    struct VaultIssuanceParams {
        uint8 tax; // (tax / type(uint8).max * 10%) of its fee revenue is directed to the Treasury.
        uint40 timestampLastUpdate; // timestamp of the last time cumulativeSIRPerTEAx96 was updated. 0 => use systemParams.timestampIssuanceStart instead
        uint176 cumulativeSIRPerTEAx96; // Q104.96, cumulative SIR minted by the vaultId per unit of TEA.
    }

    struct VaultParameters {
        address debtToken;
        address collateralToken;
        int8 leverageTier;
    }

    struct FeeStructure {
        uint16 fee; // Fee in basis points.
        uint16 feeNew; // New fee to replace fee if current time exceeds FEE_CHANGE_DELAY since timestampUpdate
        uint40 timestampUpdate; // Timestamp fee change was made. If 0, feeNew is not used.
    }

    struct SystemParameters {
        FeeStructure baseFee;
        FeeStructure lpFee;
        bool mintingStopped; // If true, no minting of TEA/APE
        /** Aggregated taxes for all vaults. Choice of uint16 type.
            For vault i, (tax_i / type(uint8).max)*10% is charged, where tax_i is of type uint8.
            They must satisfy the condition
                Σ_i (tax_i / type(uint8).max)^2 ≤ 0.1^2
            Under this constraint, cumulativeTax = Σ_i tax_i is maximized when all taxes are equal (tax_i = tax for all i) and
                tax = type(uint8).max / sqrt(Nvaults)
            Since the lowest non-zero value is tax=1, the maximum number of vaults with non-zero tax is
                Nvaults = type(uint8).max^2 < type(uint16).max
         */
        uint16 cumulativeTax;
    }

    /** Collateral owned by the apes and LPers in a vault
     */
    struct Reserves {
        uint144 reserveApes;
        uint144 reserveLPers;
        int64 tickPriceX42;
    }

    /** Data needed for recoverying the amount of collateral owned by the apes and LPers in a vault
     */
    struct VaultState {
        uint144 reserve; // reserve =  reserveApes + reserveLPers
        /** Price at the border of the power and saturation zone.
            Q21.42 - Fixed point number with 42 bits of precision after the comma.
            type(int64).max and type(int64).min are used to represent +∞ and -∞ respectively.
         */
        int64 tickPriceSatX42; // Saturation price in Q21.42 fixed point
        uint48 vaultId; // Allows the creation of approximately 281 trillion vaults
    }

    /** The sum of all amounts in Fees are equal to the amounts deposited by the user (in the case of a mint)
        or taken out by the user (in the case of a burn).
        collateralInOrWithdrawn: Amount of collateral deposited by the user (in the case of a mint) or taken out by the user (in the case of a burn).
        collateralFeeToStakers: Amount of collateral paid to the stakers.
        collateralFeeToLPers: Amount of collateral paid to the gentlemen.
        collateralFeeToProtocol: Amount of collateral paid to the protocol.
     */
    struct Fees {
        uint144 collateralInOrWithdrawn;
        uint144 collateralFeeToStakers;
        uint144 collateralFeeToLPers; // Sometimes all LPers and sometimes only protocol owned liquidity
    }

    struct StakingParams {
        uint80 stake; // Amount of staked SIR
        uint176 cumulativeHYPEPerSIRx80; // Cumulative HYPE per SIR * 2^80
    }

    struct StakerParams {
        uint80 stake; // Total amount of staked SIR by the staker
        uint176 cumulativeHYPEPerSIRx80; // Cumulative HYPE per SIR * 2^80 last time the user updated his balance of HYPE dividends
        uint80 lockedStake; // Amount of stake that was locked at time 'tsLastUpdate'
        uint40 tsLastUpdate; // Timestamp of the last time the user staked or unstaked
    }

    struct Auction {
        address bidder; // Address of the bidder
        uint96 bid; // Amount of the bid
        uint40 startTime; // Auction start time
    }

    struct OracleState {
        int64 tickPriceX42; // Last stored price. Q21.42
        uint40 timeStampPrice; // Timestamp of the last stored price
        uint8 indexFeeTier; // Uniswap v3 fee tier currently being used as oracle
        uint8 indexFeeTierProbeNext; // Uniswap v3 fee tier to probe next
        uint40 timeStampFeeTier; // Timestamp of the last probed fee tier
        bool initialized; // Whether the oracle has been initialized
        UniswapFeeTier uniswapFeeTier; // Uniswap v3 fee tier currently being used as oracle
    }

    /**
     * Parameters of a Uniswap v3 tier.
     */
    struct UniswapFeeTier {
        uint24 fee;
        int24 tickSpacing;
    }
}

File 7 of 20 : SystemConstants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library SystemConstants {
    uint8 internal constant SIR_DECIMALS = 12;

    /** SIR Token Issuance Rate
        If we want to issue 2,015,000,000 SIR per year, this implies an issuance rate of 63.9 SIR/s.
     */
    uint72 internal constant ISSUANCE = uint72(2015e6 * 10 ** SIR_DECIMALS - 1) / 365 days + 1; // [sir/s]

    uint72 internal constant LP_ISSUANCE_FIRST_3_YEARS = uint72((uint256(70000000000000000) * ISSUANCE) / 1e17);

    uint128 internal constant TEA_MAX_SUPPLY = (uint128(LP_ISSUANCE_FIRST_3_YEARS) << 96) / type(uint16).max; // Must fit in uint128

    uint40 internal constant THREE_YEARS = 3 * 365 days;

    int64 internal constant MAX_TICK_X42 = 1951133415219145403; // log_1.0001(x)*2^42 where x is the max possible Q64.64 value, i.e., 2^64 - 2^-64

    // Approximately 10 days. We did not choose 10 days precisely to avoid auctions always ending on the same day and time of the week.
    uint40 internal constant AUCTION_COOLDOWN = 247 hours; // 247h & 240h have no common factors

    // Duration of an auction
    uint40 internal constant AUCTION_DURATION = 24 hours;

    // Time it takes for a change of LP or base fee to take effect
    uint256 internal constant FEE_CHANGE_DELAY = 1 days;

    uint40 internal constant SHUTDOWN_WITHDRAWAL_DELAY = 20 days;

    int8 internal constant MAX_LEVERAGE_TIER = 2;

    int8 internal constant MIN_LEVERAGE_TIER = -4;

    uint256 internal constant HALVING_PERIOD = 30 days; // Every 30 days, half of the locked stake is unlocked
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @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
/// @dev Modified from https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/FullMath.sol so that it can compile on Solidity 8
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) {
        // 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.
        unchecked {
            uint256 twos = (type(uint256).max - denominator + 1) & denominator;
            // 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;
        }
    }

    function tryMulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (bool success, uint256 result) {
        // 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) {
            if (denominator == 0) return (false, 0);
            assembly {
                result := div(prod0, denominator)
            }
            return (true, result);
        }

        // Make sure the result is less than 2**256.
        // Also prevents denominator == 0
        if (denominator <= prod1) return (false, 0);

        ///////////////////////////////////////////////
        // 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.
        unchecked {
            uint256 twos = (type(uint256).max - denominator + 1) & denominator;
            // 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 (true, 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++;
        }
    }

    function tryMulDivRoundingUp(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (bool success, uint256 result) {
        (success, result) = tryMulDiv(a, b, denominator);
        if (success && mulmod(a, b, denominator) > 0) {
            if (result == type(uint256).max) return (false, 0);
            result++;
        }
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @title Interface for WETH9
interface IWETH9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
/// @notice Modified from https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/PoolAddress.sol
library UniswapPoolAddress {
    bytes32 internal constant POOL_INIT_CODE_HASH = 0xe3572921be1688dba92df30c6781b8770499ff274d20ae9b325f4242634774fb;

    /// @notice The identifying key of the pool
    struct PoolKey {
        address token0;
        address token1;
        uint24 fee;
    }

    /// @notice Returns PoolKey: the ordered tokens with the matched fee levels
    /// @param tokenA The first token of a pool, unsorted
    /// @param tokenB The second token of a pool, unsorted
    /// @param fee The fee level of the pool
    /// @return Poolkey The pool details with ordered token0 and token1 assignments
    function getPoolKey(address tokenA, address tokenB, uint24 fee) internal pure returns (PoolKey memory) {
        if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
        return PoolKey({token0: tokenA, token1: tokenB, fee: fee});
    }

    /// @notice Deterministically computes the pool address given the factory and PoolKey
    /// @param factory The Uniswap V3 factory contract address
    /// @param key The PoolKey
    /// @return pool The contract address of the V3 pool
    function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) {
        require(key.token0 < key.token1);
        pool = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(
                            hex"ff",
                            factory,
                            keccak256(abi.encode(key.token0, key.token1, key.fee)),
                            POOL_INIT_CODE_HASH
                        )
                    )
                )
            )
        );
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library AddressClone {
    /// @dev Hash of the `_CREATE3_PROXY_BYTECODE`.
    /// Equivalent to `keccak256(abi.encodePacked(hex"67363d3d37363d34f03d5260086018f3"))`.
    bytes32 private constant _CREATE3_PROXY_BYTECODE_HASH =
        0x21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f;

    function getAddress(address deployer, uint256 vaultId) internal pure returns (address clone) {
        /// @solidity memory-safe-assembly
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Cache the free memory pointer.
            let m := mload(0x40)
            // Store `address(this)`.
            mstore(0x00, deployer)
            // Store the prefix.
            mstore8(0x0b, 0xff)
            // Store the salt.
            mstore(0x20, vaultId)
            // Store the bytecode hash.
            mstore(0x40, _CREATE3_PROXY_BYTECODE_HASH)

            // Store the proxy's address.
            mstore(0x14, keccak256(0x0b, 0x55))
            // Restore the free memory pointer.
            mstore(0x40, m)
            // 0xd6 = 0xc0 (short RLP prefix) + 0x16 (length of: 0x94 ++ proxy ++ 0x01).
            // 0x94 = 0x80 + 0x14 (0x14 = the length of an address, 20 bytes, in hex).
            mstore(0x00, 0xd694)
            // Nonce of the proxy contract (1).
            mstore8(0x34, 0x01)

            clone := and(keccak256(0x1e, 0x17), 0xffffffffffffffffffffffffffffffffffffffff)
        }
    }
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

/// @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 {
    error T();
    error R();

    /// @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) {
        unchecked {
            uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
            if (absTick > uint256(int256(MAX_TICK))) revert 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) {
        unchecked {
            // second inequality must be < because the price can never reach the price at the max tick
            if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert 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;
        }
    }
}

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

// 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
    /// @return 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.
    /// @return observationIndex The index of the last oracle observation that was written,
    /// @return observationCardinality The current maximum number of observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// @return 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
    /// @return The liquidity at the current price of the pool
    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
    /// @return liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// @return secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// @return 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,
    /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// @return 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,
    /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// @return 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
        );
}

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

// 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;
}

// 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 18 of 20 : IUniswapV3PoolErrors.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Errors emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolErrors {
    error LOK();
    error TLU();
    error TLM();
    error TUM();
    error AI();
    error M0();
    error M1();
    error AS();
    error IIA();
    error L();
    error F0();
    error F1();
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

Settings
{
  "remappings": [
    "core/=lib/Core/src/",
    "v3-periphery/=lib/Core/lib/v3-periphery/contracts/",
    "v3-periphery-sol-7/=lib/view-quoter-v3/lib/v3-periphery/contracts/",
    "v3-core/=lib/Core/lib/v3-core/contracts/",
    "v3-core-sol-7/=lib/view-quoter-v3/lib/v3-core/contracts/",
    "v2-core/=lib/Core/lib/v2-core/contracts/",
    "solmate/=lib/solmate/src/",
    "openzeppelin/=lib/Core/lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/=lib/Core/lib/openzeppelin-contracts/",
    "oz-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@uniswap/lib/=lib/Core/lib/uniswap-lib/",
    "@uniswap/v3-core/=lib/Core/lib/v3-core/",
    "Core/=lib/Core/",
    "ERC1155-in-pure-yul/=lib/Core/lib/ERC1155-in-pure-yul/contracts/",
    "abdk-libraries-solidity/=lib/Core/lib/abdk-libraries-solidity/",
    "abdk/=lib/Core/lib/abdk-libraries-solidity/",
    "base64-sol/=lib/Core/lib/base64/",
    "base64/=lib/Core/lib/base64/",
    "canonical-weth/=lib/Core/lib/canonical-weth/contracts/",
    "clones-with-immutable-args/=lib/Core/lib/clones-with-immutable-args/src/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/Core/lib/openzeppelin-contracts/",
    "prb-math/=lib/Core/lib/prb-math/src/",
    "prb/=lib/Core/lib/prb-math/src/",
    "uniswap-lib/=lib/Core/lib/uniswap-lib/contracts/",
    "uniswap-openzeppelin/=lib/Core/lib/uniswap-openzeppelin/",
    "view-quoter-v3/=lib/view-quoter-v3/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 100000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"uniswapV3Factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountTooLow","type":"error"},{"inputs":[],"name":"T","type":"error"},{"inputs":[],"name":"TEAMaxSupplyExceeded","type":"error"},{"inputs":[],"name":"TooMuchCollateral","type":"error"},{"inputs":[],"name":"VaultDoesNotExist","type":"error"},{"inputs":[],"name":"VAULT","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint48","name":"vaultId","type":"uint48"}],"name":"getAddressAPE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint48[]","name":"vaultIds","type":"uint48[]"}],"name":"getReserves","outputs":[{"components":[{"internalType":"uint144","name":"reserveApes","type":"uint144"},{"internalType":"uint144","name":"reserveLPers","type":"uint144"},{"internalType":"int64","name":"tickPriceX42","type":"int64"}],"internalType":"struct SirStructs.Reserves[]","name":"reserves","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"numVaults","type":"uint256"}],"name":"getUserBalances","outputs":[{"internalType":"uint256[]","name":"apeBalances","type":"uint256[]"},{"internalType":"uint256[]","name":"teaBalances","type":"uint256[]"},{"internalType":"uint80[]","name":"unclaimedSirRewards","type":"uint80[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"int8","name":"leverageTier","type":"int8"}],"internalType":"struct SirStructs.VaultParameters","name":"vaultParams","type":"tuple"}],"name":"getVaultStatus","outputs":[{"internalType":"enum Assistant.VaultStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"int8","name":"leverageTier","type":"int8"}],"internalType":"struct SirStructs.VaultParameters","name":"vaultParams","type":"tuple"}],"name":"priceOfAPE","outputs":[{"internalType":"uint256","name":"num","type":"uint256"},{"internalType":"uint256","name":"den","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"int8","name":"leverageTier","type":"int8"}],"internalType":"struct SirStructs.VaultParameters","name":"vaultParams","type":"tuple"}],"name":"priceOfTEA","outputs":[{"internalType":"uint256","name":"num","type":"uint256"},{"internalType":"uint256","name":"den","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isAPE","type":"bool"},{"components":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"int8","name":"leverageTier","type":"int8"}],"internalType":"struct SirStructs.VaultParameters","name":"vaultParams","type":"tuple"},{"internalType":"uint256","name":"amountTokens","type":"uint256"}],"name":"quoteBurn","outputs":[{"internalType":"uint144","name":"amountCollateral","type":"uint144"},{"internalType":"uint256","name":"amountDebtToken","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"uint256","name":"amountCollateral","type":"uint256"}],"name":"quoteCollateralToDebtToken","outputs":[{"internalType":"uint256","name":"amountDebtToken","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isAPE","type":"bool"},{"components":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"int8","name":"leverageTier","type":"int8"}],"internalType":"struct SirStructs.VaultParameters","name":"vaultParams","type":"tuple"},{"internalType":"uint144","name":"amountCollateral","type":"uint144"}],"name":"quoteMint","outputs":[{"internalType":"uint256","name":"amountTokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isAPE","type":"bool"},{"components":[{"internalType":"address","name":"debtToken","type":"address"},{"internalType":"address","name":"collateralToken","type":"address"},{"internalType":"int8","name":"leverageTier","type":"int8"}],"internalType":"struct SirStructs.VaultParameters","name":"vaultParams","type":"tuple"},{"internalType":"uint256","name":"amountDebtToken","type":"uint256"}],"name":"quoteMintWithDebtToken","outputs":[{"internalType":"uint256","name":"amountTokens","type":"uint256"},{"internalType":"uint256","name":"amountCollateral","type":"uint256"},{"internalType":"uint256","name":"amountCollateralIdeal","type":"uint256"}],"stateMutability":"view","type":"function"}]

610100604052348015610010575f5ffd5b50604051614a54380380614a5483398101604081905261002f91610129565b6001600160a01b0380841660805282811660a052811660c052466103e70361006e5773e57aff86a500849f66baa948c6c69c2a5e9951df60e052610106565b466103e60361009457737f3856d63e74516ef142a51c7445fbbc373fed5a60e052610106565b60405162461bcd60e51b815260206004820152603f60248201527f4e6574776f726b206e6f7420737570706f727465642e2055736520636861696e60448201527f203939382028746573746e657429206f722039393920286d61696e6e65742900606482015260840160405180910390fd5b505050610169565b80516001600160a01b0381168114610124575f5ffd5b919050565b5f5f5f6060848603121561013b575f5ffd5b6101448461010e565b92506101526020850161010e565b91506101606040850161010e565b90509250925092565b60805160a05160c05160e0516148106102445f395f610a3a01525f61254b01525f81816106690152818161096201528181610c450152612a9301525f81816101450152818161057b01528181610f7c0152818161103201528181611107015281816111930152818161122e015281816112f60152818161150a0152818161163e01528181611724015281816117f001528181611959015281816119d201528181611bec01528181611e3201528181611f1201528181612052015281816120ed0152818161224201528181612366015261245701526148105ff3fe608060405234801561000f575f5ffd5b50600436106100c4575f3560e01c806358c6bdbd1161007d5780638d0f7844116100585780638d0f7844146101fc578063a0193ec41461020f578063a4e59a9f1461022f575f5ffd5b806358c6bdbd146101b45780637b6127fa146101c75780637ef3090a146101e9575f5ffd5b806337961f8d116100ad57806337961f8d14610112578063411557d11461014057806358676d0c1461018c575f5ffd5b8063049354b9146100c85780632f3ccd42146100f1575b5f5ffd5b6100db6100d636600461391f565b61026c565b6040516100e89190613939565b60405180910390f35b6101046100ff36600461399c565b610618565b6040519081526020016100e8565b6101256101203660046139e7565b61090e565b604080519384526020840192909252908201526060016100e8565b6101677f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e8565b61019f61019a36600461391f565b610f77565b604080519283526020830191909152016100e8565b61019f6101c236600461391f565b61118e565b6101da6101d5366004613a24565b611411565b6040516100e893929190613a90565b6101046101f7366004613b24565b6117ec565b61016761020a366004613b7e565b611e2c565b61022261021d366004613b99565b611e65565b6040516100e89190613c0a565b61024261023d3660046139e7565b6120e8565b6040805171ffffffffffffffffffffffffffffffffffff90931683526020830191909152016100e8565b5f61027d6040830160208401613c93565b73ffffffffffffffffffffffffffffffffffffffff163b5f036102a157505f919050565b6102ae6020830183613c93565b73ffffffffffffffffffffffffffffffffffffffff163b5f036102d257505f919050565b5f6102e36040840160208501613c93565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f18160ddd00000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff929092169161035f9190613cae565b5f60405180830381855afa9150503d805f8114610397576040519150601f19603f3d011682016040523d82523d5f602084013e61039c565b606091505b50509050806103ad57505f92915050565b6103ba6020840184613c93565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f18160ddd00000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff92909216916104369190613cae565b5f60405180830381855afa9150503d805f811461046e576040519150601f19603f3d011682016040523d82523d5f602084013e610473565b606091505b5050809150508061048657505f92915050565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6104b76060850160408601613cd1565b5f0b12806104d6575060026104d26060850160408601613cd1565b5f0b135b156104e357505f92915050565b6104ee836064612544565b1580156105045750610502836101f4612544565b155b8015610519575061051783610bb8612544565b155b801561052e575061052c83612710612544565b155b1561053c5750600192915050565b6040517f2edf31040000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690632edf3104906105b0908790600401613cec565b606060405180830381865afa1580156105cb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ef9190613e14565b9050806040015165ffffffffffff165f0361060e575060029392505050565b5060039392505050565b6040517ff3209e0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015283811660248301525f9182917f0000000000000000000000000000000000000000000000000000000000000000169063f3209e0090604401602060405180830381865afa1580156106ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d29190613e66565b90505f8173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa15801561071e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107429190613e92565b50505050505090505f8273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610794573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107b89190613e66565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161490506fffffffffffffffffffffffffffffffff80168273ffffffffffffffffffffffffffffffffffffffff1611610898575f61083873ffffffffffffffffffffffffffffffffffffffff841680613f57565b905081156108695761086478010000000000000000000000000000000000000000000000008783612647565b61088d565b61088d81877801000000000000000000000000000000000000000000000000612647565b945050505050610907565b5f6108c373ffffffffffffffffffffffffffffffffffffffff84168068010000000000000000612647565b905081156108e7576108647001000000000000000000000000000000008783612647565b61088d8187700100000000000000000000000000000000612647565b5050505b9392505050565b5f5f5f835f0361094a576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663c7dd5c0a6109946020890189613c93565b6109a460408a0160208b01613c93565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa158015610a12573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a369190613f6e565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663c6a5026a6040518060a00160405280895f016020810190610a919190613c93565b73ffffffffffffffffffffffffffffffffffffffff168152602001896020016020810190610abf9190613c93565b73ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018462ffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff168152506040518263ffffffff1660e01b8152600401610b9c91905f60a08201905073ffffffffffffffffffffffffffffffffffffffff835116825273ffffffffffffffffffffffffffffffffffffffff60208401511660208301526040830151604083015262ffffff606084015116606083015273ffffffffffffffffffffffffffffffffffffffff608084015116608083015292915050565b608060405180830381865afa158015610bb7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bdb9190613fa3565b50919450505071ffffffffffffffffffffffffffffffffffff831115610c2d576040517f5baa913500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663f3209e00610c7760208a018a613c93565b610c8760408b0160208c01613c93565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa158015610cf5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d199190613e66565b90505f8173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610d65573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d899190613e92565b50505050505090505f8273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dff9190613e66565b73ffffffffffffffffffffffffffffffffffffffff16610e2560408b0160208c01613c93565b73ffffffffffffffffffffffffffffffffffffffff161490506fffffffffffffffffffffffffffffffff80168273ffffffffffffffffffffffffffffffffffffffff1611610eea575f610e8e73ffffffffffffffffffffffffffffffffffffffff841680613f57565b905081610ebe57610eb978010000000000000000000000000000000000000000000000008a83612647565b610ee2565b610ee2818a7801000000000000000000000000000000000000000000000000612647565b955050610f5d565b5f610f1573ffffffffffffffffffffffffffffffffffffffff84168068010000000000000000612647565b905081610f3d57610f387001000000000000000000000000000000008a83612647565b610f59565b610f59818a700100000000000000000000000000000000612647565b9550505b610f688a8a886117ec565b96505050505093509350939050565b5f5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663fbd98edf856040518263ffffffff1660e01b8152600401610fd39190613cec565b606060405180830381865afa158015610fee573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110129190613fe7565b9050806020015171ffffffffffffffffffffffffffffffffffff1692505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632edf3104866040518263ffffffff1660e01b81526004016110899190613cec565b606060405180830381865afa1580156110a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110c89190613e14565b60408181015190517fbd85b03900000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063bd85b03990602401602060405180830381865afa158015611161573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611185919061402d565b92505050915091565b5f5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663fbd98edf856040518263ffffffff1660e01b81526004016111ea9190613cec565b606060405180830381865afa158015611205573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112299190613fe7565b90505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663458e8e6b6040518163ffffffff1660e01b815260040161010060405180830381865afa158015611296573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112ba919061409c565b82518151519192506112dd916112d66060890160408a01613cd1565b5f0b61270c565b71ffffffffffffffffffffffffffffffffffff1693505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632edf3104876040518263ffffffff1660e01b815260040161134d9190613cec565b606060405180830381865afa158015611368573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138c9190613e14565b905061139b8160400151611e2c565b73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113e3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611407919061402d565b9350505050915091565b60608060605f8467ffffffffffffffff81111561143057611430613d59565b604051908082528060200260200182016040528015611459578160200160208202803683370190505b5093508467ffffffffffffffff81111561147557611475613d59565b60405190808252806020026020018201604052801561149e578160200160208202803683370190505b5092508467ffffffffffffffff8111156114ba576114ba613d59565b6040519080825280602002602001820160405280156114e3578160200160208202803683370190505b5091505f6114f287600161411e565b90505b6114ff868861411e565b81116117e15761152f7f00000000000000000000000000000000000000000000000000000000000000008261276c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152919350908316906370a0823190602401602060405180830381865afa15801561159d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115c1919061402d565b8560016115ce8a85614131565b6115d89190614131565b815181106115e8576115e8614144565b60209081029190910101526040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8981166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169062fdd58e90604401602060405180830381865afa158015611682573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116a6919061402d565b8460016116b38a85614131565b6116bd9190614131565b815181106116cd576116cd614144565b60209081029190910101526040517f46f907480000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff89811660248301527f000000000000000000000000000000000000000000000000000000000000000016906346f9074890604401602060405180830381865afa158015611769573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061178d9190614171565b83600161179a8a85614131565b6117a49190614131565b815181106117b4576117b4614144565b69ffffffffffffffffffff90921660209283029190910190910152806117d98161419a565b9150506114f5565b505093509350939050565b5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632edf3104856040518263ffffffff1660e01b81526004016118479190613cec565b606060405180830381865afa158015611862573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118869190613e14565b9050806040015165ffffffffffff165f036118cd576040517f4d827f1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8271ffffffffffffffffffffffffffffffffffff165f0361191a576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517ffbd98edf0000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063fbd98edf9061198e908890600401613cec565b606060405180830381865afa1580156119a9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119cd9190613fe7565b90505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663458e8e6b6040518163ffffffff1660e01b815260040161010060405180830381865afa158015611a3a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a5e919061409c565b90508615611b6e578051515f90611a819087906112d660608b0160408c01613cd1565b71ffffffffffffffffffffffffffffffffffff1690505f611aa58560400151611e2c565b90505f8173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b15919061402d565b90508015611b4457611b3f8184875f015171ffffffffffffffffffffffffffffffffffff16612647565b611b64565b8451611b649071ffffffffffffffffffffffffffffffffffff168461411e565b9650505050611df3565b5f611b808683602001515f01516127d9565b60408086015190517fbd85b03900000000000000000000000000000000000000000000000000000000815265ffffffffffff909116600482015271ffffffffffffffffffffffffffffffffffff9190911691505f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063bd85b03990602401602060405180830381865afa158015611c31573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c55919061402d565b90508015611c9957611c94818871ffffffffffffffffffffffffffffffffffff16866020015171ffffffffffffffffffffffffffffffffffff16612647565b611cc0565b611cc0611cac60408a0160208b01613c93565b6020860151611cbb908a6141d1565b612813565b95508061ffff606067016345785d8a00006301e133806001611ce4600c600a61431c565b611cf29063781a75c0613f57565b611cfc9190614131565b611d069190614357565b611d11906001614388565b611d2d9068ffffffffffffffffff1666f8b0a10e470000613f57565b611d3791906143a9565b68ffffffffffffffffff166fffffffffffffffffffffffffffffffff16901b611d6091906143bc565b6fffffffffffffffffffffffffffffffff16611d7c9190614131565b861115611db5576040517f6deac20700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611dee86838315611dc65789611dd5565b6020870151611dd5908b6141d1565b71ffffffffffffffffffffffffffffffffffff16612647565b955050505b835f03610903576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f611e5f7f00000000000000000000000000000000000000000000000000000000000000008365ffffffffffff1661276c565b92915050565b60608167ffffffffffffffff811115611e8057611e80613d59565b604051908082528060200260200182016040528015611ee857816020015b604080516060810182525f80825260208083018290529282015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909201910181611e9e5790505b50604080516060810182525f808252602082018190529181018290529192505b838110156120e0577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d2f3fd09868684818110611f5e57611f5e614144565b9050602002016020810190611f739190613b7e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815265ffffffffffff9091166004820152602401606060405180830381865afa158015611fcc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ff091906143fb565b604080517ffbd98edf000000000000000000000000000000000000000000000000000000008152825173ffffffffffffffffffffffffffffffffffffffff9081166004830152602084015181166024830152918301515f0b60448201529193507f0000000000000000000000000000000000000000000000000000000000000000169063fbd98edf90606401606060405180830381865afa158015612097573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120bb9190613fe7565b8382815181106120cd576120cd614144565b6020908102919091010152600101611f08565b505092915050565b5f5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632edf3104866040518263ffffffff1660e01b81526004016121449190613cec565b606060405180830381865afa15801561215f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121839190613e14565b9050806040015165ffffffffffff165f036121ca576040517f4d827f1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b835f03612203576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517ffbd98edf0000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063fbd98edf90612277908990600401613cec565b606060405180830381865afa158015612292573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122b69190613fe7565b90508615612419575f6122cc8360400151611e2c565b90505f8173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612318573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061233c919061402d565b90505f612361845f015171ffffffffffffffffffffffffffffffffffff168984612647565b90505f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663458e8e6b6040518163ffffffff1660e01b815260040161010060405180830381865afa1580156123ce573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123f2919061409c565b80515190915061240e9083906112d660608e0160408f01613cd1565b9750505050506124fe565b60408281015190517fbd85b03900000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201525f907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063bd85b03990602401602060405180830381865afa1580156124b1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124d5919061402d565b90506124fa826020015171ffffffffffffffffffffffffffffffffffff168783612647565b9450505b6125386125116040880160208901613c93565b61251e6020890189613c93565b8671ffffffffffffffffffffffffffffffffffff16612a42565b92505050935093915050565b5f806125957f000000000000000000000000000000000000000000000000000000000000000061259061257d6040880160208901613c93565b61258a6020890189613c93565b876133c2565b613453565b90508073ffffffffffffffffffffffffffffffffffffffff163b5f036125be575f915050611e5f565b5f8173ffffffffffffffffffffffffffffffffffffffff16631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa158015612608573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061262c9190614443565b6fffffffffffffffffffffffffffffffff1611949350505050565b5f80807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050805f0361269a575f841161268f575f5ffd5b508290049050610907565b8084116126a5575f5ffd5b5f8486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091025f889003889004909101858311909403939093029303949094049190911702949350505050565b5f5f5f5f841261272a5750612710905061ffff8416831b810161273c565b50506127105f8390031b61ffff841681015b80828771ffffffffffffffffffffffffffffffffffff1602816127615761276161432a565b049695505050505050565b5f604051835f5260ff600b53826020527f21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f6040526055600b20601452806040525061d6945f52600160345350506017601e2073ffffffffffffffffffffffffffffffffffffffff16919050565b5f61271061ffff831681018071ffffffffffffffffffffffffffffffffffff86168302816128095761280961432a565b0495945050505050565b5f5f8373ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561285e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612882919061402d565b9050620f424061ffff606067016345785d8a00006301e1338060016128a9600c600a61431c565b6128b79063781a75c0613f57565b6128c19190614131565b6128cb9190614357565b6128d6906001614388565b6128f29068ffffffffffffffffff1666f8b0a10e470000613f57565b6128fc91906143a9565b68ffffffffffffffffff166fffffffffffffffffffffffffffffffff16901b61292591906143bc565b61292f91906143bc565b6fffffffffffffffffffffffffffffffff16811161296d5761295483620f4240614472565b71ffffffffffffffffffffffffffffffffffff16612a3a565b612a3a61ffff606067016345785d8a00006301e133806001612991600c600a61431c565b61299f9063781a75c0613f57565b6129a99190614131565b6129b39190614357565b6129be906001614388565b6129da9068ffffffffffffffffff1666f8b0a10e470000613f57565b6129e491906143a9565b68ffffffffffffffffff166fffffffffffffffffffffffffffffffff16901b612a0d91906143bc565b6fffffffffffffffffffffffffffffffff168471ffffffffffffffffffffffffffffffffffff1683612647565b949350505050565b6040517ff3209e0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015283811660248301525f9182917f0000000000000000000000000000000000000000000000000000000000000000169063f3209e0090604401602060405180830381865afa158015612ad8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612afc9190613e66565b60408051600280825260608201835292935083925f92602083019080368337019050509050610708815f81518110612b3657612b36614144565b602002602001019063ffffffff16908163ffffffff16815250505f81600181518110612b6457612b64614144565b63ffffffff909216602092830291909101909101526040517f883bdbfd00000000000000000000000000000000000000000000000000000000815260609073ffffffffffffffffffffffffffffffffffffffff84169063883bdbfd90612bce9085906004016144ca565b5f60405180830381865afa925050508015612c2857506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612c2591908101906145ae565b60015b613190575f5f8473ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015612c77573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c9b9190613e92565b50505093509350505060018161ffff161115613058575f80808084612cc1876001614673565b612ccb919061468d565b6040517f252c09d700000000000000000000000000000000000000000000000000000000815261ffff8216600482015290915073ffffffffffffffffffffffffffffffffffffffff8a169063252c09d790602401608060405180830381865afa158015612d3a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d5e91906146b0565b929650909450909250829050612e02576040517f252c09d70000000000000000000000000000000000000000000000000000000081525f600482015273ffffffffffffffffffffffffffffffffffffffff8a169063252c09d790602401608060405180830381865afa158015612dd6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfa91906146b0565b509195509350505b5f612e0d8542614706565b905063ffffffff811615612f1d5780895f81518110612e2e57612e2e614144565b63ffffffff9290921660209283029190910182015260408051600280825260608201835290929091908301908036833750506040517f883bdbfd0000000000000000000000000000000000000000000000000000000081529199505073ffffffffffffffffffffffffffffffffffffffff8b169063883bdbfd90612eb6908c906004016144ca565b5f60405180830381865afa158015612ed0573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612f1591908101906145ae565b50975061304e565b5f8a73ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015612f67573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f8b9190613e92565b5093955060029450612f9d9350505050565b604051908082528060200260200182016040528015612fc6578160200160208202803683370190505b5098508060020b895f81518110612fdf57612fdf614144565b602002602001019060060b908160060b815250508060020b8960018151811061300a5761300a614144565b602002602001019060060b908160060b8152505060018a5f8151811061303257613032614144565b602002602001019063ffffffff16908163ffffffff1681525050505b5050505050613189565b5f8573ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156130a2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130c69190613e92565b50939550600294506130d89350505050565b604051908082528060200260200182016040528015613101578160200160208202803683370190505b5093508060020b845f8151811061311a5761311a614144565b602002602001019060060b908160060b815250508060020b8460018151811061314557613145614144565b602002602001019060060b908160060b815250506001855f8151811061316d5761316d614144565b602002602001019063ffffffff16908163ffffffff1681525050505b5050613194565b5090505b5f825f815181106131a7576131a7614144565b602002602001015163ffffffff16825f815181106131c7576131c7614144565b6020026020010151836001815181106131e2576131e2614144565b60200260200101516131f49190614722565b6131fe9190614767565b905073ffffffffffffffffffffffffffffffffffffffff808916908a16105f613226836135a9565b905081156132f3576fffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff8216116132aa575f61327c73ffffffffffffffffffffffffffffffffffffffff831680613f57565b90506132a28a827801000000000000000000000000000000000000000000000000612647565b9850506133b4565b5f6132d573ffffffffffffffffffffffffffffffffffffffff83168068010000000000000000612647565b90506132a28a82700100000000000000000000000000000000612647565b6fffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff821611613367575f61334173ffffffffffffffffffffffffffffffffffffffff831680613f57565b90506132a28a780100000000000000000000000000000000000000000000000083612647565b5f61339273ffffffffffffffffffffffffffffffffffffffff83168068010000000000000000612647565b90506133b08a70010000000000000000000000000000000083612647565b9850505b505050505050509392505050565b604080516060810182525f80825260208201819052918101919091528273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115613416579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b5f816020015173ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff1610613492575f5ffd5b8151602080840151604080860151815173ffffffffffffffffffffffffffffffffffffffff95861681860152949092168482015262ffffff90911660608085019190915281518085038201815260808501909252815191909201207fff0000000000000000000000000000000000000000000000000000000000000060a08401529085901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201527fe3572921be1688dba92df30c6781b8770499ff274d20ae9b325f4242634774fb60d582015260f501604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b5f5f5f8360020b126135be578260020b6135c5565b8260020b5f035b9050620d89e8811115613604576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816001165f0361362657700100000000000000000000000000000000613638565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561366c576ffff97272373d413259a46990580e213a0260801c5b600482161561368b576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156136aa576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156136c9576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156136e8576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615613707576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615613726576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613746576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613766576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613786576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156137a6576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156137c6576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156137e6576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615613806576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615613826576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613847576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613867576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613886576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156138a3576b048a170391f7dc42444e8fa20260801c5b5f8460020b13156138e157807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff816138dd576138dd61432a565b0490505b6401000000008106156138f55760016138f7565b5f5b60ff16602082901c0192505050919050565b5f60608284031215613919575f5ffd5b50919050565b5f6060828403121561392f575f5ffd5b6109078383613909565b6020810160048310613972577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b91905290565b73ffffffffffffffffffffffffffffffffffffffff81168114613999575f5ffd5b50565b5f5f5f606084860312156139ae575f5ffd5b83356139b981613978565b925060208401356139c981613978565b929592945050506040919091013590565b8015158114613999575f5ffd5b5f5f5f60a084860312156139f9575f5ffd5b8335613a04816139da565b9250613a138560208601613909565b929592945050506080919091013590565b5f5f5f60608486031215613a36575f5ffd5b8335613a4181613978565b95602085013595506040909401359392505050565b5f8151808452602084019350602083015f5b82811015613a86578151865260209586019590910190600101613a68565b5093949350505050565b606081525f613aa26060830186613a56565b8281036020840152613ab48186613a56565b8381036040850152845180825260208087019350909101905f5b81811015613af857835169ffffffffffffffffffff16835260209384019390920191600101613ace565b5090979650505050505050565b71ffffffffffffffffffffffffffffffffffff81168114613999575f5ffd5b5f5f5f60a08486031215613b36575f5ffd5b8335613b41816139da565b9250613b508560208601613909565b91506080840135613b6081613b05565b809150509250925092565b65ffffffffffff81168114613999575f5ffd5b5f60208284031215613b8e575f5ffd5b813561090781613b6b565b5f5f60208385031215613baa575f5ffd5b823567ffffffffffffffff811115613bc0575f5ffd5b8301601f81018513613bd0575f5ffd5b803567ffffffffffffffff811115613be6575f5ffd5b8560208260051b8401011115613bfa575f5ffd5b6020919091019590945092505050565b602080825282518282018190525f918401906040840190835b81811015613c8857835171ffffffffffffffffffffffffffffffffffff815116845271ffffffffffffffffffffffffffffffffffff6020820151166020850152604081015160070b604085015250606083019250602084019350600181019050613c23565b509095945050505050565b5f60208284031215613ca3575f5ffd5b813561090781613978565b5f82518060208501845e5f920191825250919050565b805f0b8114613999575f5ffd5b5f60208284031215613ce1575f5ffd5b813561090781613cc4565b606081018235613cfb81613978565b73ffffffffffffffffffffffffffffffffffffffff1682526020830135613d2181613978565b73ffffffffffffffffffffffffffffffffffffffff1660208301526040830135613d4a81613cc4565b805f0b60408401525092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040516060810167ffffffffffffffff81118282101715613da957613da9613d59565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613df657613df6613d59565b604052919050565b8051600781900b8114613e0f575f5ffd5b919050565b5f6060828403128015613e25575f5ffd5b50613e2e613d86565b8251613e3981613b05565b8152613e4760208401613dfe565b60208201526040830151613e5a81613b6b565b60408201529392505050565b5f60208284031215613e76575f5ffd5b815161090781613978565b805161ffff81168114613e0f575f5ffd5b5f5f5f5f5f5f5f60e0888a031215613ea8575f5ffd5b8751613eb381613978565b8097505060208801518060020b8114613eca575f5ffd5b9550613ed860408901613e81565b9450613ee660608901613e81565b9350613ef460808901613e81565b925060a088015160ff81168114613f09575f5ffd5b60c0890151909250613f1a816139da565b8091505092959891949750929550565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417611e5f57611e5f613f2a565b5f60208284031215613f7e575f5ffd5b815162ffffff81168114610907575f5ffd5b805163ffffffff81168114613e0f575f5ffd5b5f5f5f5f60808587031215613fb6575f5ffd5b84516020860151909450613fc981613978565b9250613fd760408601613f90565b6060959095015193969295505050565b5f6060828403128015613ff8575f5ffd5b50614001613d86565b825161400c81613b05565b8152602083015161401c81613b05565b6020820152613e5a60408401613dfe565b5f6020828403121561403d575f5ffd5b5051919050565b5f60608284031215614054575f5ffd5b61405c613d86565b905061406782613e81565b815261407560208301613e81565b6020820152604082015164ffffffffff81168114614091575f5ffd5b604082015292915050565b5f6101008284031280156140ae575f5ffd5b506040516080810167ffffffffffffffff811182821017156140d2576140d2613d59565b6040526140df8484614044565b81526140ee8460608501614044565b602082015260c0830151614101816139da565b604082015261411260e08401613e81565b60608201529392505050565b80820180821115611e5f57611e5f613f2a565b81810381811115611e5f57611e5f613f2a565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215614181575f5ffd5b815169ffffffffffffffffffff81168114610907575f5ffd5b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036141ca576141ca613f2a565b5060010190565b71ffffffffffffffffffffffffffffffffffff8181168382160190811115611e5f57611e5f613f2a565b6001815b60018411156142365780850481111561421a5761421a613f2a565b600184161561422857908102905b60019390931c9280026141ff565b935093915050565b5f8261424c57506001611e5f565b8161425857505f611e5f565b816001811461426e576002811461427857614294565b6001915050611e5f565b60ff84111561428957614289613f2a565b50506001821b611e5f565b5060208310610133831016604e8410600b84101617156142b7575081810a611e5f565b6142e27fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846141fb565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561431457614314613f2a565b029392505050565b5f61090760ff84168361423e565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f68ffffffffffffffffff8316806143715761437161432a565b8068ffffffffffffffffff84160491505092915050565b68ffffffffffffffffff8181168382160190811115611e5f57611e5f613f2a565b5f826143b7576143b761432a565b500490565b5f6fffffffffffffffffffffffffffffffff8316806143dd576143dd61432a565b806fffffffffffffffffffffffffffffffff84160491505092915050565b5f606082840312801561440c575f5ffd5b50614415613d86565b825161442081613978565b8152602083015161443081613978565b60208201526040830151613e5a81613cc4565b5f60208284031215614453575f5ffd5b81516fffffffffffffffffffffffffffffffff81168114610907575f5ffd5b5f71ffffffffffffffffffffffffffffffffffff821671ffffffffffffffffffffffffffffffffffff841671ffffffffffffffffffffffffffffffffffff81830216925081830481148215176120e0576120e0613f2a565b602080825282518282018190525f918401906040840190835b81811015613c8857835163ffffffff168352602093840193909201916001016144e3565b5f67ffffffffffffffff82111561452057614520613d59565b5060051b60200190565b8051600681900b8114613e0f575f5ffd5b5f82601f83011261454a575f5ffd5b815161455d61455882614507565b613daf565b8082825260208201915060208360051b86010192508583111561457e575f5ffd5b602085015b838110156145a457805161459681613978565b835260209283019201614583565b5095945050505050565b5f5f604083850312156145bf575f5ffd5b825167ffffffffffffffff8111156145d5575f5ffd5b8301601f810185136145e5575f5ffd5b80516145f361455882614507565b8082825260208201915060208360051b850101925087831115614614575f5ffd5b6020840193505b8284101561463d5761462c8461452a565b82526020938401939091019061461b565b80955050505050602083015167ffffffffffffffff81111561465d575f5ffd5b6146698582860161453b565b9150509250929050565b61ffff8181168382160190811115611e5f57611e5f613f2a565b5f61ffff8316806146a0576146a061432a565b8061ffff84160691505092915050565b5f5f5f5f608085870312156146c3575f5ffd5b6146cc85613f90565b93506146da6020860161452a565b925060408501516146ea81613978565b60608601519092506146fb816139da565b939692955090935050565b63ffffffff8281168282160390811115611e5f57611e5f613f2a565b600682810b9082900b037fffffffffffffffffffffffffffffffffffffffffffffffffff800000000000008112667fffffffffffff82131715611e5f57611e5f613f2a565b5f8160060b8360060b8061477d5761477d61432a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81147fffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000831416156147d1576147d1613f2a565b9005939250505056fea2646970667358221220b1198c8d5635964d92f0fa1ca2b543f9bd3340cdc3cef8dd9c97584c7124f89f64736f6c634300081c00330000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf00000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e0000000000000000000000000b1c0fa0b789320044a6f623cfe5ebda9562602e3

Deployed Bytecode

0x608060405234801561000f575f5ffd5b50600436106100c4575f3560e01c806358c6bdbd1161007d5780638d0f7844116100585780638d0f7844146101fc578063a0193ec41461020f578063a4e59a9f1461022f575f5ffd5b806358c6bdbd146101b45780637b6127fa146101c75780637ef3090a146101e9575f5ffd5b806337961f8d116100ad57806337961f8d14610112578063411557d11461014057806358676d0c1461018c575f5ffd5b8063049354b9146100c85780632f3ccd42146100f1575b5f5ffd5b6100db6100d636600461391f565b61026c565b6040516100e89190613939565b60405180910390f35b6101046100ff36600461399c565b610618565b6040519081526020016100e8565b6101256101203660046139e7565b61090e565b604080519384526020840192909252908201526060016100e8565b6101677f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e8565b61019f61019a36600461391f565b610f77565b604080519283526020830191909152016100e8565b61019f6101c236600461391f565b61118e565b6101da6101d5366004613a24565b611411565b6040516100e893929190613a90565b6101046101f7366004613b24565b6117ec565b61016761020a366004613b7e565b611e2c565b61022261021d366004613b99565b611e65565b6040516100e89190613c0a565b61024261023d3660046139e7565b6120e8565b6040805171ffffffffffffffffffffffffffffffffffff90931683526020830191909152016100e8565b5f61027d6040830160208401613c93565b73ffffffffffffffffffffffffffffffffffffffff163b5f036102a157505f919050565b6102ae6020830183613c93565b73ffffffffffffffffffffffffffffffffffffffff163b5f036102d257505f919050565b5f6102e36040840160208501613c93565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f18160ddd00000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff929092169161035f9190613cae565b5f60405180830381855afa9150503d805f8114610397576040519150601f19603f3d011682016040523d82523d5f602084013e61039c565b606091505b50509050806103ad57505f92915050565b6103ba6020840184613c93565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f18160ddd00000000000000000000000000000000000000000000000000000000179052905173ffffffffffffffffffffffffffffffffffffffff92909216916104369190613cae565b5f60405180830381855afa9150503d805f811461046e576040519150601f19603f3d011682016040523d82523d5f602084013e610473565b606091505b5050809150508061048657505f92915050565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6104b76060850160408601613cd1565b5f0b12806104d6575060026104d26060850160408601613cd1565b5f0b135b156104e357505f92915050565b6104ee836064612544565b1580156105045750610502836101f4612544565b155b8015610519575061051783610bb8612544565b155b801561052e575061052c83612710612544565b155b1561053c5750600192915050565b6040517f2edf31040000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf01690632edf3104906105b0908790600401613cec565b606060405180830381865afa1580156105cb573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105ef9190613e14565b9050806040015165ffffffffffff165f0361060e575060029392505050565b5060039392505050565b6040517ff3209e0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015283811660248301525f9182917f0000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e0169063f3209e0090604401602060405180830381865afa1580156106ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106d29190613e66565b90505f8173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa15801561071e573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107429190613e92565b50505050505090505f8273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610794573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107b89190613e66565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161490506fffffffffffffffffffffffffffffffff80168273ffffffffffffffffffffffffffffffffffffffff1611610898575f61083873ffffffffffffffffffffffffffffffffffffffff841680613f57565b905081156108695761086478010000000000000000000000000000000000000000000000008783612647565b61088d565b61088d81877801000000000000000000000000000000000000000000000000612647565b945050505050610907565b5f6108c373ffffffffffffffffffffffffffffffffffffffff84168068010000000000000000612647565b905081156108e7576108647001000000000000000000000000000000008783612647565b61088d8187700100000000000000000000000000000000612647565b5050505b9392505050565b5f5f5f835f0361094a576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e01663c7dd5c0a6109946020890189613c93565b6109a460408a0160208b01613c93565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa158015610a12573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a369190613f6e565b90507f000000000000000000000000e57aff86a500849f66baa948c6c69c2a5e9951df73ffffffffffffffffffffffffffffffffffffffff1663c6a5026a6040518060a00160405280895f016020810190610a919190613c93565b73ffffffffffffffffffffffffffffffffffffffff168152602001896020016020810190610abf9190613c93565b73ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018462ffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff168152506040518263ffffffff1660e01b8152600401610b9c91905f60a08201905073ffffffffffffffffffffffffffffffffffffffff835116825273ffffffffffffffffffffffffffffffffffffffff60208401511660208301526040830151604083015262ffffff606084015116606083015273ffffffffffffffffffffffffffffffffffffffff608084015116608083015292915050565b608060405180830381865afa158015610bb7573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bdb9190613fa3565b50919450505071ffffffffffffffffffffffffffffffffffff831115610c2d576040517f5baa913500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e01663f3209e00610c7760208a018a613c93565b610c8760408b0160208c01613c93565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff928316600482015291166024820152604401602060405180830381865afa158015610cf5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d199190613e66565b90505f8173ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610d65573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d899190613e92565b50505050505090505f8273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ddb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610dff9190613e66565b73ffffffffffffffffffffffffffffffffffffffff16610e2560408b0160208c01613c93565b73ffffffffffffffffffffffffffffffffffffffff161490506fffffffffffffffffffffffffffffffff80168273ffffffffffffffffffffffffffffffffffffffff1611610eea575f610e8e73ffffffffffffffffffffffffffffffffffffffff841680613f57565b905081610ebe57610eb978010000000000000000000000000000000000000000000000008a83612647565b610ee2565b610ee2818a7801000000000000000000000000000000000000000000000000612647565b955050610f5d565b5f610f1573ffffffffffffffffffffffffffffffffffffffff84168068010000000000000000612647565b905081610f3d57610f387001000000000000000000000000000000008a83612647565b610f59565b610f59818a700100000000000000000000000000000000612647565b9550505b610f688a8a886117ec565b96505050505093509350939050565b5f5f5f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff1663fbd98edf856040518263ffffffff1660e01b8152600401610fd39190613cec565b606060405180830381865afa158015610fee573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110129190613fe7565b9050806020015171ffffffffffffffffffffffffffffffffffff1692505f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff16632edf3104866040518263ffffffff1660e01b81526004016110899190613cec565b606060405180830381865afa1580156110a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110c89190613e14565b60408181015190517fbd85b03900000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529091507f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff169063bd85b03990602401602060405180830381865afa158015611161573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611185919061402d565b92505050915091565b5f5f5f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff1663fbd98edf856040518263ffffffff1660e01b81526004016111ea9190613cec565b606060405180830381865afa158015611205573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112299190613fe7565b90505f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff1663458e8e6b6040518163ffffffff1660e01b815260040161010060405180830381865afa158015611296573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112ba919061409c565b82518151519192506112dd916112d66060890160408a01613cd1565b5f0b61270c565b71ffffffffffffffffffffffffffffffffffff1693505f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff16632edf3104876040518263ffffffff1660e01b815260040161134d9190613cec565b606060405180830381865afa158015611368573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061138c9190613e14565b905061139b8160400151611e2c565b73ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113e3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611407919061402d565b9350505050915091565b60608060605f8467ffffffffffffffff81111561143057611430613d59565b604051908082528060200260200182016040528015611459578160200160208202803683370190505b5093508467ffffffffffffffff81111561147557611475613d59565b60405190808252806020026020018201604052801561149e578160200160208202803683370190505b5092508467ffffffffffffffff8111156114ba576114ba613d59565b6040519080825280602002602001820160405280156114e3578160200160208202803683370190505b5091505f6114f287600161411e565b90505b6114ff868861411e565b81116117e15761152f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf08261276c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152919350908316906370a0823190602401602060405180830381865afa15801561159d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115c1919061402d565b8560016115ce8a85614131565b6115d89190614131565b815181106115e8576115e8614144565b60209081029190910101526040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8981166004830152602482018390527f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf0169062fdd58e90604401602060405180830381865afa158015611682573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116a6919061402d565b8460016116b38a85614131565b6116bd9190614131565b815181106116cd576116cd614144565b60209081029190910101526040517f46f907480000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff89811660248301527f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf016906346f9074890604401602060405180830381865afa158015611769573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061178d9190614171565b83600161179a8a85614131565b6117a49190614131565b815181106117b4576117b4614144565b69ffffffffffffffffffff90921660209283029190910190910152806117d98161419a565b9150506114f5565b505093509350939050565b5f5f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff16632edf3104856040518263ffffffff1660e01b81526004016118479190613cec565b606060405180830381865afa158015611862573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118869190613e14565b9050806040015165ffffffffffff165f036118cd576040517f4d827f1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8271ffffffffffffffffffffffffffffffffffff165f0361191a576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517ffbd98edf0000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf0169063fbd98edf9061198e908890600401613cec565b606060405180830381865afa1580156119a9573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119cd9190613fe7565b90505f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff1663458e8e6b6040518163ffffffff1660e01b815260040161010060405180830381865afa158015611a3a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a5e919061409c565b90508615611b6e578051515f90611a819087906112d660608b0160408c01613cd1565b71ffffffffffffffffffffffffffffffffffff1690505f611aa58560400151611e2c565b90505f8173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af1573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b15919061402d565b90508015611b4457611b3f8184875f015171ffffffffffffffffffffffffffffffffffff16612647565b611b64565b8451611b649071ffffffffffffffffffffffffffffffffffff168461411e565b9650505050611df3565b5f611b808683602001515f01516127d9565b60408086015190517fbd85b03900000000000000000000000000000000000000000000000000000000815265ffffffffffff909116600482015271ffffffffffffffffffffffffffffffffffff9190911691505f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf0169063bd85b03990602401602060405180830381865afa158015611c31573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c55919061402d565b90508015611c9957611c94818871ffffffffffffffffffffffffffffffffffff16866020015171ffffffffffffffffffffffffffffffffffff16612647565b611cc0565b611cc0611cac60408a0160208b01613c93565b6020860151611cbb908a6141d1565b612813565b95508061ffff606067016345785d8a00006301e133806001611ce4600c600a61431c565b611cf29063781a75c0613f57565b611cfc9190614131565b611d069190614357565b611d11906001614388565b611d2d9068ffffffffffffffffff1666f8b0a10e470000613f57565b611d3791906143a9565b68ffffffffffffffffff166fffffffffffffffffffffffffffffffff16901b611d6091906143bc565b6fffffffffffffffffffffffffffffffff16611d7c9190614131565b861115611db5576040517f6deac20700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611dee86838315611dc65789611dd5565b6020870151611dd5908b6141d1565b71ffffffffffffffffffffffffffffffffffff16612647565b955050505b835f03610903576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f611e5f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf08365ffffffffffff1661276c565b92915050565b60608167ffffffffffffffff811115611e8057611e80613d59565b604051908082528060200260200182016040528015611ee857816020015b604080516060810182525f80825260208083018290529282015282527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff909201910181611e9e5790505b50604080516060810182525f808252602082018190529181018290529192505b838110156120e0577f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff1663d2f3fd09868684818110611f5e57611f5e614144565b9050602002016020810190611f739190613b7e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815265ffffffffffff9091166004820152602401606060405180830381865afa158015611fcc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ff091906143fb565b604080517ffbd98edf000000000000000000000000000000000000000000000000000000008152825173ffffffffffffffffffffffffffffffffffffffff9081166004830152602084015181166024830152918301515f0b60448201529193507f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf0169063fbd98edf90606401606060405180830381865afa158015612097573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120bb9190613fe7565b8382815181106120cd576120cd614144565b6020908102919091010152600101611f08565b505092915050565b5f5f5f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff16632edf3104866040518263ffffffff1660e01b81526004016121449190613cec565b606060405180830381865afa15801561215f573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121839190613e14565b9050806040015165ffffffffffff165f036121ca576040517f4d827f1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b835f03612203576040517f1fbaba3500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517ffbd98edf0000000000000000000000000000000000000000000000000000000081525f9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf0169063fbd98edf90612277908990600401613cec565b606060405180830381865afa158015612292573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122b69190613fe7565b90508615612419575f6122cc8360400151611e2c565b90505f8173ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612318573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061233c919061402d565b90505f612361845f015171ffffffffffffffffffffffffffffffffffff168984612647565b90505f7f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff1663458e8e6b6040518163ffffffff1660e01b815260040161010060405180830381865afa1580156123ce573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123f2919061409c565b80515190915061240e9083906112d660608e0160408f01613cd1565b9750505050506124fe565b60408281015190517fbd85b03900000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201525f907f0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf073ffffffffffffffffffffffffffffffffffffffff169063bd85b03990602401602060405180830381865afa1580156124b1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124d5919061402d565b90506124fa826020015171ffffffffffffffffffffffffffffffffffff168783612647565b9450505b6125386125116040880160208901613c93565b61251e6020890189613c93565b8671ffffffffffffffffffffffffffffffffffff16612a42565b92505050935093915050565b5f806125957f000000000000000000000000b1c0fa0b789320044a6f623cfe5ebda9562602e361259061257d6040880160208901613c93565b61258a6020890189613c93565b876133c2565b613453565b90508073ffffffffffffffffffffffffffffffffffffffff163b5f036125be575f915050611e5f565b5f8173ffffffffffffffffffffffffffffffffffffffff16631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa158015612608573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061262c9190614443565b6fffffffffffffffffffffffffffffffff1611949350505050565b5f80807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709858702925082811083820303915050805f0361269a575f841161268f575f5ffd5b508290049050610907565b8084116126a5575f5ffd5b5f8486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091025f889003889004909101858311909403939093029303949094049190911702949350505050565b5f5f5f5f841261272a5750612710905061ffff8416831b810161273c565b50506127105f8390031b61ffff841681015b80828771ffffffffffffffffffffffffffffffffffff1602816127615761276161432a565b049695505050505050565b5f604051835f5260ff600b53826020527f21c35dbe1b344a2488cf3321d6ce542f8e9f305544ff09e4993a62319a497c1f6040526055600b20601452806040525061d6945f52600160345350506017601e2073ffffffffffffffffffffffffffffffffffffffff16919050565b5f61271061ffff831681018071ffffffffffffffffffffffffffffffffffff86168302816128095761280961432a565b0495945050505050565b5f5f8373ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561285e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612882919061402d565b9050620f424061ffff606067016345785d8a00006301e1338060016128a9600c600a61431c565b6128b79063781a75c0613f57565b6128c19190614131565b6128cb9190614357565b6128d6906001614388565b6128f29068ffffffffffffffffff1666f8b0a10e470000613f57565b6128fc91906143a9565b68ffffffffffffffffff166fffffffffffffffffffffffffffffffff16901b61292591906143bc565b61292f91906143bc565b6fffffffffffffffffffffffffffffffff16811161296d5761295483620f4240614472565b71ffffffffffffffffffffffffffffffffffff16612a3a565b612a3a61ffff606067016345785d8a00006301e133806001612991600c600a61431c565b61299f9063781a75c0613f57565b6129a99190614131565b6129b39190614357565b6129be906001614388565b6129da9068ffffffffffffffffff1666f8b0a10e470000613f57565b6129e491906143a9565b68ffffffffffffffffff166fffffffffffffffffffffffffffffffff16901b612a0d91906143bc565b6fffffffffffffffffffffffffffffffff168471ffffffffffffffffffffffffffffffffffff1683612647565b949350505050565b6040517ff3209e0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015283811660248301525f9182917f0000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e0169063f3209e0090604401602060405180830381865afa158015612ad8573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612afc9190613e66565b60408051600280825260608201835292935083925f92602083019080368337019050509050610708815f81518110612b3657612b36614144565b602002602001019063ffffffff16908163ffffffff16815250505f81600181518110612b6457612b64614144565b63ffffffff909216602092830291909101909101526040517f883bdbfd00000000000000000000000000000000000000000000000000000000815260609073ffffffffffffffffffffffffffffffffffffffff84169063883bdbfd90612bce9085906004016144ca565b5f60405180830381865afa925050508015612c2857506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612c2591908101906145ae565b60015b613190575f5f8473ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015612c77573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c9b9190613e92565b50505093509350505060018161ffff161115613058575f80808084612cc1876001614673565b612ccb919061468d565b6040517f252c09d700000000000000000000000000000000000000000000000000000000815261ffff8216600482015290915073ffffffffffffffffffffffffffffffffffffffff8a169063252c09d790602401608060405180830381865afa158015612d3a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d5e91906146b0565b929650909450909250829050612e02576040517f252c09d70000000000000000000000000000000000000000000000000000000081525f600482015273ffffffffffffffffffffffffffffffffffffffff8a169063252c09d790602401608060405180830381865afa158015612dd6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612dfa91906146b0565b509195509350505b5f612e0d8542614706565b905063ffffffff811615612f1d5780895f81518110612e2e57612e2e614144565b63ffffffff9290921660209283029190910182015260408051600280825260608201835290929091908301908036833750506040517f883bdbfd0000000000000000000000000000000000000000000000000000000081529199505073ffffffffffffffffffffffffffffffffffffffff8b169063883bdbfd90612eb6908c906004016144ca565b5f60405180830381865afa158015612ed0573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612f1591908101906145ae565b50975061304e565b5f8a73ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015612f67573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f8b9190613e92565b5093955060029450612f9d9350505050565b604051908082528060200260200182016040528015612fc6578160200160208202803683370190505b5098508060020b895f81518110612fdf57612fdf614144565b602002602001019060060b908160060b815250508060020b8960018151811061300a5761300a614144565b602002602001019060060b908160060b8152505060018a5f8151811061303257613032614144565b602002602001019063ffffffff16908163ffffffff1681525050505b5050505050613189565b5f8573ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156130a2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130c69190613e92565b50939550600294506130d89350505050565b604051908082528060200260200182016040528015613101578160200160208202803683370190505b5093508060020b845f8151811061311a5761311a614144565b602002602001019060060b908160060b815250508060020b8460018151811061314557613145614144565b602002602001019060060b908160060b815250506001855f8151811061316d5761316d614144565b602002602001019063ffffffff16908163ffffffff1681525050505b5050613194565b5090505b5f825f815181106131a7576131a7614144565b602002602001015163ffffffff16825f815181106131c7576131c7614144565b6020026020010151836001815181106131e2576131e2614144565b60200260200101516131f49190614722565b6131fe9190614767565b905073ffffffffffffffffffffffffffffffffffffffff808916908a16105f613226836135a9565b905081156132f3576fffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff8216116132aa575f61327c73ffffffffffffffffffffffffffffffffffffffff831680613f57565b90506132a28a827801000000000000000000000000000000000000000000000000612647565b9850506133b4565b5f6132d573ffffffffffffffffffffffffffffffffffffffff83168068010000000000000000612647565b90506132a28a82700100000000000000000000000000000000612647565b6fffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff821611613367575f61334173ffffffffffffffffffffffffffffffffffffffff831680613f57565b90506132a28a780100000000000000000000000000000000000000000000000083612647565b5f61339273ffffffffffffffffffffffffffffffffffffffff83168068010000000000000000612647565b90506133b08a70010000000000000000000000000000000083612647565b9850505b505050505050509392505050565b604080516060810182525f80825260208201819052918101919091528273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115613416579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b5f816020015173ffffffffffffffffffffffffffffffffffffffff16825f015173ffffffffffffffffffffffffffffffffffffffff1610613492575f5ffd5b8151602080840151604080860151815173ffffffffffffffffffffffffffffffffffffffff95861681860152949092168482015262ffffff90911660608085019190915281518085038201815260808501909252815191909201207fff0000000000000000000000000000000000000000000000000000000000000060a08401529085901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201527fe3572921be1688dba92df30c6781b8770499ff274d20ae9b325f4242634774fb60d582015260f501604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b5f5f5f8360020b126135be578260020b6135c5565b8260020b5f035b9050620d89e8811115613604576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816001165f0361362657700100000000000000000000000000000000613638565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561366c576ffff97272373d413259a46990580e213a0260801c5b600482161561368b576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156136aa576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156136c9576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156136e8576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615613707576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615613726576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613746576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613766576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613786576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156137a6576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156137c6576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156137e6576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615613806576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615613826576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613847576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613867576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613886576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156138a3576b048a170391f7dc42444e8fa20260801c5b5f8460020b13156138e157807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff816138dd576138dd61432a565b0490505b6401000000008106156138f55760016138f7565b5f5b60ff16602082901c0192505050919050565b5f60608284031215613919575f5ffd5b50919050565b5f6060828403121561392f575f5ffd5b6109078383613909565b6020810160048310613972577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b91905290565b73ffffffffffffffffffffffffffffffffffffffff81168114613999575f5ffd5b50565b5f5f5f606084860312156139ae575f5ffd5b83356139b981613978565b925060208401356139c981613978565b929592945050506040919091013590565b8015158114613999575f5ffd5b5f5f5f60a084860312156139f9575f5ffd5b8335613a04816139da565b9250613a138560208601613909565b929592945050506080919091013590565b5f5f5f60608486031215613a36575f5ffd5b8335613a4181613978565b95602085013595506040909401359392505050565b5f8151808452602084019350602083015f5b82811015613a86578151865260209586019590910190600101613a68565b5093949350505050565b606081525f613aa26060830186613a56565b8281036020840152613ab48186613a56565b8381036040850152845180825260208087019350909101905f5b81811015613af857835169ffffffffffffffffffff16835260209384019390920191600101613ace565b5090979650505050505050565b71ffffffffffffffffffffffffffffffffffff81168114613999575f5ffd5b5f5f5f60a08486031215613b36575f5ffd5b8335613b41816139da565b9250613b508560208601613909565b91506080840135613b6081613b05565b809150509250925092565b65ffffffffffff81168114613999575f5ffd5b5f60208284031215613b8e575f5ffd5b813561090781613b6b565b5f5f60208385031215613baa575f5ffd5b823567ffffffffffffffff811115613bc0575f5ffd5b8301601f81018513613bd0575f5ffd5b803567ffffffffffffffff811115613be6575f5ffd5b8560208260051b8401011115613bfa575f5ffd5b6020919091019590945092505050565b602080825282518282018190525f918401906040840190835b81811015613c8857835171ffffffffffffffffffffffffffffffffffff815116845271ffffffffffffffffffffffffffffffffffff6020820151166020850152604081015160070b604085015250606083019250602084019350600181019050613c23565b509095945050505050565b5f60208284031215613ca3575f5ffd5b813561090781613978565b5f82518060208501845e5f920191825250919050565b805f0b8114613999575f5ffd5b5f60208284031215613ce1575f5ffd5b813561090781613cc4565b606081018235613cfb81613978565b73ffffffffffffffffffffffffffffffffffffffff1682526020830135613d2181613978565b73ffffffffffffffffffffffffffffffffffffffff1660208301526040830135613d4a81613cc4565b805f0b60408401525092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040516060810167ffffffffffffffff81118282101715613da957613da9613d59565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613df657613df6613d59565b604052919050565b8051600781900b8114613e0f575f5ffd5b919050565b5f6060828403128015613e25575f5ffd5b50613e2e613d86565b8251613e3981613b05565b8152613e4760208401613dfe565b60208201526040830151613e5a81613b6b565b60408201529392505050565b5f60208284031215613e76575f5ffd5b815161090781613978565b805161ffff81168114613e0f575f5ffd5b5f5f5f5f5f5f5f60e0888a031215613ea8575f5ffd5b8751613eb381613978565b8097505060208801518060020b8114613eca575f5ffd5b9550613ed860408901613e81565b9450613ee660608901613e81565b9350613ef460808901613e81565b925060a088015160ff81168114613f09575f5ffd5b60c0890151909250613f1a816139da565b8091505092959891949750929550565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8082028115828204841417611e5f57611e5f613f2a565b5f60208284031215613f7e575f5ffd5b815162ffffff81168114610907575f5ffd5b805163ffffffff81168114613e0f575f5ffd5b5f5f5f5f60808587031215613fb6575f5ffd5b84516020860151909450613fc981613978565b9250613fd760408601613f90565b6060959095015193969295505050565b5f6060828403128015613ff8575f5ffd5b50614001613d86565b825161400c81613b05565b8152602083015161401c81613b05565b6020820152613e5a60408401613dfe565b5f6020828403121561403d575f5ffd5b5051919050565b5f60608284031215614054575f5ffd5b61405c613d86565b905061406782613e81565b815261407560208301613e81565b6020820152604082015164ffffffffff81168114614091575f5ffd5b604082015292915050565b5f6101008284031280156140ae575f5ffd5b506040516080810167ffffffffffffffff811182821017156140d2576140d2613d59565b6040526140df8484614044565b81526140ee8460608501614044565b602082015260c0830151614101816139da565b604082015261411260e08401613e81565b60608201529392505050565b80820180821115611e5f57611e5f613f2a565b81810381811115611e5f57611e5f613f2a565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215614181575f5ffd5b815169ffffffffffffffffffff81168114610907575f5ffd5b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036141ca576141ca613f2a565b5060010190565b71ffffffffffffffffffffffffffffffffffff8181168382160190811115611e5f57611e5f613f2a565b6001815b60018411156142365780850481111561421a5761421a613f2a565b600184161561422857908102905b60019390931c9280026141ff565b935093915050565b5f8261424c57506001611e5f565b8161425857505f611e5f565b816001811461426e576002811461427857614294565b6001915050611e5f565b60ff84111561428957614289613f2a565b50506001821b611e5f565b5060208310610133831016604e8410600b84101617156142b7575081810a611e5f565b6142e27fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846141fb565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561431457614314613f2a565b029392505050565b5f61090760ff84168361423e565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f68ffffffffffffffffff8316806143715761437161432a565b8068ffffffffffffffffff84160491505092915050565b68ffffffffffffffffff8181168382160190811115611e5f57611e5f613f2a565b5f826143b7576143b761432a565b500490565b5f6fffffffffffffffffffffffffffffffff8316806143dd576143dd61432a565b806fffffffffffffffffffffffffffffffff84160491505092915050565b5f606082840312801561440c575f5ffd5b50614415613d86565b825161442081613978565b8152602083015161443081613978565b60208201526040830151613e5a81613cc4565b5f60208284031215614453575f5ffd5b81516fffffffffffffffffffffffffffffffff81168114610907575f5ffd5b5f71ffffffffffffffffffffffffffffffffffff821671ffffffffffffffffffffffffffffffffffff841671ffffffffffffffffffffffffffffffffffff81830216925081830481148215176120e0576120e0613f2a565b602080825282518282018190525f918401906040840190835b81811015613c8857835163ffffffff168352602093840193909201916001016144e3565b5f67ffffffffffffffff82111561452057614520613d59565b5060051b60200190565b8051600681900b8114613e0f575f5ffd5b5f82601f83011261454a575f5ffd5b815161455d61455882614507565b613daf565b8082825260208201915060208360051b86010192508583111561457e575f5ffd5b602085015b838110156145a457805161459681613978565b835260209283019201614583565b5095945050505050565b5f5f604083850312156145bf575f5ffd5b825167ffffffffffffffff8111156145d5575f5ffd5b8301601f810185136145e5575f5ffd5b80516145f361455882614507565b8082825260208201915060208360051b850101925087831115614614575f5ffd5b6020840193505b8284101561463d5761462c8461452a565b82526020938401939091019061461b565b80955050505050602083015167ffffffffffffffff81111561465d575f5ffd5b6146698582860161453b565b9150509250929050565b61ffff8181168382160190811115611e5f57611e5f613f2a565b5f61ffff8316806146a0576146a061432a565b8061ffff84160691505092915050565b5f5f5f5f608085870312156146c3575f5ffd5b6146cc85613f90565b93506146da6020860161452a565b925060408501516146ea81613978565b60608601519092506146fb816139da565b939692955090935050565b63ffffffff8281168282160390811115611e5f57611e5f613f2a565b600682810b9082900b037fffffffffffffffffffffffffffffffffffffffffffffffffff800000000000008112667fffffffffffff82131715611e5f57611e5f613f2a565b5f8160060b8360060b8061477d5761477d61432a565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81147fffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000831416156147d1576147d1613f2a565b9005939250505056fea2646970667358221220b1198c8d5635964d92f0fa1ca2b543f9bd3340cdc3cef8dd9c97584c7124f89f64736f6c634300081c0033

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

0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf00000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e0000000000000000000000000b1c0fa0b789320044a6f623cfe5ebda9562602e3

-----Decoded View---------------
Arg [0] : vault (address): 0x4a35e7448Dad9cAc6B3e529050B5a6Ee56A0eDF0
Arg [1] : oracle (address): 0x2Ab530127a40a832B3e9AD2F0eC6Cdfee17542E0
Arg [2] : uniswapV3Factory (address): 0xB1c0fa0B789320044A6F623cFe5eBda9562602E3

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000004a35e7448dad9cac6b3e529050b5a6ee56a0edf0
Arg [1] : 0000000000000000000000002ab530127a40a832b3e9ad2f0ec6cdfee17542e0
Arg [2] : 000000000000000000000000b1c0fa0b789320044a6f623cfe5ebda9562602e3


Block Transaction 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

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.