S Price: $0.577893 (+11.64%)

Contract

0xE7E225194e81729b27e8FA5c1ebD801D502c016b

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update Handler S...18690052024-12-29 1:35:1923 days ago1735436119IN
0xE7E22519...D502c016b
0 S0.000072291
Register Hook17922842024-12-28 2:35:3224 days ago1735353332IN
0xE7E22519...D502c016b
0 S0.000071331
Register Hook17922832024-12-28 2:35:3124 days ago1735353331IN
0xE7E22519...D502c016b
0 S0.000071331
Update Handler S...17919932024-12-28 2:28:4224 days ago1735352922IN
0xE7E22519...D502c016b
0 S0.000072311

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WagmiV3Handler

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
shanghai EvmVersion
File 1 of 34 : WagmiV3Handler.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

import {V3BaseHandler} from "../V3BaseHandler.sol";
import {LiquidityManager} from "./LiquidityManager.sol";

import {IV3Pool} from "../../interfaces/handlers/V3/IV3Pool.sol";

/// @title WagmiV3Handler
/// @author 0xcarrot
/// @notice Handles Wagmi V3 specific operations
/// @dev Inherits from V3BaseHandler and LiquidityManager
contract WagmiV3Handler is V3BaseHandler, LiquidityManager {
    /// @notice Constructs the WagmiV3Handler contract
    /// @param _feeReceiver Address to receive fees
    /// @param _factory Address of the Wagmi V3 factory
    /// @param _pool_init_code_hash Initialization code hash for Wagmi V3 pools
    constructor(address _feeReceiver, address _factory, bytes32 _pool_init_code_hash)
        V3BaseHandler(_feeReceiver)
        LiquidityManager(_factory, _pool_init_code_hash)
    {}

    /// @notice Adds liquidity to a Wagmi V3 pool
    /// @dev Overrides the _addLiquidity function from V3BaseHandler
    /// @param self Whether the function is called internally or externally
    /// @param tki TokenIdInfo struct containing token and fee information
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 to add as liquidity
    /// @param amount1 The amount of token1 to add as liquidity
    /// @return l The amount of liquidity added
    /// @return a0 The actual amount of token0 added as liquidity
    /// @return a1 The actual amount of token1 added as liquidity
    function _addLiquidity(
        bool self,
        TokenIdInfo memory tki,
        int24 tickLower,
        int24 tickUpper,
        uint256 amount0,
        uint256 amount1
    ) internal virtual override returns (uint128 l, uint256 a0, uint256 a1) {
        if (!self) {
            (l, a0, a1,) = addLiquidity(
                LiquidityManager.AddLiquidityParams({
                    token0: tki.token0,
                    token1: tki.token1,
                    fee: tki.fee,
                    recipient: address(this),
                    tickLower: tickLower,
                    tickUpper: tickUpper,
                    amount0Desired: amount0,
                    amount1Desired: amount1,
                    amount0Min: amount0,
                    amount1Min: amount1
                })
            );
        } else {
            (l, a0, a1,) = WagmiV3Handler(address(this)).addLiquidity(
                LiquidityManager.AddLiquidityParams({
                    token0: tki.token0,
                    token1: tki.token1,
                    fee: tki.fee,
                    recipient: address(this),
                    tickLower: tickLower,
                    tickUpper: tickUpper,
                    amount0Desired: amount0,
                    amount1Desired: amount1,
                    amount0Min: amount0,
                    amount1Min: amount1
                })
            );
        }
    }

    /// @notice Removes liquidity from a Wagmi V3 pool
    /// @dev Overrides the _removeLiquidity function from V3BaseHandler
    /// @param _pool The Wagmi V3 pool
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param liquidity The amount of liquidity to remove
    /// @return amount0 The amount of token0 removed
    /// @return amount1 The amount of token1 removed
    function _removeLiquidity(IV3Pool _pool, int24 tickLower, int24 tickUpper, uint128 liquidity)
        internal
        virtual
        override
        returns (uint256 amount0, uint256 amount1)
    {
        (amount0, amount1) = _pool.burn(tickLower, tickUpper, liquidity);
    }
}

File 2 of 34 : V3BaseHandler.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

import {IHandler} from "../interfaces/IHandler.sol";
import {IHook} from "../interfaces/IHook.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {IV3Pool} from "../interfaces/handlers/V3/IV3Pool.sol";

import {ERC6909} from "../libraries/tokens/ERC6909.sol";
import {Math} from "openzeppelin-contracts/contracts/utils/math/Math.sol";
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {LiquidityAmounts} from "v3-periphery/libraries/LiquidityAmounts.sol";
import {TickMath} from "v3-core/libraries/TickMath.sol";
import {FullMath} from "v3-core/libraries/FullMath.sol";
import {FixedPoint128} from "v3-core/libraries/FixedPoint128.sol";

import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol";

/// @title V3BaseHandler
/// @author 0xcarrot
/// @notice Abstract contract for handling Uniswap V3 liquidity positions
/// @dev Implements IHandler interface and inherits from ERC6909 and Ownable
abstract contract V3BaseHandler is IHandler, ERC6909, Ownable {
    using Math for uint128;
    using TickMath for int24;
    using SafeERC20 for IERC20;

    /// @notice Struct to store information about a token ID
    struct TokenIdInfo {
        uint128 totalLiquidity;
        uint128 liquidityUsed;
        uint256 feeGrowthInside0LastX128;
        uint256 feeGrowthInside1LastX128;
        uint128 tokensOwed0;
        uint128 tokensOwed1;
        address token0;
        address token1;
        uint24 fee;
        uint128 reservedLiquidity;
    }

    /// @notice Struct for minting a new position
    struct MintPositionParams {
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
    }

    /// @notice Struct for burning an existing position
    struct BurnPositionParams {
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
    }

    /// @notice Struct for reserving liquidity
    struct ReserveOperation {
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
        bool isReserve;
    }

    /// @notice Struct for using a position
    struct UsePositionParams {
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidityToUse;
    }

    /// @notice Struct for un-using a position
    struct UnusePositionParams {
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidityToUnuse;
    }

    /// @notice Struct for donating to a position
    struct DonateParams {
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 amount0;
        uint128 amount1;
    }

    /// @notice Enum for wildcard actions
    enum WildcardActions {
        RESERVE_LIQUIDITY,
        COLLECT_FEES,
        SPLIT_POSITION
    }

    /// @notice Struct for reserved liquidity information
    struct ReserveLiquidityInfo {
        uint128 liquidity;
        uint64 lastReserve;
    }

    /// @notice Mapping of token IDs to their information
    mapping(uint256 => TokenIdInfo) public tokenIds;
    /// @notice Mapping of whitelisted applications
    mapping(address => bool) public whitelistedApps;
    /// @notice Mapping of reserved liquidity per user for each token ID
    mapping(uint256 => mapping(address => ReserveLiquidityInfo)) public reservedLiquidityPerUser;

    /// @notice Mapping of reserve cooldown per hook
    mapping(address => uint64) public reserveCooldownHook;

    /// @notice Mapping of registered hooks
    mapping(address => bool) public hookRegistered;

    /// @notice Mapping of hook permissions
    mapping(address => HookPermInfo) public hookPerms;

    /// @notice Address of the fee receiver
    address public feeReceiver;

    /// @notice Pause state of the contract
    bool pause;

    error NotWhitelisted();
    error InsufficientLiquidity();
    error BeforeReserveCooldown();
    error InvalidTicks();
    error HookNotRegistered();
    error Paused();
    error HookAlreadyRegistered();

    event LogMintPositionHandler(MintPositionParams params, address context, uint256 amount0, uint256 amount1);
    event LogBurnPositionHandler(BurnPositionParams params, address context, uint256 amount0, uint256 amount1);
    event LogUsePositionHandler(UsePositionParams params, address context, uint256 amount0, uint256 amount1);
    event LogUnusePositionHandler(UnusePositionParams params, address context, uint256 amount0, uint256 amount1);
    event LogDonateToPosition(DonateParams params, address context);
    event LogReservedLiquidity(ReserveOperation params, address context, uint256 lastReserve);
    event LogWithdrawReserveLiquidity(ReserveOperation params, address context, uint256 amount0, uint256 amount1);

    /// @notice Constructor for V3BaseHandler
    /// @param _feeReceiver Address to receive fees
    constructor(address _feeReceiver) Ownable(msg.sender) {
        feeReceiver = _feeReceiver;
    }

    /// @notice Checks if the caller is whitelisted
    function onlyWhitelisted() private view {
        if (!whitelistedApps[msg.sender]) revert NotWhitelisted();
        if (pause) revert Paused();
    }

    /// @notice Registers a new hook
    /// @param _hook Address of the hook to register
    /// @param _info Permission information for the hook
    function registerHook(address _hook, IHandler.HookPermInfo memory _info) external {
        if (hookRegistered[_hook]) {
            revert HookAlreadyRegistered();
        }

        hookPerms[_hook] = _info;
        hookRegistered[_hook] = true;
    }

    struct MintLiquidityInternalCache {
        bool self;
        uint256 tokenId;
        IV3Pool pool;
        address hook;
        uint128 liquidity;
        uint256 amount0;
        uint256 amount1;
        int24 tickLower;
        int24 tickUpper;
        address context;
    }

    /// @notice Mints a new position in the Uniswap V3 pool
    /// @param context The address context for minting
    /// @param _mintPositionData Encoded data for minting position
    /// @return sharesMinted The amount of shares minted
    function mintPositionHandler(address context, bytes calldata _mintPositionData) external returns (uint256) {
        onlyWhitelisted();

        (MintPositionParams memory _params, bytes memory hookData) =
            abi.decode(_mintPositionData, (MintPositionParams, bytes));

        if (hookPerms[_params.hook].onMint && hookRegistered[_params.hook]) {
            IHook(_params.hook).onMintBefore(hookData);
        }

        (uint128 liquidity,,) = mintInternal(
            MintLiquidityInternalCache({
                self: false,
                tokenId: uint256(
                    keccak256(abi.encode(address(this), _params.pool, _params.hook, _params.tickLower, _params.tickUpper))
                ),
                pool: _params.pool,
                hook: _params.hook,
                liquidity: _params.liquidity,
                amount0: 0,
                amount1: 0,
                tickLower: _params.tickLower,
                tickUpper: _params.tickUpper,
                context: context
            })
        );

        return liquidity;
    }

    function mintInternal(MintLiquidityInternalCache memory cache) private returns (uint128, uint256, uint256) {
        TokenIdInfo storage tki = tokenIds[cache.tokenId];

        if (tki.token0 == address(0)) {
            tki.token0 = cache.pool.token0();
            tki.token1 = cache.pool.token1();
            tki.fee = cache.pool.fee();
        }

        (uint160 sqrtPriceX96,) = _getCurrentSqrtPriceX96(cache.pool);

        if (cache.liquidity == 0) {
            cache.liquidity = LiquidityAmounts.getLiquidityForAmounts(
                sqrtPriceX96,
                cache.tickLower.getSqrtRatioAtTick(),
                cache.tickUpper.getSqrtRatioAtTick(),
                cache.amount0,
                cache.amount1
            );
        }

        if (cache.amount0 == 0 && cache.amount1 == 0) {
            (cache.amount0, cache.amount1) = LiquidityAmounts.getAmountsForLiquidity(
                sqrtPriceX96,
                cache.tickLower.getSqrtRatioAtTick(),
                cache.tickUpper.getSqrtRatioAtTick(),
                cache.liquidity
            );
        }

        (cache.liquidity, cache.amount0, cache.amount1) =
            _addLiquidity(cache.self, tki, cache.tickLower, cache.tickUpper, cache.amount0, cache.amount1);

        _feeCalculation(tki, cache.pool, cache.tickLower, cache.tickUpper);

        tki.totalLiquidity += cache.liquidity;

        _mint(cache.context, cache.tokenId, cache.liquidity);

        emit LogMintPositionHandler(
            MintPositionParams(cache.pool, cache.hook, cache.tickLower, cache.tickUpper, cache.liquidity),
            cache.context,
            cache.amount0,
            cache.amount1
        );

        return (cache.liquidity, cache.amount0, cache.amount1);
    }

    struct BurnLiquidityInternalCache {
        uint256 tokenId;
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
        address context;
        address receiver;
    }

    /// @notice Burns an existing position in the Uniswap V3 pool
    /// @param context The address context for burning
    /// @param _burnPositionData Encoded data for burning position
    /// @return The amount of liquidity burned
    function burnPositionHandler(address context, bytes calldata _burnPositionData) external returns (uint256) {
        onlyWhitelisted();

        (BurnPositionParams memory _params, bytes memory hookData) =
            abi.decode(_burnPositionData, (BurnPositionParams, bytes));

        if (hookPerms[_params.hook].onBurn && hookRegistered[_params.hook]) {
            IHook(_params.hook).onBurnBefore(hookData);
        }

        burnInternal(
            BurnLiquidityInternalCache({
                tokenId: uint256(
                    keccak256(abi.encode(address(this), _params.pool, _params.hook, _params.tickLower, _params.tickUpper))
                ),
                pool: _params.pool,
                hook: _params.hook,
                tickLower: _params.tickLower,
                tickUpper: _params.tickUpper,
                liquidity: _params.liquidity,
                context: context,
                receiver: context
            })
        );

        return _params.liquidity;
    }

    function burnInternal(BurnLiquidityInternalCache memory cache) private returns (uint256, uint256) {
        TokenIdInfo storage tki = tokenIds[cache.tokenId];

        if ((tki.totalLiquidity - tki.liquidityUsed) < cache.liquidity) {
            revert InsufficientLiquidity();
        }

        (uint256 amount0, uint256 amount1) = cache.pool.burn(cache.tickLower, cache.tickUpper, cache.liquidity);

        _feeCalculation(tki, cache.pool, cache.tickLower, cache.tickUpper);

        cache.pool.collect(cache.receiver, cache.tickLower, cache.tickUpper, uint128(amount0), uint128(amount1));

        tki.totalLiquidity -= cache.liquidity;

        _burn(cache.context, cache.tokenId, cache.liquidity);

        emit LogBurnPositionHandler(
            BurnPositionParams(cache.pool, cache.hook, cache.tickLower, cache.tickUpper, cache.liquidity),
            cache.context,
            amount0,
            amount1
        );

        return (amount0, amount1);
    }

    /// @notice Uses a portion of liquidity from an existing position
    /// @param _usePositionData Encoded data for using position
    /// @return An array of token addresses, an array of amounts, and the liquidity used
    function usePositionHandler(bytes calldata _usePositionData)
        external
        returns (address[] memory, uint256[] memory, uint256)
    {
        onlyWhitelisted();

        (UsePositionParams memory _params, bytes memory hookData) =
            abi.decode(_usePositionData, (UsePositionParams, bytes));

        uint256 tokenId = uint256(
            keccak256(abi.encode(address(this), _params.pool, _params.hook, _params.tickLower, _params.tickUpper))
        );

        TokenIdInfo storage tki = tokenIds[tokenId];

        if (hookPerms[_params.hook].onUse && hookRegistered[_params.hook]) {
            IHook(_params.hook).onPositionUseBefore(hookData);
        }

        if ((tki.totalLiquidity - tki.liquidityUsed) < _params.liquidityToUse) {
            revert InsufficientLiquidity();
        }

        (uint256 amount0, uint256 amount1) =
            _removeLiquidity(_params.pool, _params.tickLower, _params.tickUpper, _params.liquidityToUse);

        _params.pool.collect(msg.sender, _params.tickLower, _params.tickUpper, uint128(amount0), uint128(amount1));

        _feeCalculation(tki, _params.pool, _params.tickLower, _params.tickUpper);

        tki.liquidityUsed += _params.liquidityToUse;

        address[] memory tokens = new address[](2);
        tokens[0] = tki.token0;
        tokens[1] = tki.token1;

        uint256[] memory amounts = new uint256[](2);
        amounts[0] = amount0;
        amounts[1] = amount1;

        emit LogUsePositionHandler(_params, msg.sender, amount0, amount1);

        return (tokens, amounts, _params.liquidityToUse);
    }

    /// @notice Returns previously used liquidity to a position
    /// @param _unusePositionData Encoded data for un-using position
    /// @return An array of amounts and the liquidity returned
    function unusePositionHandler(bytes calldata _unusePositionData) external returns (uint256[] memory, uint256) {
        onlyWhitelisted();

        (UnusePositionParams memory _params, bytes memory hookData) =
            abi.decode(_unusePositionData, (UnusePositionParams, bytes));

        uint256 tokenId = uint256(
            keccak256(abi.encode(address(this), _params.pool, _params.hook, _params.tickLower, _params.tickUpper))
        );

        TokenIdInfo storage tki = tokenIds[tokenId];

        if (hookPerms[_params.hook].onUnuse && hookRegistered[_params.hook]) {
            IHook(_params.hook).onPositionUnUseBefore(hookData);
        }

        (uint160 sqrtPriceX96,) = _getCurrentSqrtPriceX96(_params.pool);

        (uint256 amount0, uint256 amount1) = LiquidityAmounts.getAmountsForLiquidity(
            sqrtPriceX96,
            _params.tickLower.getSqrtRatioAtTick(),
            _params.tickUpper.getSqrtRatioAtTick(),
            uint128(_params.liquidityToUnuse)
        );

        (uint128 liquidity,,) = _addLiquidity(false, tki, _params.tickLower, _params.tickUpper, amount0, amount1);

        _feeCalculation(tki, _params.pool, _params.tickLower, _params.tickUpper);

        if (tki.liquidityUsed >= liquidity) {
            tki.liquidityUsed -= liquidity;
        } else {
            tki.totalLiquidity += (liquidity - tki.liquidityUsed);
            tki.liquidityUsed = 0;
        }

        uint256[] memory amounts = new uint256[](2);
        amounts[0] = amount0;
        amounts[1] = amount1;

        _params.liquidityToUnuse = liquidity;

        emit LogUnusePositionHandler(_params, msg.sender, amount0, amount1);

        return (amounts, uint256(liquidity));
    }

    /// @notice Allows donation of tokens to a specific position
    /// @param _donateData Encoded data for donation
    /// @return An array of amounts and a placeholder value
    function donateToPosition(bytes calldata _donateData) external returns (uint256[] memory, uint256) {
        onlyWhitelisted();

        (DonateParams memory _params, bytes memory hookData) = abi.decode(_donateData, (DonateParams, bytes));

        uint256 tokenId = uint256(
            keccak256(abi.encode(address(this), _params.pool, _params.hook, _params.tickLower, _params.tickUpper))
        );

        if (hookPerms[_params.hook].onDonate && hookRegistered[_params.hook]) {
            IHook(_params.hook).onDonationBefore(hookData);
        }

        TokenIdInfo memory tki = tokenIds[tokenId];

        if (_params.amount0 > 0) {
            IERC20(tki.token0).safeTransferFrom(msg.sender, feeReceiver, _params.amount0);
        }

        if (_params.amount1 > 0) {
            IERC20(tki.token1).safeTransferFrom(msg.sender, feeReceiver, _params.amount1);
        }

        uint256[] memory amounts = new uint256[](2);
        amounts[0] = _params.amount0;
        amounts[1] = _params.amount1;

        emit LogDonateToPosition(_params, msg.sender);

        return (amounts, 0);
    }

    /// @notice Handles various wildcard actions
    /// @param context The address context for the action
    /// @param _wildcardData Encoded data for the wildcard action
    /// @return Encoded result of the wildcard action
    function wildcardHandler(address context, bytes calldata _wildcardData) external returns (bytes memory) {
        onlyWhitelisted();

        (WildcardActions wca, bytes memory _data) = abi.decode(_wildcardData, (WildcardActions, bytes));

        if (wca == WildcardActions.RESERVE_LIQUIDITY) {
            _reserveOps(context, _data);
        } else if (wca == WildcardActions.COLLECT_FEES) {
            _collectFees(_data);
        } else if (wca == WildcardActions.SPLIT_POSITION) {
            _splitPosition(_data);
        }

        return bytes("");
    }

    /// @notice Internal function to reserve liquidity
    /// @param context The address context for the operation
    /// @param _reserveOperation Encoded data for the reserve operation
    function _reserveOps(address context, bytes memory _reserveOperation) private {
        ReserveOperation memory _params = abi.decode(_reserveOperation, (ReserveOperation));

        uint256 tokenId = uint256(
            keccak256(abi.encode(address(this), _params.pool, _params.hook, _params.tickLower, _params.tickUpper))
        );

        TokenIdInfo storage tki = tokenIds[tokenId];

        ReserveLiquidityInfo storage rld = reservedLiquidityPerUser[tokenId][context];

        if (_params.isReserve) {
            rld.liquidity += _params.liquidity;
            rld.lastReserve = uint64(block.timestamp);

            tki.totalLiquidity -= _params.liquidity;

            tki.reservedLiquidity += _params.liquidity;

            _burn(context, tokenId, _params.liquidity);

            emit LogReservedLiquidity(_params, context, rld.lastReserve);
        } else {
            if (rld.lastReserve + reserveCooldownHook[_params.hook] > block.timestamp) revert BeforeReserveCooldown();

            if (((tki.totalLiquidity + tki.reservedLiquidity) - tki.liquidityUsed) < _params.liquidity) {
                revert InsufficientLiquidity();
            }

            (uint256 amount0, uint256 amount1) =
                _params.pool.burn(_params.tickLower, _params.tickUpper, _params.liquidity);

            _params.pool.collect(context, _params.tickLower, _params.tickUpper, uint128(amount0), uint128(amount1));

            _feeCalculation(tki, _params.pool, _params.tickLower, _params.tickUpper);

            tki.reservedLiquidity -= _params.liquidity;
            rld.liquidity -= _params.liquidity;

            emit LogWithdrawReserveLiquidity(_params, context, amount1, amount1);
        }
    }

    function _calculateTickDifference(int24 tick1, int24 tick2) private pure returns (uint256) {
        return uint256(int256(tick1 > tick2 ? tick1 - tick2 : tick2 - tick1));
    }

    struct SplitPositionParams {
        address user;
        IV3Pool pool;
        address hook;
        int24 tickLower;
        int24 tickUpper;
        int24[] tickSplits;
    }

    struct SplitPositionCache {
        uint160 sqrtPriceX96;
        uint256 userAmount0;
        uint256 userAmount1;
        uint256 initialAmount0;
        uint256 initialAmount1;
        int24 currentTick;
        int24 tickSpacing;
        int24 tLCurrentTick;
        int24 tUCurrentTick;
        uint256 ticksAtToken0;
        uint256 ticksAtToken1;
        uint256 currentTickDiff0;
        uint256 currentTickDiff1;
        uint256 amount0PerTick;
        uint256 amount1PerTick;
    }

    struct SplitPositionLoopCache {
        uint256 amount0ForRange;
        uint256 amount1ForRange;
        uint128 newLiquidity;
        uint256 added0;
        uint256 added1;
    }

    /// @notice Internal function to split a position into multiple positions
    /// @param _splitPositionData Encoded data for splitting the position
    function _splitPosition(bytes memory _splitPositionData) private {
        SplitPositionParams memory spp = abi.decode(_splitPositionData, (SplitPositionParams));

        if (spp.tickSplits[0] != spp.tickLower || spp.tickSplits[spp.tickSplits.length - 1] != spp.tickUpper) {
            revert InvalidTicks();
        }

        SplitPositionCache memory cache;

        (cache.sqrtPriceX96, cache.currentTick) = _getCurrentSqrtPriceX96(spp.pool);

        if (!hookPerms[spp.hook].allowSplit) revert HookNotRegistered();

        uint256 tokenId =
            uint256(keccak256(abi.encode(address(this), spp.pool, spp.hook, spp.tickLower, spp.tickUpper)));

        (cache.userAmount0, cache.userAmount1) = burnInternal(
            BurnLiquidityInternalCache({
                tokenId: tokenId,
                pool: spp.pool,
                hook: spp.hook,
                liquidity: uint128(balanceOf[spp.user][tokenId]),
                tickLower: spp.tickLower,
                tickUpper: spp.tickUpper,
                context: spp.user,
                receiver: address(this)
            })
        );

        SplitPositionLoopCache memory loopCache;

        // Calculate amounts per tick
        cache.tickSpacing = spp.pool.tickSpacing();

        cache.tLCurrentTick = cache.currentTick > 0
            ? cache.currentTick - (cache.currentTick % cache.tickSpacing)
            : cache.currentTick - (cache.tickSpacing + (cache.currentTick % cache.tickSpacing));
        cache.tUCurrentTick = cache.tLCurrentTick + cache.tickSpacing;

        bool isCurrentTickInRange = cache.currentTick > spp.tickLower && cache.currentTick < spp.tickUpper;

        cache.initialAmount0 = cache.userAmount0;
        cache.initialAmount1 = cache.userAmount1;

        if (isCurrentTickInRange) {
            cache.ticksAtToken0 = _calculateTickDifference(cache.currentTick, spp.tickSplits[spp.tickSplits.length - 1]);
            cache.ticksAtToken1 = _calculateTickDifference(cache.currentTick, spp.tickSplits[0]);

            cache.currentTickDiff0 = uint256(int256(cache.tUCurrentTick - cache.currentTick));
            cache.currentTickDiff1 = uint256(int256(cache.currentTick - cache.tLCurrentTick));

            loopCache.newLiquidity = LiquidityAmounts.getLiquidityForAmounts(
                cache.sqrtPriceX96,
                TickMath.getSqrtRatioAtTick(cache.tLCurrentTick),
                TickMath.getSqrtRatioAtTick(cache.tUCurrentTick),
                (cache.userAmount0 * cache.currentTickDiff0) / cache.ticksAtToken0,
                (cache.userAmount1 * cache.currentTickDiff1) / cache.ticksAtToken1
            );

            (loopCache.added0, loopCache.added1) = LiquidityAmounts.getAmountsForLiquidity(
                cache.sqrtPriceX96,
                TickMath.getSqrtRatioAtTick(cache.tLCurrentTick),
                TickMath.getSqrtRatioAtTick(cache.tUCurrentTick),
                loopCache.newLiquidity
            );

            cache.amount0PerTick =
                ((cache.userAmount0 - loopCache.added0) / (cache.ticksAtToken0 - cache.currentTickDiff0));

            cache.amount1PerTick =
                ((cache.userAmount1 - loopCache.added1) / (cache.ticksAtToken1 - cache.currentTickDiff1));
        } else {
            cache.ticksAtToken1 = _calculateTickDifference(spp.tickUpper, spp.tickLower);
            cache.ticksAtToken0 = cache.ticksAtToken1;

            cache.amount0PerTick = cache.userAmount0 / cache.ticksAtToken0;
            cache.amount1PerTick = cache.userAmount1 / cache.ticksAtToken1;
        }

        for (uint256 i; i < spp.tickSplits.length - 1; i++) {
            int24 tL = spp.tickSplits[i];
            int24 tU = spp.tickSplits[i + 1];

            if (tL >= tU) revert InvalidTicks();

            if (cache.currentTick > tU || cache.currentTick < tL) {
                uint256 tickRange;
                tickRange = _calculateTickDifference(tL, tU);
                // Calculate amounts based on tick range
                loopCache.amount0ForRange = cache.amount0PerTick * tickRange;
                loopCache.amount1ForRange = cache.amount1PerTick * tickRange;
            } else {
                if (tL != cache.tLCurrentTick || tU != cache.tUCurrentTick) {
                    revert InvalidTicks();
                }

                loopCache.amount0ForRange = (cache.initialAmount0 * cache.currentTickDiff0) / cache.ticksAtToken0;
                loopCache.amount1ForRange = (cache.initialAmount1 * cache.currentTickDiff1) / cache.ticksAtToken1;
            }

            (loopCache.newLiquidity, loopCache.added0, loopCache.added1) = mintInternal(
                MintLiquidityInternalCache({
                    self: true,
                    tokenId: uint256(keccak256(abi.encode(address(this), spp.pool, spp.hook, tL, tU))),
                    pool: spp.pool,
                    hook: spp.hook,
                    liquidity: 0,
                    amount0: loopCache.amount0ForRange,
                    amount1: loopCache.amount1ForRange,
                    tickLower: tL,
                    tickUpper: tU,
                    context: spp.user
                })
            );

            cache.userAmount0 -= loopCache.added0;
            cache.userAmount1 -= loopCache.added1;
        }

        TokenIdInfo memory tki = tokenIds[tokenId];

        // Transfer any remaining tokens to the user
        if (cache.userAmount0 > 0) {
            IERC20(tki.token0).safeTransfer(spp.user, cache.userAmount0);
        }
        if (cache.userAmount1 > 0) {
            IERC20(tki.token1).safeTransfer(spp.user, cache.userAmount1);
        }
    }

    /// @notice Calculates the tokens required for a position
    /// @param _positionData Encoded position data
    /// @return tokens An array of token addresses
    /// @return amounts An array of token amounts
    function _tokensToPull(bytes calldata _positionData) private view returns (address[] memory, uint256[] memory) {
        (MintPositionParams memory _params,) = abi.decode(_positionData, (MintPositionParams, bytes));

        (uint160 sqrtPriceX96,) = _getCurrentSqrtPriceX96(_params.pool);

        (uint256 amount0, uint256 amount1) = LiquidityAmounts.getAmountsForLiquidity(
            sqrtPriceX96,
            _params.tickLower.getSqrtRatioAtTick(),
            _params.tickUpper.getSqrtRatioAtTick(),
            uint128(_params.liquidity)
        );

        address[] memory tokens = new address[](2);
        tokens[0] = _params.pool.token0();
        tokens[1] = _params.pool.token1();

        uint256[] memory amounts = new uint256[](2);
        amounts[0] = amount0;
        amounts[1] = amount1;

        return (tokens, amounts);
    }

    /// @notice Calculates tokens required for un-using a position
    /// @param _unusePositionData Encoded data for un-using a position
    /// @return tokens An array of token addresses
    /// @return amounts An array of token amounts
    function tokensToPullForUnUse(bytes calldata _unusePositionData)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts)
    {
        return _tokensToPull(_unusePositionData);
    }

    /// @notice Calculates tokens required for donating to a position
    /// @param _donatePosition Encoded data for donation
    /// @return tokens An array of token addresses
    /// @return amounts An array of token amounts
    function tokensToPullForDonate(bytes calldata _donatePosition)
        external
        view
        returns (address[] memory, uint256[] memory)
    {
        (DonateParams memory _params,) = abi.decode(_donatePosition, (DonateParams, bytes));

        address[] memory tokens = new address[](2);
        tokens[0] = _params.pool.token0();
        tokens[1] = _params.pool.token1();

        uint256[] memory amounts = new uint256[](2);
        amounts[0] = _params.amount0;
        amounts[1] = _params.amount1;

        return (tokens, amounts);
    }

    /// @notice Calculates tokens required for wildcard actions
    /// @param _data wildcard data (unused in this implementation)
    /// @return tokens An array of token addresses (empty in this implementation)
    /// @return amounts An array of token amounts (empty in this implementation)
    function tokensToPullForWildcard(bytes calldata _data) external view returns (address[] memory, uint256[] memory) {
        address[] memory tokens = new address[](2);
        uint256[] memory amounts = new uint256[](2);
        return (tokens, amounts);
    }

    /// @notice Generates a unique identifier for a handler
    /// @param _data Encoded data for generating the identifier
    /// @return handlerIdentifierId The unique identifier
    function getHandlerIdentifier(bytes calldata _data) external view returns (uint256 handlerIdentifierId) {
        (address pool, address hook, int24 tickLower, int24 tickUpper) =
            abi.decode(_data, (address, address, int24, int24));

        return uint256(keccak256(abi.encode(address(this), pool, hook, tickLower, tickUpper)));
    }

    /// @notice Calculates tokens required for minting a position
    /// @param _mintPositionData Encoded data for minting a position
    /// @return tokens An array of token addresses
    /// @return amounts An array of token amounts
    function tokensToPullForMint(bytes calldata _mintPositionData)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts)
    {
        return _tokensToPull(_mintPositionData);
    }

    /// @notice Internal function to get the current sqrt price from a pool
    /// @param pool The Uniswap V3 pool
    /// @return sqrtPriceX96 The current sqrt price
    /// @return tick The current tick
    function _getCurrentSqrtPriceX96(IV3Pool pool) internal view returns (uint160 sqrtPriceX96, int24 tick) {
        (sqrtPriceX96, tick,,,,,) = pool.slot0();
    }

    /// @notice Internal function to add liquidity to a position
    /// @param self Whether the operation is performed by the contract itself
    /// @param tki Token ID information
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0
    /// @param amount1 The amount of token1
    /// @return liquidity The amount of liquidity added
    /// @return amount0 The actual amount of token0 used
    /// @return amount1 The actual amount of token1 used
    function _addLiquidity(
        bool self,
        TokenIdInfo memory tki,
        int24 tickLower,
        int24 tickUpper,
        uint256 amount0,
        uint256 amount1
    ) internal virtual returns (uint128, uint256, uint256) {}

    /// @notice Internal function to remove liquidity from a position
    /// @param _pool The Uniswap V3 pool
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param liquidity The amount of liquidity to remove
    /// @return amount0 The amount of token0 received
    /// @return amount1 The amount of token1 received
    function _removeLiquidity(IV3Pool _pool, int24 tickLower, int24 tickUpper, uint128 liquidity)
        internal
        virtual
        returns (uint256, uint256)
    {}

    /// @notice Internal function to compute the position key
    /// @param owner The owner of the position
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @return The position key
    function _computePositionKey(address owner, int24 tickLower, int24 tickUpper) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(owner, tickLower, tickUpper));
    }

    /// @notice Internal function to collect fees from a position
    /// @param _collectFeesData Encoded data for fee collection
    function _collectFees(bytes memory _collectFeesData) internal virtual {
        (IV3Pool _pool, address _hook, int24 _tickLower, int24 _tickUpper) =
            abi.decode(_collectFeesData, (IV3Pool, address, int24, int24));

        uint256 tokenId = uint256(keccak256(abi.encode(address(this), _pool, _hook, _tickLower, _tickUpper)));

        TokenIdInfo storage tki = tokenIds[tokenId];

        _removeLiquidity(_pool, _tickLower, _tickUpper, 0);

        _feeCalculation(tki, _pool, _tickLower, _tickUpper);

        _pool.collect(feeReceiver, _tickLower, _tickUpper, tki.tokensOwed0, tki.tokensOwed1);

        tki.tokensOwed0 = 0;
        tki.tokensOwed1 = 0;
    }

    /// @notice Internal function to calculate fees for a position
    /// @param _tki Token ID information
    /// @param _pool The Uniswap V3 pool
    /// @param _tickLower The lower tick of the position
    /// @param _tickUpper The upper tick of the position
    function _feeCalculation(TokenIdInfo storage _tki, IV3Pool _pool, int24 _tickLower, int24 _tickUpper)
        internal
        virtual
    {
        bytes32 positionKey = _computePositionKey(address(this), _tickLower, _tickUpper);
        (, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128,,) = _pool.positions(positionKey);
        unchecked {
            _tki.tokensOwed0 += uint128(
                FullMath.mulDiv(
                    feeGrowthInside0LastX128 - _tki.feeGrowthInside0LastX128,
                    _tki.totalLiquidity + _tki.reservedLiquidity - _tki.liquidityUsed,
                    FixedPoint128.Q128
                )
            );
            _tki.tokensOwed1 += uint128(
                FullMath.mulDiv(
                    feeGrowthInside1LastX128 - _tki.feeGrowthInside1LastX128,
                    _tki.totalLiquidity + _tki.reservedLiquidity - _tki.liquidityUsed,
                    FixedPoint128.Q128
                )
            );

            _tki.feeGrowthInside0LastX128 = feeGrowthInside0LastX128;
            _tki.feeGrowthInside1LastX128 = feeGrowthInside1LastX128;
        }
    }

    // Admin Functions

    /// @notice Updates various handler settings
    /// @param _app The app to update the whitelist status of
    /// @param _status The new whitelist status of the app
    /// @param _hook The hook to update the reserve cooldown for
    /// @param _newReserveCooldown The new reserve cooldown for the hook
    /// @param _newFeeReceiver The new fee receiver address
    function updateHandlerSettings(
        address _app,
        bool _status,
        address _hook,
        uint64 _newReserveCooldown,
        address _newFeeReceiver
    ) external onlyOwner {
        whitelistedApps[_app] = _status;
        reserveCooldownHook[_hook] = _newReserveCooldown;
        feeReceiver = _newFeeReceiver;
    }

    // SOS admin functions

    /// @notice Sweeps tokens from the contract
    /// @param _token The token to sweep
    /// @param _amount The amount of tokens to sweep
    function sweepTokens(address _token, uint256 _amount) external onlyOwner {
        IERC20(_token).safeTransfer(msg.sender, _amount);
    }

    /// @notice Emergency pauses the contract
    function emergencyPause() external onlyOwner {
        pause = true;
    }

    /// @notice Emergency unpauses the contract
    function emergencyUnpause() external onlyOwner {
        pause = false;
    }

    /// @notice Checks if the contract supports an interface
    /// @param interfaceId The Id of the interface
    /// @return bool True if the interface is supported
    function supportsInterface(bytes4 interfaceId) public view override(ERC6909) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

File 3 of 34 : LiquidityManager.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

// Interfaces
import {IUniswapV3MintCallback} from "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol";
import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

// Libraries
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {LiquidityAmounts} from "v3-periphery/libraries/LiquidityAmounts.sol";
import {TickMath} from "@uniswap/v3-core/contracts/libraries/TickMath.sol";

/// @title Liquidity management functions
/// @notice Internal functions for safely managing liquidity in Uniswap V3
abstract contract LiquidityManager is IUniswapV3MintCallback {
    address public immutable factory;
    bytes32 public immutable POOL_INIT_CODE_HASH;

    struct PoolKey {
        address token0;
        address token1;
        uint24 fee;
    }

    constructor(address _factory, bytes32 _pool_init_code_hash) {
        factory = _factory;
        POOL_INIT_CODE_HASH = _pool_init_code_hash;
    }

    struct MintCallbackData {
        PoolKey poolKey;
        address payer;
    }

    /// @inheritdoc IUniswapV3MintCallback
    function uniswapV3MintCallback(uint256 amount0Owed, uint256 amount1Owed, bytes calldata data) external override {
        MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));
        verifyCallback(factory, decoded.poolKey);

        if (amount0Owed > 0) {
            pay(decoded.poolKey.token0, decoded.payer, msg.sender, amount0Owed);
        }
        if (amount1Owed > 0) {
            pay(decoded.poolKey.token1, decoded.payer, msg.sender, amount1Owed);
        }
    }

    struct AddLiquidityParams {
        address token0;
        address token1;
        uint24 fee;
        address recipient;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
    }

    /// @notice Add liquidity to an initialized pool
    function addLiquidity(AddLiquidityParams memory params)
        public
        returns (uint128 liquidity, uint256 amount0, uint256 amount1, IUniswapV3Pool pool)
    {
        PoolKey memory poolKey = PoolKey({token0: params.token0, token1: params.token1, fee: params.fee});

        pool = IUniswapV3Pool(computeAddress(factory, poolKey));

        // compute the liquidity amount
        {
            (uint160 sqrtPriceX96,,,,,,) = pool.slot0();
            uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(params.tickLower);
            uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(params.tickUpper);

            liquidity = LiquidityAmounts.getLiquidityForAmounts(
                sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, params.amount0Desired, params.amount1Desired
            );
        }

        (amount0, amount1) = pool.mint(
            params.recipient,
            params.tickLower,
            params.tickUpper,
            liquidity,
            abi.encode(MintCallbackData({poolKey: poolKey, payer: msg.sender}))
        );
    }

    /// @param token The token to pay
    /// @param payer The entity that must pay
    /// @param recipient The entity that will receive payment
    /// @param value The amount to pay
    function pay(address token, address payer, address recipient, uint256 value) internal {
        // pull payment
        if (payer == address(this)) {
            SafeERC20.safeTransfer(IERC20(token), recipient, value);
        } else {
            SafeERC20.safeTransferFrom(IERC20(token), payer, recipient, value);
        }
    }

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

    function computeAddress(address _factory, PoolKey memory key) internal view 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
                        )
                    )
                )
            )
        );
    }

    function verifyCallback(address _factory, address tokenA, address tokenB, uint24 fee)
        internal
        view
        returns (IUniswapV3Pool pool)
    {
        return verifyCallback(_factory, getPoolKey(tokenA, tokenB, fee));
    }

    function verifyCallback(address _factory, PoolKey memory poolKey) internal view returns (IUniswapV3Pool pool) {
        pool = IUniswapV3Pool(computeAddress(_factory, poolKey));
        require(msg.sender == address(pool));
    }
}

File 4 of 34 : IV3Pool.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

import "./pool/IV3PoolImmutables.sol";
import "./pool/IV3PoolState.sol";
import "./pool/IV3PoolDerivedState.sol";
import "./pool/IV3PoolActions.sol";
import "./pool/IV3PoolOwnerActions.sol";
import "./pool/IV3PoolEvents.sol";

/// @title The interface for a  V3 Pool
/// @notice A  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 IV3Pool is
    IV3PoolImmutables,
    IV3PoolState,
    IV3PoolDerivedState,
    IV3PoolActions,
    IV3PoolOwnerActions,
    IV3PoolEvents
{}

File 5 of 34 : IHandler.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

interface IHandler {
    struct HookPermInfo {
        bool onMint;
        bool onBurn;
        bool onUse;
        bool onUnuse;
        bool onDonate;
        bool allowSplit;
    }

    function registerHook(address _hook, HookPermInfo memory _info) external;

    function getHandlerIdentifier(bytes calldata _data) external view returns (uint256 handlerIdentifierId);

    function tokensToPullForMint(bytes calldata _mintPositionData)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    function mintPositionHandler(address context, bytes calldata _mintPositionData)
        external
        returns (uint256 sharesMinted);

    function burnPositionHandler(address context, bytes calldata _burnPositionData)
        external
        returns (uint256 sharesBurned);

    function usePositionHandler(bytes calldata _usePositionData)
        external
        returns (address[] memory tokens, uint256[] memory amounts, uint256 liquidityUsed);

    function wildcardHandler(address context, bytes calldata _wildcardData)
        external
        returns (bytes memory wildcardRetData);

    function tokensToPullForUnUse(bytes calldata _unusePositionData)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    function unusePositionHandler(bytes calldata _unusePositionData)
        external
        returns (uint256[] memory amounts, uint256 liquidity);

    function donateToPosition(bytes calldata _donatePosition)
        external
        returns (uint256[] memory amounts, uint256 liquidity);

    function tokensToPullForDonate(bytes calldata _donatePosition)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);

    function tokensToPullForWildcard(bytes calldata _wildcardData)
        external
        view
        returns (address[] memory tokens, uint256[] memory amounts);
}

File 6 of 34 : IHook.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

interface IHook {
    function onMintBefore(bytes calldata _data) external;
    function onBurnBefore(bytes calldata _data) external;

    function onPositionUseBefore(bytes calldata _data) external;
    function onPositionUnUseBefore(bytes calldata _data) external;

    function onDonationBefore(bytes calldata _data) external;

    function onWildcardBefore(bytes calldata _data) external;

    function onMintAfter(bytes calldata _data) external;
    function onBurnAfter(bytes calldata _data) external;

    function onPositionUseAfter(bytes calldata _data) external;
    function onPositionUnUseAfter(bytes calldata _data) external;

    function onDonationAfter(bytes calldata _data) external;

    function onWildcardAfter(bytes calldata _data) external;
}

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

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
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);
}

File 8 of 34 : ERC6909.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

/// @notice Minimalist and gas efficient standard ERC6909 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC6909.sol)
/// @dev Copied from the commit at 4b47a19038b798b4a33d9749d25e570443520647
/// @dev This contract has been modified from the implementation at the above link.
abstract contract ERC6909 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event OperatorSet(address indexed owner, address indexed operator, bool approved);

    event Approval(address indexed owner, address indexed spender, uint256 indexed id, uint256 amount);

    event Transfer(address caller, address indexed from, address indexed to, uint256 indexed id, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                             ERC6909 STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(address => mapping(address => bool)) public isOperator;

    mapping(address => mapping(uint256 => uint256)) public balanceOf;

    mapping(address => mapping(address => mapping(uint256 => uint256))) public allowance;

    /*//////////////////////////////////////////////////////////////
                              ERC6909 LOGIC
    //////////////////////////////////////////////////////////////*/

    function transfer(address receiver, uint256 id, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender][id] -= amount;

        balanceOf[receiver][id] += amount;

        emit Transfer(msg.sender, msg.sender, receiver, id, amount);

        return true;
    }

    function transferFrom(address sender, address receiver, uint256 id, uint256 amount) public virtual returns (bool) {
        if (msg.sender != sender && !isOperator[sender][msg.sender]) {
            uint256 allowed = allowance[sender][msg.sender][id];
            if (allowed != type(uint256).max) {
                allowance[sender][msg.sender][id] = allowed - amount;
            }
        }

        balanceOf[sender][id] -= amount;

        balanceOf[receiver][id] += amount;

        emit Transfer(msg.sender, sender, receiver, id, amount);

        return true;
    }

    function approve(address spender, uint256 id, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender][id] = amount;

        emit Approval(msg.sender, spender, id, amount);

        return true;
    }

    function setOperator(address operator, bool approved) public virtual returns (bool) {
        isOperator[msg.sender][operator] = approved;

        emit OperatorSet(msg.sender, operator, approved);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == 0x01ffc9a7 // ERC165 Interface ID for ERC165
            || interfaceId == 0x0f632fb3; // ERC165 Interface ID for ERC6909
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address receiver, uint256 id, uint256 amount) internal virtual {
        balanceOf[receiver][id] += amount;

        emit Transfer(msg.sender, address(0), receiver, id, amount);
    }

    function _burn(address sender, uint256 id, uint256 amount) internal virtual {
        balanceOf[sender][id] -= amount;

        emit Transfer(msg.sender, sender, address(0), id, amount);
    }
}

File 9 of 34 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // 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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            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 for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the 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.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // 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 preconditions 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 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 10 of 34 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

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

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

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

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 11 of 34 : LiquidityAmounts.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import '@uniswap/v3-core/contracts/libraries/FullMath.sol';
import '@uniswap/v3-core/contracts/libraries/FixedPoint96.sol';

/// @title Liquidity amount functions
/// @notice Provides functions for computing liquidity amounts from token amounts and prices
library LiquidityAmounts {
    /// @notice Downcasts uint256 to uint128
    /// @param x The uint258 to be downcasted
    /// @return y The passed value, downcasted to uint128
    function toUint128(uint256 x) private pure returns (uint128 y) {
        require((y = uint128(x)) == x);
    }

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

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

    /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current
    /// pool prices and the prices at the tick boundaries
    /// @param sqrtRatioX96 A sqrt price representing the current pool prices
    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
    /// @param amount0 The amount of token0 being sent in
    /// @param amount1 The amount of token1 being sent in
    /// @return liquidity The maximum amount of liquidity received
    function getLiquidityForAmounts(
        uint160 sqrtRatioX96,
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint256 amount0,
        uint256 amount1
    ) internal pure returns (uint128 liquidity) {
        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

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

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

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

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

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

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

    /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current
    /// pool prices and the prices at the tick boundaries
    /// @param sqrtRatioX96 A sqrt price representing the current pool prices
    /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
    /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
    /// @param liquidity The liquidity being valued
    /// @return amount0 The amount of token0
    /// @return amount1 The amount of token1
    function getAmountsForLiquidity(
        uint160 sqrtRatioX96,
        uint160 sqrtRatioAX96,
        uint160 sqrtRatioBX96,
        uint128 liquidity
    ) internal pure returns (uint256 amount0, uint256 amount1) {
        if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);

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

File 12 of 34 : TickMath.sol
// 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;
        }
    }
}

File 13 of 34 : FullMath.sol
// 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
library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(
        uint256 a,
        uint256 b,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = a * b
            // Compute the product mod 2**256 and mod 2**256 - 1
            // then use the Chinese Remainder Theorem to reconstruct
            // the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2**256 + prod0
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(a, b, not(0))
                prod0 := mul(a, b)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

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

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

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

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

            // Factor powers of two out of denominator
            // Compute largest power of two divisor of denominator.
            // Always >= 1.
            uint256 twos = (0 - denominator) & 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;
        }
    }

    /// @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) {
        unchecked {
            result = mulDiv(a, b, denominator);
            if (mulmod(a, b, denominator) > 0) {
                require(result < type(uint256).max);
                result++;
            }
        }
    }
}

File 14 of 34 : FixedPoint128.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.4.0;

/// @title FixedPoint128
/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
library FixedPoint128 {
    uint256 internal constant Q128 = 0x100000000000000000000000000000000;
}

File 15 of 34 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

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

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

File 17 of 34 : 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 18 of 34 : IV3PoolImmutables.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.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 IV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

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

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

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

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

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

File 19 of 34 : IV3PoolState.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.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 IV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

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

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

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

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

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

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

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

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

File 20 of 34 : IV3PoolDerivedState.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.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 IV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

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

File 21 of 34 : IV3PoolActions.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IV3PoolActions {
    /// @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 IV3MintCallback#V3MintCallback
    /// 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 IV3SwapCallback#V3SwapCallback
    /// @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 IV3FlashCallback#V3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external;

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

File 22 of 34 : IV3PoolOwnerActions.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IV3PoolOwnerActions {
    /// @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 23 of 34 : IV3PoolEvents.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

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

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

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

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

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

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

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

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

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

File 24 of 34 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 25 of 34 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

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

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

File 27 of 34 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

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

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

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

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

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

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

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

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

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// @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
        );
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 33 of 34 : 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 34 of 34 : 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);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "v3-core/=lib/v3-core/contracts/",
    "v3-periphery/=lib/v3-periphery/contracts/",
    "@uniswap/v3-core/=lib/v3-core/",
    "@uniswap/v3-periphery/=lib/v3-periphery/",
    "@openzeppelin/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_feeReceiver","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"bytes32","name":"_pool_init_code_hash","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"BeforeReserveCooldown","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"HookAlreadyRegistered","type":"error"},{"inputs":[],"name":"HookNotRegistered","type":"error"},{"inputs":[],"name":"InsufficientLiquidity","type":"error"},{"inputs":[],"name":"InvalidTicks","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"T","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"}],"indexed":false,"internalType":"struct V3BaseHandler.BurnPositionParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"LogBurnPositionHandler","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"amount0","type":"uint128"},{"internalType":"uint128","name":"amount1","type":"uint128"}],"indexed":false,"internalType":"struct V3BaseHandler.DonateParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"}],"name":"LogDonateToPosition","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"}],"indexed":false,"internalType":"struct V3BaseHandler.MintPositionParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"LogMintPositionHandler","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"bool","name":"isReserve","type":"bool"}],"indexed":false,"internalType":"struct V3BaseHandler.ReserveOperation","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"},{"indexed":false,"internalType":"uint256","name":"lastReserve","type":"uint256"}],"name":"LogReservedLiquidity","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidityToUnuse","type":"uint128"}],"indexed":false,"internalType":"struct V3BaseHandler.UnusePositionParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"LogUnusePositionHandler","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidityToUse","type":"uint128"}],"indexed":false,"internalType":"struct V3BaseHandler.UsePositionParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"LogUsePositionHandler","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"bool","name":"isReserve","type":"bool"}],"indexed":false,"internalType":"struct V3BaseHandler.ReserveOperation","name":"params","type":"tuple"},{"indexed":false,"internalType":"address","name":"context","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"LogWithdrawReserveLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"OperatorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"POOL_INIT_CODE_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"internalType":"struct LiquidityManager.AddLiquidityParams","name":"params","type":"tuple"}],"name":"addLiquidity","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"context","type":"address"},{"internalType":"bytes","name":"_burnPositionData","type":"bytes"}],"name":"burnPositionHandler","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_donateData","type":"bytes"}],"name":"donateToPosition","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyUnpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"getHandlerIdentifier","outputs":[{"internalType":"uint256","name":"handlerIdentifierId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hookPerms","outputs":[{"internalType":"bool","name":"onMint","type":"bool"},{"internalType":"bool","name":"onBurn","type":"bool"},{"internalType":"bool","name":"onUse","type":"bool"},{"internalType":"bool","name":"onUnuse","type":"bool"},{"internalType":"bool","name":"onDonate","type":"bool"},{"internalType":"bool","name":"allowSplit","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hookRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"context","type":"address"},{"internalType":"bytes","name":"_mintPositionData","type":"bytes"}],"name":"mintPositionHandler","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hook","type":"address"},{"components":[{"internalType":"bool","name":"onMint","type":"bool"},{"internalType":"bool","name":"onBurn","type":"bool"},{"internalType":"bool","name":"onUse","type":"bool"},{"internalType":"bool","name":"onUnuse","type":"bool"},{"internalType":"bool","name":"onDonate","type":"bool"},{"internalType":"bool","name":"allowSplit","type":"bool"}],"internalType":"struct IHandler.HookPermInfo","name":"_info","type":"tuple"}],"name":"registerHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"reserveCooldownHook","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"reservedLiquidityPerUser","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint64","name":"lastReserve","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sweepTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIds","outputs":[{"internalType":"uint128","name":"totalLiquidity","type":"uint128"},{"internalType":"uint128","name":"liquidityUsed","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint128","name":"reservedLiquidity","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_donatePosition","type":"bytes"}],"name":"tokensToPullForDonate","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_mintPositionData","type":"bytes"}],"name":"tokensToPullForMint","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_unusePositionData","type":"bytes"}],"name":"tokensToPullForUnUse","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"tokensToPullForWildcard","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Owed","type":"uint256"},{"internalType":"uint256","name":"amount1Owed","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3MintCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_unusePositionData","type":"bytes"}],"name":"unusePositionHandler","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_app","type":"address"},{"internalType":"bool","name":"_status","type":"bool"},{"internalType":"address","name":"_hook","type":"address"},{"internalType":"uint64","name":"_newReserveCooldown","type":"uint64"},{"internalType":"address","name":"_newFeeReceiver","type":"address"}],"name":"updateHandlerSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_usePositionData","type":"bytes"}],"name":"usePositionHandler","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedApps","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"context","type":"address"},{"internalType":"bytes","name":"_wildcardData","type":"bytes"}],"name":"wildcardHandler","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"nonpayable","type":"function"}]

60c060405234801561000f575f80fd5b50604051615e5a380380615e5a83398101604081905261002e916100fb565b818184338061005657604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61005f8161008f565b50600a80546001600160a01b0319166001600160a01b039283161790559190911660805260a05250610134915050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b80516001600160a01b03811681146100f6575f80fd5b919050565b5f805f6060848603121561010d575f80fd5b610116846100e0565b9250610124602085016100e0565b9150604084015190509250925092565b60805160a051615cf061016a5f395f81816106bf015261335501525f8181610555015281816114dd0152611d7f0152615cf05ff3fe608060405234801561000f575f80fd5b5060043610610228575f3560e01c80639981bb9b1161012a578063d58778d6116100b4578063e1b130d611610079578063e1b130d6146106f4578063e88c9ffd14610782578063eb148be414610795578063f2fde38b146107b5578063fe99049a146107c8575f80fd5b8063d58778d61461058a578063d9843c111461067a578063dc6fd8ab146106ba578063dec66036146106e1578063e0f19adf146103d5575f80fd5b8063b6363cf2116100fa578063b6363cf214610500578063b8ea4a841461052a578063bdab027b1461053d578063c45a015514610550578063d348799714610577575f80fd5b80639981bb9b146104635780639f1c8473146104a9578063b220e470146104cb578063b3f00674146104ed575f80fd5b8063558a7297116101b6578063742b5fdd1161017b578063742b5fdd146103d55780637b3fd965146103f6578063893e81ec146104095780638cf699981461041c5780638da5cb5b1461043e575f80fd5b8063558a72971461030b578063598af9e71461031e5780635bbc40681461034e57806363f558c8146103ba578063715018a6146103cd575f80fd5b80632b4d93ea116101fc5780632b4d93ea146102b2578063426a8493146102d35780634a4e3bd5146102e65780634d0b1de3146102f057806351858e2714610303575f80fd5b8062fdd58e1461022c57806301ffc9a714610269578063095bcdb61461028c5780631575e9481461029f575b5f80fd5b61025661023a366004614996565b600160209081525f928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61027c6102773660046149c0565b6107db565b6040519015158152602001610260565b61027c61029a3660046149e7565b6107eb565b6102566102ad366004614a56565b610892565b6102c56102c0366004614aa6565b610a3a565b604051610260929190614b1e565b61027c6102e13660046149e7565b610df3565b6102ee610e57565b005b6102c56102fe366004614aa6565b610e6e565b6102ee61116a565b61027c610319366004614b4c565b611187565b61025661032c366004614b83565b600260209081525f938452604080852082529284528284209052825290205481565b61039361035c366004614bc1565b600660209081525f92835260408084209091529082529020546001600160801b03811690600160801b90046001600160401b031682565b604080516001600160801b0390931683526001600160401b03909116602083015201610260565b6102566103c8366004614aa6565b6111f4565b6102ee611249565b6103e86103e3366004614aa6565b61125c565b604051610260929190614c1d565b610256610404366004614a56565b611274565b6102ee610417366004614c41565b61141e565b61027c61042a366004614cb9565b60056020525f908152604090205460ff1681565b6003546001600160a01b03165b6040516001600160a01b039091168152602001610260565b610476610471366004614db9565b611494565b604080516001600160801b0390951685526020850193909352918301526001600160a01b03166060820152608001610260565b61027c6104b7366004614cb9565b60086020525f908152604090205460ff1681565b6104de6104d9366004614aa6565b6116ab565b60405161026093929190614e67565b600a5461044b906001600160a01b031681565b61027c61050e366004614e9c565b5f60208181529281526040808220909352908152205460ff1681565b6103e8610538366004614aa6565b611a8b565b6102ee61054b366004614ec8565b611c6a565b61044b7f000000000000000000000000000000000000000000000000000000000000000081565b6102ee610585366004614f7b565b611d6b565b610610610598366004614fc9565b600460208190525f918252604090912080546001820154600283015460038401549484015460058501546006909501546001600160801b0380861697600160801b9687900482169795969495828216959091048216936001600160a01b039081169390821692600160a01b90920462ffffff1691168a565b604080516001600160801b039b8c168152998b1660208b01528901979097526060880195909552928716608087015290861660a08601526001600160a01b0390811660c08601521660e084015262ffffff1661010083015290911661012082015261014001610260565b6106a2610688366004614cb9565b60076020525f90815260409020546001600160401b031681565b6040516001600160401b039091168152602001610260565b6102567f000000000000000000000000000000000000000000000000000000000000000081565b6102ee6106ef366004614996565b611de6565b610749610702366004614cb9565b60096020525f908152604090205460ff8082169161010081048216916201000082048116916301000000810482169164010000000082048116916501000000000090041686565b604080519615158752941515602087015292151593850193909352151560608401529015156080830152151560a082015260c001610260565b6103e8610790366004614aa6565b611e06565b6107a86107a3366004614a56565b611e5a565b604051610260919061502d565b6102ee6107c3366004614cb9565b611efa565b61027c6107d636600461503f565b611f3c565b5f6107e582612098565b92915050565b335f908152600160209081526040808320858452909152812080548391908390610816908490615096565b90915550506001600160a01b0384165f9081526001602090815260408083208684529091528120805484929061084d9084906150a9565b909155505060408051338082526020820185905285926001600160a01b038816925f80516020615c9b83398151915291015b60405180910390a45060015b9392505050565b5f61089b6120ca565b5f806108a9848601866151d4565b6020828101516001600160a01b03165f908152600990915260409020549193509150610100900460ff1680156108fb57506020808301516001600160a01b03165f9081526008909152604090205460ff165b1561095e5781602001516001600160a01b031663e849a8b6826040518263ffffffff1660e01b8152600401610930919061502d565b5f604051808303815f87803b158015610947575f80fd5b505af1158015610959573d5f803e3d5ffd5b505050505b604080516101008101825283516020850151928501516060860151610a22948493610992933093919291610120870161521f565b604051602081830303815290604052805190602001205f1c8152602001845f01516001600160a01b0316815260200184602001516001600160a01b03168152602001846040015160020b8152602001846060015160020b815260200184608001516001600160801b03168152602001886001600160a01b03168152602001886001600160a01b0316815250612124565b505050608001516001600160801b0316949350505050565b60605f610a456120ca565b5f80610a53858701876151d4565b915091505f30835f0151846020015185604001518660600151604051602001610a8095949392919061521f565b60408051808303601f1901815291815281516020928301205f81815260048452828120878501516001600160a01b03168252600990945291909120549092506301000000900460ff168015610af157506020808501516001600160a01b03165f9081526008909152604090205460ff165b15610b545783602001516001600160a01b03166340b62019846040518263ffffffff1660e01b8152600401610b26919061502d565b5f604051808303815f87803b158015610b3d575f80fd5b505af1158015610b4f573d5f803e3d5ffd5b505050505b5f610b61855f01516123cb565b5090505f80610b9483610b7a896040015160020b61243d565b610b8a8a6060015160020b61243d565b8a60800151612758565b604080516101408101825287546001600160801b038082168352600160801b918290048116602084015260018a01548385015260028a015460608085019190915260038b0154808316608086015292909204811660a084015260048a01546001600160a01b0390811660c085015260058b015490811660e0850152600160a01b900462ffffff1661010084015260068a015416610120830152918b0151918b01519395509193505f92610c4c928492909187876127f3565b50509050610c6785895f01518a604001518b60600151612982565b84546001600160801b03808316600160801b9092041610610ccf57845481908690601090610ca6908490600160801b90046001600160801b0316615255565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550610d2c565b8454610ceb90600160801b90046001600160801b031682615255565b855486905f90610d059084906001600160801b0316615274565b82546101009290920a6001600160801b038181021990931691831602179091558654168655505b6040805160028082526060820183525f9260208301908036833701905050905083815f81518110610d5f57610d5f615293565b6020026020010181815250508281600181518110610d7f57610d7f615293565b60209081029190910101526001600160801b03821660808a01526040517f9947dcc0369e358b6658b3c737e9b50fb988f069f55f189f250076b4db69937490610dcf908b903390889088906152a7565b60405180910390a199506001600160801b03169750505050505050505b9250929050565b335f8181526002602090815260408083206001600160a01b03881680855290835281842087855290925280832085905551919285927fb3fd5071835887567a0671151121894ddccc2842f1d10bedad13e0d17cace9a79061087f9087815260200190565b610e5f612b1b565b600a805460ff60a01b19169055565b60605f610e796120ca565b5f80610e8785870187615324565b915091505f30835f0151846020015185604001518660600151604051602001610eb495949392919061521f565b60408051808303601f190181529181528151602092830120858301516001600160a01b03165f9081526009909352912054909150640100000000900460ff168015610f1b57506020808401516001600160a01b03165f9081526008909152604090205460ff165b15610f7e5782602001516001600160a01b0316638b5ef33a836040518263ffffffff1660e01b8152600401610f50919061502d565b5f604051808303815f87803b158015610f67575f80fd5b505af1158015610f79573d5f803e3d5ffd5b505050505b5f8181526004602081815260409283902083516101408101855281546001600160801b038082168352600160801b91829004811694830194909452600183015495820195909552600282015460608201526003820154808416608080840191909152959004831660a0820152928101546001600160a01b0390811660c0850152600582015490811660e0850152600160a01b900462ffffff16610100840152600601548116610120830152918501519091161561106657600a54608085015160c0830151611066926001600160a01b03918216923392909116906001600160801b0316612b48565b60a08401516001600160801b0316156110aa57600a5460a085015160e08301516110aa926001600160a01b03918216923392909116906001600160801b0316612b48565b6040805160028082526060820183525f9260208301908036833701905050905084608001516001600160801b0316815f815181106110ea576110ea615293565b6020026020010181815250508460a001516001600160801b03168160018151811061111757611117615293565b6020026020010181815250507fd56018ecc6a046635457cebc1f2716e82f7fed949bf224bc2f3f58e2178682c085336040516111549291906153d2565b60405180910390a1985f98509650505050505050565b611172612b1b565b600a805460ff60a01b1916600160a01b179055565b335f818152602081815260408083206001600160a01b038716808552908352818420805460ff191687151590811790915591519182529293917fceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267910160405180910390a350600192915050565b5f808080806112058688018861544c565b9350935093509350308484848460405160200161122695949392919061521f565b60408051601f198184030181529190528051602090910120979650505050505050565b611251612b1b565b61125a5f612bb5565b565b6060806112698484612c06565b915091509250929050565b5f61127d6120ca565b5f8061128b848601866151d4565b6020808301516001600160a01b03165f90815260099091526040902054919350915060ff1680156112d857506020808301516001600160a01b03165f9081526008909152604090205460ff165b1561133b5781602001516001600160a01b0316633fc32173826040518263ffffffff1660e01b815260040161130d919061502d565b5f604051808303815f87803b158015611324575f80fd5b505af1158015611336573d5f803e3d5ffd5b505050505b5f6114086040518061014001604052805f1515815260200130865f015187602001518860400151896060015160405160200161137b95949392919061521f565b604051602081830303815290604052805190602001205f1c8152602001855f01516001600160a01b0316815260200185602001516001600160a01b0316815260200185608001516001600160801b031681526020015f81526020015f8152602001856040015160020b8152602001856060015160020b8152602001896001600160a01b0316815250612e12565b50506001600160801b0316979650505050505050565b611426612b1b565b6001600160a01b039485165f908152600560209081526040808320805460ff1916971515979097179096559386168152600790935292909120805467ffffffffffffffff19166001600160401b03909216919091179055600a80546001600160a01b03191691909216179055565b5f805f805f6040518060600160405280875f01516001600160a01b0316815260200187602001516001600160a01b03168152602001876040015162ffffff1681525090506115027f0000000000000000000000000000000000000000000000000000000000000000826132b5565b91505f826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015611541573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061156591906154c1565b50505050505090505f61157b886080015161243d565b90505f61158b8960a0015161243d565b90506115a28383838c60c001518d60e0015161339b565b9750505050816001600160a01b0316633c8a7d8d876060015188608001518960a00151896040518060400160405280888152602001336001600160a01b031681525060405160200161162f9190815180516001600160a01b03908116835260208083015182168185015260409283015162ffffff1692840192909252920151909116606082015260800190565b6040516020818303038152906040526040518663ffffffff1660e01b815260040161165e959493929190615553565b60408051808303815f875af1158015611679573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061169d919061559f565b959790965091935090915050565b6060805f6116b76120ca565b5f806116c5868801886151d4565b915091505f30835f01518460200151856040015186606001516040516020016116f295949392919061521f565b60408051808303601f1901815291815281516020928301205f81815260048452828120878501516001600160a01b031682526009909452919091205490925062010000900460ff16801561176257506020808501516001600160a01b03165f9081526008909152604090205460ff165b156117c55783602001516001600160a01b031663753f19fb846040518263ffffffff1660e01b8152600401611797919061502d565b5f604051808303815f87803b1580156117ae575f80fd5b505af11580156117c0573d5f803e3d5ffd5b505050505b608084015181546001600160801b03918216916117ec91600160801b810482169116615255565b6001600160801b031610156118145760405163bb55fd2760e01b815260040160405180910390fd5b5f80611831865f015187604001518860600151896080015161345c565b87516040808a015160608b015191516309e3d67b60e31b81529496509294506001600160a01b0390911692634f1eb3d892611874923392889088906004016155c1565b60408051808303815f875af115801561188f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118b391906155fe565b50506118cc83875f015188604001518960600151612982565b6080860151835484906010906118f3908490600160801b90046001600160801b0316615274565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505f60026001600160401b0381111561193157611931614cd4565b60405190808252806020026020018201604052801561195a578160200160208202803683370190505b50600485015481519192506001600160a01b03169082905f9061197f5761197f615293565b6001600160a01b03928316602091820292909201015260058501548251911690829060019081106119b2576119b2615293565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183525f93919290918301908036833701905050905083815f815181106119ff576119ff615293565b6020026020010181815250508281600181518110611a1f57611a1f615293565b6020026020010181815250507f8643ccc443265e37c9da35348e57363bd63b37b6112bca61947776a86b637a3888338686604051611a6094939291906152a7565b60405180910390a160809790970151909c969b506001600160801b0316995094975050505050505050565b6060805f611a9b84860186615324565b506040805160028082526060820183529293505f929091602083019080368337019050509050815f01516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b24919061562b565b815f81518110611b3657611b36615293565b60200260200101906001600160a01b031690816001600160a01b031681525050815f01516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b95573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb9919061562b565b81600181518110611bcc57611bcc615293565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183525f93919290918301908036833701905050905082608001516001600160801b0316815f81518110611c2657611c26615293565b6020026020010181815250508260a001516001600160801b031681600181518110611c5357611c53615293565b602090810291909101015290969095509350505050565b6001600160a01b0382165f9081526008602052604090205460ff1615611ca3576040516325c3d4c360e01b815260040160405180910390fd5b6001600160a01b039091165f908152600960209081526040808320845181548487015184880151606089015160808a015160a0909a01511515650100000000000265ff0000000000199a1515640100000000029a909a1665ffff000000001991151563010000000263ff0000001993151562010000029390931663ffff0000199415156101000261ff00199715159790971661ffff1990961695909517959095179290921692909217919091171617949094179093556008905220805460ff19166001179055565b5f611d7882840184615646565b9050611da77f0000000000000000000000000000000000000000000000000000000000000000825f01516134ee565b508415611dc2578051516020820151611dc29190338861350f565b8315611ddf57611ddf815f0151602001518260200151338761350f565b5050505050565b611dee612b1b565b611e026001600160a01b038316338361353b565b5050565b604080516002808252606082810190935282915f9181602001602082028036833750506040805160028082526060820183529394505f93909250906020830190803683375093989197509095505050505050565b6060611e646120ca565b5f80611e72848601866156e9565b90925090505f826002811115611e8a57611e8a615722565b03611e9e57611e998682613571565b611ee2565b6001826002811115611eb257611eb2615722565b03611ec057611e9981613a27565b6002826002811115611ed457611ed4615722565b03611ee257611ee281613b47565b505060408051602081019091525f8152949350505050565b611f02612b1b565b6001600160a01b038116611f3057604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b611f3981612bb5565b50565b5f336001600160a01b03861614801590611f7757506001600160a01b0385165f9081526020818152604080832033845290915290205460ff16155b15611fe7576001600160a01b0385165f90815260026020908152604080832033845282528083208684529091529020545f198114611fe557611fb98382615096565b6001600160a01b0387165f90815260026020908152604080832033845282528083208884529091529020555b505b6001600160a01b0385165f90815260016020908152604080832086845290915281208054849290612019908490615096565b90915550506001600160a01b0384165f908152600160209081526040808320868452909152812080548492906120509084906150a9565b9091555050604080513381526020810184905284916001600160a01b0380881692908916915f80516020615c9b833981519152910160405180910390a4506001949350505050565b5f6301ffc9a760e01b6001600160e01b0319831614806107e55750506001600160e01b031916630f632fb360e01b1490565b335f9081526005602052604090205460ff166120f957604051630b094f2760e31b815260040160405180910390fd5b600a54600160a01b900460ff161561125a576040516313d0ff5960e31b815260040160405180910390fd5b80515f90815260046020526040812060a083015181548392916001600160801b039081169161215d91600160801b820481169116615255565b6001600160801b031610156121855760405163bb55fd2760e01b815260040160405180910390fd5b60208401516060850151608086015160a087015160405163a34123a760e01b8152600293840b60048201529190920b60248201526001600160801b0390911660448201525f9182916001600160a01b039091169063a34123a79060640160408051808303815f875af11580156121fd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612221919061559f565b9150915061223d83876020015188606001518960800151612982565b85602001516001600160a01b0316634f1eb3d88760e001518860600151896080015186866040518663ffffffff1660e01b81526004016122819594939291906155c1565b60408051808303815f875af115801561229c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122c091906155fe565b505060a0860151835484905f906122e19084906001600160801b0316615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055506123248660c00151875f01518860a001516001600160801b03166144c6565b7ff6712e9ab46ec463b822b25c7cd53a85bb9386675c5c5d547c78a4ebed1bd7816040518060a0016040528088602001516001600160a01b0316815260200188604001516001600160a01b03168152602001886060015160020b8152602001886080015160020b81526020018860a001516001600160801b03168152508760c0015184846040516123b894939291906152a7565b60405180910390a1909590945092505050565b5f80826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015612409573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061242d91906154c1565b5094989397509295505050505050565b5f805f8360020b12612452578260020b612459565b8260020b5f035b9050620d89e881111561247f576040516315e4079d60e11b815260040160405180910390fd5b5f816001165f0361249457600160801b6124a6565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156124da576ffff97272373d413259a46990580e213a0260801c5b60048216156124f9576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612518576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612537576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612556576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612575576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612594576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156125b4576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156125d4576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156125f4576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612614576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612634576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612654576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612674576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612694576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156126b5576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156126d5576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156126f4576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615612711576b048a170391f7dc42444e8fa20260801c5b5f8460020b131561273057805f198161272c5761272c615736565b0490505b640100000000810615612744576001612746565b5f5b60ff16602082901c0192505050919050565b5f80836001600160a01b0316856001600160a01b03161115612778579293925b846001600160a01b0316866001600160a01b0316116127a35761279c858585614538565b91506127ea565b836001600160a01b0316866001600160a01b031610156127dc576127c8868585614538565b91506127d58587856145a6565b90506127ea565b6127e78585856145a6565b90505b94509492505050565b5f805f886128895761287c6040518061014001604052808a60c001516001600160a01b031681526020018a60e001516001600160a01b031681526020018a610100015162ffffff168152602001306001600160a01b031681526020018960020b81526020018860020b815260200187815260200186815260200187815260200186815250611494565b5091945092509050612976565b306001600160a01b0316639981bb9b6040518061014001604052808b60c001516001600160a01b031681526020018b60e001516001600160a01b031681526020018b610100015162ffffff168152602001306001600160a01b031681526020018a60020b81526020018960020b8152602001888152602001878152602001888152602001878152506040518263ffffffff1660e01b815260040161292d919061574a565b6080604051808303815f875af1158015612949573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061296d9190615805565b50919450925090505b96509650969350505050565b604080516bffffffffffffffffffffffff193060601b1660208083019190915260e885811b603484015284901b60378301528251808303601a018152603a830193849052805191012063514ea4bf60e01b909252603e81018290525f9081906001600160a01b0387169063514ea4bf90605e0160a060405180830381865afa158015612a10573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a349190615843565b505060018a01548a5460068c0154939650919450612a7993508503916001600160801b03600160801b80840482169382169282169290920192909203909116906145f0565b6003880180546001600160801b0380821690930183166fffffffffffffffffffffffffffffffff199091161790556002880154885460068a0154612adc9392850392600160801b80840482169382169282169290920192909203909116906145f0565b6003880180546001600160801b03600160801b808304821690940181169093029216919091179055600187019190915560029095019490945550505050565b6003546001600160a01b0316331461125a5760405163118cdaa760e01b8152336004820152602401611f27565b6040516001600160a01b038481166024830152838116604483015260648201839052612baf9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061469a565b50505050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6060805f612c16848601866151d4565b5090505f612c26825f01516123cb565b5090505f80612c5983612c3f866040015160020b61243d565b612c4f876060015160020b61243d565b8760800151612758565b6040805160028082526060820183529395509193505f9290602083019080368337019050509050845f01516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cbf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ce3919061562b565b815f81518110612cf557612cf5615293565b60200260200101906001600160a01b031690816001600160a01b031681525050845f01516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d54573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d78919061562b565b81600181518110612d8b57612d8b615293565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183525f93919290918301908036833701905050905083815f81518110612dd857612dd8615293565b6020026020010181815250508281600181518110612df857612df8615293565b602090810291909101015290999098509650505050505050565b6020808201515f9081526004918290526040812091820154909182918291906001600160a01b0316612fd95784604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e7e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ea2919061562b565b816004015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555084604001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f09573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f2d919061562b565b816005015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555084604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f94573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fb89190615893565b8160050160146101000a81548162ffffff021916908362ffffff1602179055505b5f612fe786604001516123cb565b50905085608001516001600160801b03165f0361304157613032816130128860e0015160020b61243d565b61302389610100015160020b61243d565b8960a001518a60c0015161339b565b6001600160801b031660808701525b60a0860151158015613055575060c0860151155b15613094576130898161306e8860e0015160020b61243d565b61307f89610100015160020b61243d565b8960800151612758565b60c088015260a08701525b8551604080516101408101825284546001600160801b038082168352600160801b9182900481166020840152600187015493830193909352600286015460608301526003860154808416608084015204821660a08083019190915260048601546001600160a01b0390811660c080850191909152600588015491821660e080860191909152600160a01b90920462ffffff16610100808601919091526006890154909516610120850152908b0151938b0151918b0151908b015161315b95949291906127f3565b60c089015260a08801526001600160801b03166080870152604086015160e08701516101008801516131909285929091612982565b6080860151825483905f906131af9084906001600160801b0316615274565b92506101000a8154816001600160801b0302191690836001600160801b031602179055506131f4866101200151876020015188608001516001600160801b03166146fb565b7fe37ed9ef07c82bfef5e4b1503d49939505996bb0aea458cb274ba82e934f86e66040518060a0016040528088604001516001600160a01b0316815260200188606001516001600160a01b031681526020018860e0015160020b815260200188610100015160020b815260200188608001516001600160801b03168152508761012001518860a001518960c0015160405161329294939291906152a7565b60405180910390a150505050608082015160a083015160c0909301519093909150565b5f81602001516001600160a01b0316825f01516001600160a01b0316106132da575f80fd5b815160208084015160408086015181516001600160a01b0395861681860152949092168482015262ffffff90911660608085019190915281518085038201815260808501909252815191909201206001600160f81b031960a08401529085901b6bffffffffffffffffffffffff191660a183015260b58201527f000000000000000000000000000000000000000000000000000000000000000060d582015260f50160408051601f1981840301815291905280516020909101209392505050565b5f836001600160a01b0316856001600160a01b031611156133ba579293925b846001600160a01b0316866001600160a01b0316116133e5576133de858585614764565b9050613453565b836001600160a01b0316866001600160a01b03161015613445575f61340b878686614764565b90505f6134198789866147c5565b9050806001600160801b0316826001600160801b03161061343a578061343c565b815b92505050613453565b6134508585846147c5565b90505b95945050505050565b60405163a34123a760e01b8152600284810b600483015283900b60248201526001600160801b03821660448201525f9081906001600160a01b0387169063a34123a79060640160408051808303815f875af11580156134bd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134e1919061559f565b9097909650945050505050565b5f6134f983836132b5565b9050336001600160a01b038216146107e5575f80fd5b306001600160a01b0384160361352f5761352a84838361353b565b612baf565b612baf84848484612b48565b6040516001600160a01b0383811660248301526044820183905261356c91859182169063a9059cbb90606401612b7d565b505050565b5f8180602001905181019061358691906158ae565b90505f30825f01518360200151846040015185606001516040516020016135b195949392919061521f565b60408051601f1981840301815291815281516020928301205f81815260048452828120600685528382206001600160a01b038a1683529094529190912060a08501519193509015613754576080840151815482905f9061361b9084906001600160801b0316615274565b82546101009290920a6001600160801b03818102199093169183160217909155825467ffffffffffffffff60801b1916600160801b426001600160401b0316021783556080860151845490925084915f9161367891859116615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508360800151826006015f8282829054906101000a90046001600160801b03166136c59190615274565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613701868486608001516001600160801b03166144c6565b80546040517f3de445284e77f1fdf8fefe5c00363b9c7da97f34e3e07617973d5b16adf756e8916137479187918a91600160801b9091046001600160401b031690615996565b60405180910390a1613a1f565b6020808501516001600160a01b03165f9081526007909152604090205481544291613793916001600160401b0391821691600160801b909104166159cd565b6001600160401b031611156137bb57604051635ff1b24b60e11b815260040160405180910390fd5b6080840151825460068401546001600160801b0392831692600160801b83048116926137ea9282169116615274565b6137f49190615255565b6001600160801b0316101561381c5760405163bb55fd2760e01b815260040160405180910390fd5b835160408086015160608701516080880151925163a34123a760e01b8152600292830b6004820152910b60248201526001600160801b0390911660448201525f9182916001600160a01b039091169063a34123a79060640160408051808303815f875af115801561388f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138b3919061559f565b87516040808a015160608b015191516309e3d67b60e31b81529496509294506001600160a01b0390911692634f1eb3d8926138f6928d92889088906004016155c1565b60408051808303815f875af1158015613911573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061393591906155fe565b505061394e84875f015188604001518960600151612982565b60808601516006850180545f9061396f9084906001600160801b0316615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508560800151835f015f8282829054906101000a90046001600160801b03166139bb9190615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055507f6aa9934a1cc17e51db83b5b01a58a2331f4e98dd932a53ffa875e244a09d290186898384604051613a1494939291906159ec565b60405180910390a150505b505050505050565b5f805f8084806020019051810190613a3f9190615a20565b93509350935093505f3085858585604051602001613a6195949392919061521f565b60408051601f1981840301815291815281516020928301205f818152600490935290822090925090613a989087908690869061345c565b5050613aa681878686612982565b600a5460038201546040516309e3d67b60e31b81526001600160a01b0389811693634f1eb3d893613af7939290911691899189916001600160801b0380831692600160801b900416906004016155c1565b60408051808303815f875af1158015613b12573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b3691906155fe565b50505f600390910155505050505050565b5f81806020019051810190613b5c9190615aef565b9050806060015160020b8160a001515f81518110613b7c57613b7c615293565b602002602001015160020b141580613bcc5750806080015160020b8160a0015160018360a0015151613bae9190615096565b81518110613bbe57613bbe615293565b602002602001015160020b14155b15613bea57604051631434ed7f60e01b815260040160405180910390fd5b613c69604051806101e001604052805f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f60020b81526020015f60020b81526020015f60020b81526020015f60020b81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b613c7682602001516123cb565b60020b60a08301526001600160a01b0390811682526040838101519091165f9081526009602052205465010000000000900460ff16613cc857604051632a1b540760e01b815260040160405180910390fd5b5f308360200151846040015185606001518660800151604051602001613cf295949392919061521f565b60408051601f19818403018152828252805160209182012061010084018352808452868201516001600160a01b039081168584015287840151811685850152606080890151600290810b918701919091526080808a015190910b90860152875181165f9081526001845284812083825290935292909120546001600160801b031660a0840152855190911660c08301523060e08301529150613d9390612124565b836020018460400182815250828152505050613ddb6040518060a001604052805f81526020015f81526020015f6001600160801b031681526020015f81526020015f81525090565b83602001516001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613e1b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613e3f9190615bb4565b600290810b60c085015260a08401515f910b13613e8d578260c001518360a00151613e6a9190615bcf565b8360c00151613e799190615bf0565b8360a00151613e889190615c15565b613eb0565b8260c001518360a00151613ea19190615bcf565b8360a00151613eb09190615c15565b60020b60e0840181905260c0840151613ec891615bf0565b600290810b610100850152606085015160a08501515f9291820b910b138015613efe5750846080015160020b8460a0015160020b125b6020850151606086015260408501516080860152905080156140ef57613f568460a001518660a0015160018860a0015151613f399190615096565b81518110613f4957613f49615293565b6020026020010151614801565b84610120018181525050613f7e8460a001518660a001515f81518110613f4957613f49615293565b61014085015260a0840151610100850151613f999190615c15565b60020b61016085015260e084015160a0850151613fb69190615c15565b60020b610180850152835160e08501516140319190613fd49061243d565b613fe287610100015161243d565b8761012001518861016001518960200151613ffd9190615c3a565b6140079190615c51565b8861014001518961018001518a604001516140229190615c3a565b61402c9190615c51565b61339b565b6001600160801b03166040830152835160e085015161406c91906140549061243d565b61406287610100015161243d565b8560400151612758565b6080840152606083015261016084015161012085015161408c9190615096565b826060015185602001516140a09190615096565b6140aa9190615c51565b6101a08501526101808401516101408501516140c69190615096565b826080015185604001516140da9190615096565b6140e49190615c51565b6101c0850152614142565b61410185608001518660600151614801565b6101408501819052610120850181905260208501516141209190615c51565b6101a0850152610140840151604085015161413b9190615c51565b6101c08501525b5f5b60018660a00151516141569190615096565b8110156143c4575f8660a00151828151811061417457614174615293565b602002602001015190505f8760a0015183600161419191906150a9565b815181106141a1576141a1615293565b602002602001015190508060020b8260020b126141d157604051631434ed7f60e01b815260040160405180910390fd5b8060020b8760a0015160020b13806141f257508160020b8760a0015160020b125b15614233575f6142028383614801565b905080886101a001516142159190615c3a565b86526101c0880151614228908290615c3a565b6020870152506142c7565b8660e0015160020b8260020b141580614257575086610100015160020b8160020b14155b1561427557604051631434ed7f60e01b815260040160405180910390fd5b86610120015187610160015188606001516142909190615c3a565b61429a9190615c51565b855261014087015161018088015160808901516142b79190615c3a565b6142c19190615c51565b60208601525b614371604051806101400160405280600115158152602001308b602001518c60400151878760405160200161430095949392919061521f565b60408051601f19818403018152918152815160209283012083528c8201516001600160a01b03908116848401528d8201518116918401919091525f6060840152895160808401529089015160a0830152600286810b60c084015285900b60e08301528b511661010090910152612e12565b6080880152606087018190526001600160801b03909116604087015260208801805161439e908390615096565b90525060808501516040880180516143b7908390615096565b9052505050600101614144565b505f8381526004602081815260409283902083516101408101855281546001600160801b038082168352600160801b91829004811683860152600184015496830196909652600283015460608301526003830154808716608084015204851660a0820152928101546001600160a01b0390811660c0850152600582015490811660e0850152600160a01b900462ffffff16610100840152600601549092166101208201529085015115614492578551602086015160c0830151614492926001600160a01b039091169161353b565b6040850151156144bd578551604086015160e08301516144bd926001600160a01b039091169161353b565b50505050505050565b6001600160a01b0383165f908152600160209081526040808320858452909152812080548392906144f8908490615096565b9091555050604080513381526020810183905283915f916001600160a01b038716915f80516020615c9b83398151915291015b60405180910390a4505050565b5f826001600160a01b0316846001600160a01b03161115614557579192915b836001600160a01b0316614590606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166145f0565b8161459d5761459d615736565b04949350505050565b5f826001600160a01b0316846001600160a01b031611156145c5579192915b6145e8826001600160801b03168585036001600160a01b0316600160601b6145f0565b949350505050565b5f80805f19858709858702925082811083820303915050805f03614624575f8411614619575f80fd5b50829004905061088b565b80841161462f575f80fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f6146ae6001600160a01b03841683614832565b905080515f141580156146d25750808060200190518101906146d09190615c64565b155b1561356c57604051635274afe760e01b81526001600160a01b0384166004820152602401611f27565b6001600160a01b0383165f9081526001602090815260408083208584529091528120805483929061472d9084906150a9565b9091555050604080513381526020810183905283916001600160a01b038616915f915f80516020615c9b833981519152910161452b565b5f826001600160a01b0316846001600160a01b03161115614783579192915b5f6147a5856001600160a01b0316856001600160a01b0316600160601b6145f0565b90506134536147c084838888036001600160a01b03166145f0565b61483f565b5f826001600160a01b0316846001600160a01b031611156147e4579192915b6145e86147c083600160601b8787036001600160a01b03166145f0565b5f8160020b8360020b1361481e576148198383615c15565b614828565b6148288284615c15565b60020b9392505050565b606061088b83835f614859565b806001600160801b0381168114614854575f80fd5b919050565b60608147101561487e5760405163cd78605960e01b8152306004820152602401611f27565b5f80856001600160a01b031684866040516148999190615c7f565b5f6040518083038185875af1925050503d805f81146148d3576040519150601f19603f3d011682016040523d82523d5f602084013e6148d8565b606091505b50915091506148e88683836148f2565b9695505050505050565b606082614907576149028261494e565b61088b565b815115801561491e57506001600160a01b0384163b155b1561494757604051639996b31560e01b81526001600160a01b0385166004820152602401611f27565b508061088b565b80511561495e5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114611f39575f80fd5b803561485481614977565b5f80604083850312156149a7575f80fd5b82356149b281614977565b946020939093013593505050565b5f602082840312156149d0575f80fd5b81356001600160e01b03198116811461088b575f80fd5b5f805f606084860312156149f9575f80fd5b8335614a0481614977565b95602085013595506040909401359392505050565b5f8083601f840112614a29575f80fd5b5081356001600160401b03811115614a3f575f80fd5b602083019150836020828501011115610dec575f80fd5b5f805f60408486031215614a68575f80fd5b8335614a7381614977565b925060208401356001600160401b03811115614a8d575f80fd5b614a9986828701614a19565b9497909650939450505050565b5f8060208385031215614ab7575f80fd5b82356001600160401b03811115614acc575f80fd5b614ad885828601614a19565b90969095509350505050565b5f8151808452602084019350602083015f5b82811015614b14578151865260209586019590910190600101614af6565b5093949350505050565b604081525f614b306040830185614ae4565b90508260208301529392505050565b8015158114611f39575f80fd5b5f8060408385031215614b5d575f80fd5b8235614b6881614977565b91506020830135614b7881614b3f565b809150509250929050565b5f805f60608486031215614b95575f80fd5b8335614ba081614977565b92506020840135614bb081614977565b929592945050506040919091013590565b5f8060408385031215614bd2575f80fd5b823591506020830135614b7881614977565b5f8151808452602084019350602083015f5b82811015614b145781516001600160a01b0316865260209586019590910190600101614bf6565b604081525f614c2f6040830185614be4565b82810360208401526134538185614ae4565b5f805f805f60a08688031215614c55575f80fd5b8535614c6081614977565b94506020860135614c7081614b3f565b93506040860135614c8081614977565b925060608601356001600160401b0381168114614c9b575f80fd5b91506080860135614cab81614977565b809150509295509295909350565b5f60208284031215614cc9575f80fd5b813561088b81614977565b634e487b7160e01b5f52604160045260245ffd5b60405161014081016001600160401b0381118282101715614d0b57614d0b614cd4565b60405290565b60405160c081016001600160401b0381118282101715614d0b57614d0b614cd4565b604051606081016001600160401b0381118282101715614d0b57614d0b614cd4565b604051601f8201601f191681016001600160401b0381118282101715614d7d57614d7d614cd4565b604052919050565b62ffffff81168114611f39575f80fd5b803561485481614d85565b8060020b8114611f39575f80fd5b803561485481614da0565b5f610140828403128015614dcb575f80fd5b50614dd4614ce8565b614ddd8361498b565b8152614deb6020840161498b565b6020820152614dfc60408401614d95565b6040820152614e0d6060840161498b565b6060820152614e1e60808401614dae565b6080820152614e2f60a08401614dae565b60a082015260c0838101359082015260e080840135908201526101008084013590820152610120928301359281019290925250919050565b606081525f614e796060830186614be4565b8281036020840152614e8b8186614ae4565b915050826040830152949350505050565b5f8060408385031215614ead575f80fd5b8235614eb881614977565b91506020830135614b7881614977565b5f8082840360e0811215614eda575f80fd5b8335614ee581614977565b925060c0601f1982011215614ef8575f80fd5b50614f01614d11565b6020840135614f0f81614b3f565b81526040840135614f1f81614b3f565b60208201526060840135614f3281614b3f565b60408201526080840135614f4581614b3f565b606082015260a0840135614f5881614b3f565b608082015260c0840135614f6b81614b3f565b60a0820152919491935090915050565b5f805f8060608587031215614f8e575f80fd5b843593506020850135925060408501356001600160401b03811115614fb1575f80fd5b614fbd87828801614a19565b95989497509550505050565b5f60208284031215614fd9575f80fd5b5035919050565b5f5b83811015614ffa578181015183820152602001614fe2565b50505f910152565b5f8151808452615019816020860160208601614fe0565b601f01601f19169290920160200192915050565b602081525f61088b6020830184615002565b5f805f8060808587031215615052575f80fd5b843561505d81614977565b9350602085013561506d81614977565b93969395505050506040820135916060013590565b634e487b7160e01b5f52601160045260245ffd5b818103818111156107e5576107e5615082565b808201808211156107e5576107e5615082565b6001600160801b0381168114611f39575f80fd5b5f60a082840312156150e0575f80fd5b60405160a081016001600160401b038111828210171561510257615102614cd4565b604052905080823561511381614977565b8152602083013561512381614977565b6020820152604083013561513681614da0565b6040820152606083013561514981614da0565b6060820152608083013561515c816150bc565b6080919091015292915050565b5f82601f830112615178575f80fd5b81356001600160401b0381111561519157615191614cd4565b6151a4601f8201601f1916602001614d55565b8181528460208386010111156151b8575f80fd5b816020850160208301375f918101602001919091529392505050565b5f8060c083850312156151e5575f80fd5b6151ef84846150d0565b915060a08301356001600160401b03811115615209575f80fd5b61521585828601615169565b9150509250929050565b6001600160a01b0395861681529385166020850152919093166040830152600292830b606083015290910b608082015260a00190565b6001600160801b0382811682821603908111156107e5576107e5615082565b6001600160801b0381811683821601908111156107e5576107e5615082565b634e487b7160e01b5f52603260045260245ffd5b6101008101615300828760018060a01b03815116825260018060a01b036020820151166020830152604081015160020b6040830152606081015160020b60608301526001600160801b0360808201511660808301525050565b6001600160a01b039490941660a082015260c081019290925260e090910152919050565b5f8082840360e0811215615336575f80fd5b60c0811215615343575f80fd5b5061534c614d11565b833561535781614977565b8152602084013561536781614977565b6020820152604084013561537a81614da0565b6040820152606084013561538d81614da0565b606082015260808401356153a0816150bc565b608082015260a08401356153b3816150bc565b60a0820152915060c08301356001600160401b03811115615209575f80fd5b5f60e08201905060018060a01b03845116825260018060a01b036020850151166020830152604084015160020b6040830152606084015160020b60608301526001600160801b0360808501511660808301526001600160801b0360a08501511660a083015261088b60c08301846001600160a01b03169052565b5f805f806080858703121561545f575f80fd5b843561546a81614977565b9350602085013561547a81614977565b9250604085013561548a81614da0565b9150606085013561549a81614da0565b939692955090935050565b805161485481614da0565b805161ffff81168114614854575f80fd5b5f805f805f805f60e0888a0312156154d7575f80fd5b87516154e281614977565b60208901519097506154f381614da0565b9550615501604089016154b0565b945061550f606089016154b0565b935061551d608089016154b0565b925060a088015160ff81168114615532575f80fd5b60c089015190925061554381614b3f565b8091505092959891949750929550565b60018060a01b03861681528460020b60208201528360020b60408201526001600160801b038316606082015260a060808201525f61559460a0830184615002565b979650505050505050565b5f80604083850312156155b0575f80fd5b505080516020909101519092909150565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b5f806040838503121561560f575f80fd5b825161561a816150bc565b6020840151909250614b78816150bc565b5f6020828403121561563b575f80fd5b815161088b81614977565b5f818303608081128015615658575f80fd5b50604080519081016001600160401b038111828210171561567b5761567b614cd4565b604052606082121561568b575f80fd5b615693614d33565b915083356156a081614977565b825260208401356156b081614977565b602083015260408401356156c381614d85565b60408301529081526060830135906156da82614977565b60208101919091529392505050565b5f80604083850312156156fa575f80fd5b823560038110615708575f80fd5b915060208301356001600160401b03811115615209575f80fd5b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52601260045260245ffd5b81516001600160a01b031681526101408101602083015161577660208401826001600160a01b03169052565b50604083015161578d604084018262ffffff169052565b5060608301516157a860608401826001600160a01b03169052565b5060808301516157bd608084018260020b9052565b5060a08301516157d260a084018260020b9052565b5060c083015160c083015260e083015160e083015261010083015161010083015261012083015161012083015292915050565b5f805f8060808587031215615818575f80fd5b8451615823816150bc565b602086015160408701516060880151929650909450925061549a81614977565b5f805f805f60a08688031215615857575f80fd5b8551615862816150bc565b6020870151604088015160608901519297509095509350615882816150bc565b6080870151909250614cab816150bc565b5f602082840312156158a3575f80fd5b815161088b81614d85565b5f60c08284031280156158bf575f80fd5b506158c8614d11565b82516158d381614977565b815260208301516158e381614977565b602082015260408301516158f681614da0565b6040820152606083015161590981614da0565b6060820152608083015161591c816150bc565b608082015260a083015161592f81614b3f565b60a08201529392505050565b60018060a01b03815116825260018060a01b036020820151166020830152604081015160020b6040830152606081015160020b60608301526001600160801b03608082015116608083015260a0810151151560a08301525050565b61010081016159a5828661593b565b6001600160a01b039390931660c08201526001600160401b039190911660e090910152919050565b6001600160401b0381811683821601908111156107e5576107e5615082565b61012081016159fb828761593b565b6001600160a01b039490941660c082015260e081019290925261010090910152919050565b5f805f8060808587031215615a33575f80fd5b8451615a3e81614977565b6020860151909450615a4f81614977565b6040860151909350615a6081614da0565b606086015190925061549a81614da0565b5f82601f830112615a80575f80fd5b81516001600160401b03811115615a9957615a99614cd4565b8060051b615aa960208201614d55565b91825260208185018101929081019086841115615ac4575f80fd5b6020860192505b838310156148e8578251615ade81614da0565b825260209283019290910190615acb565b5f60208284031215615aff575f80fd5b81516001600160401b03811115615b14575f80fd5b820160c08185031215615b25575f80fd5b615b2d614d11565b8151615b3881614977565b81526020820151615b4881614977565b60208201526040820151615b5b81614977565b6040820152615b6c606083016154a5565b6060820152615b7d608083016154a5565b608082015260a08201516001600160401b03811115615b9a575f80fd5b615ba686828501615a71565b60a083015250949350505050565b5f60208284031215615bc4575f80fd5b815161088b81614da0565b5f8260020b80615be157615be1615736565b808360020b0791505092915050565b600281810b9083900b01627fffff8113627fffff19821217156107e5576107e5615082565b600282810b9082900b03627fffff198112627fffff821317156107e5576107e5615082565b80820281158282048414176107e5576107e5615082565b5f82615c5f57615c5f615736565b500490565b5f60208284031215615c74575f80fd5b815161088b81614b3f565b5f8251615c90818460208701614fe0565b919091019291505056fe1b3d7edb2e9c0b0e7c525b20aaaef0f5940d2ed71663c7d39266ecafac728859a264697066735822122007300567b2cf05fafa901c618b1ec890e8e79aa223d752eb696875500872ee5364736f6c634300081a00330000000000000000000000009dc698c4c72e407eccb8244bf341e90ce71026b200000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef30146866f3a846fe3c636beb2756dbd24cf321bc52c9113c837c21f47470dfeb

Deployed Bytecode

0x608060405234801561000f575f80fd5b5060043610610228575f3560e01c80639981bb9b1161012a578063d58778d6116100b4578063e1b130d611610079578063e1b130d6146106f4578063e88c9ffd14610782578063eb148be414610795578063f2fde38b146107b5578063fe99049a146107c8575f80fd5b8063d58778d61461058a578063d9843c111461067a578063dc6fd8ab146106ba578063dec66036146106e1578063e0f19adf146103d5575f80fd5b8063b6363cf2116100fa578063b6363cf214610500578063b8ea4a841461052a578063bdab027b1461053d578063c45a015514610550578063d348799714610577575f80fd5b80639981bb9b146104635780639f1c8473146104a9578063b220e470146104cb578063b3f00674146104ed575f80fd5b8063558a7297116101b6578063742b5fdd1161017b578063742b5fdd146103d55780637b3fd965146103f6578063893e81ec146104095780638cf699981461041c5780638da5cb5b1461043e575f80fd5b8063558a72971461030b578063598af9e71461031e5780635bbc40681461034e57806363f558c8146103ba578063715018a6146103cd575f80fd5b80632b4d93ea116101fc5780632b4d93ea146102b2578063426a8493146102d35780634a4e3bd5146102e65780634d0b1de3146102f057806351858e2714610303575f80fd5b8062fdd58e1461022c57806301ffc9a714610269578063095bcdb61461028c5780631575e9481461029f575b5f80fd5b61025661023a366004614996565b600160209081525f928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b61027c6102773660046149c0565b6107db565b6040519015158152602001610260565b61027c61029a3660046149e7565b6107eb565b6102566102ad366004614a56565b610892565b6102c56102c0366004614aa6565b610a3a565b604051610260929190614b1e565b61027c6102e13660046149e7565b610df3565b6102ee610e57565b005b6102c56102fe366004614aa6565b610e6e565b6102ee61116a565b61027c610319366004614b4c565b611187565b61025661032c366004614b83565b600260209081525f938452604080852082529284528284209052825290205481565b61039361035c366004614bc1565b600660209081525f92835260408084209091529082529020546001600160801b03811690600160801b90046001600160401b031682565b604080516001600160801b0390931683526001600160401b03909116602083015201610260565b6102566103c8366004614aa6565b6111f4565b6102ee611249565b6103e86103e3366004614aa6565b61125c565b604051610260929190614c1d565b610256610404366004614a56565b611274565b6102ee610417366004614c41565b61141e565b61027c61042a366004614cb9565b60056020525f908152604090205460ff1681565b6003546001600160a01b03165b6040516001600160a01b039091168152602001610260565b610476610471366004614db9565b611494565b604080516001600160801b0390951685526020850193909352918301526001600160a01b03166060820152608001610260565b61027c6104b7366004614cb9565b60086020525f908152604090205460ff1681565b6104de6104d9366004614aa6565b6116ab565b60405161026093929190614e67565b600a5461044b906001600160a01b031681565b61027c61050e366004614e9c565b5f60208181529281526040808220909352908152205460ff1681565b6103e8610538366004614aa6565b611a8b565b6102ee61054b366004614ec8565b611c6a565b61044b7f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef81565b6102ee610585366004614f7b565b611d6b565b610610610598366004614fc9565b600460208190525f918252604090912080546001820154600283015460038401549484015460058501546006909501546001600160801b0380861697600160801b9687900482169795969495828216959091048216936001600160a01b039081169390821692600160a01b90920462ffffff1691168a565b604080516001600160801b039b8c168152998b1660208b01528901979097526060880195909552928716608087015290861660a08601526001600160a01b0390811660c08601521660e084015262ffffff1661010083015290911661012082015261014001610260565b6106a2610688366004614cb9565b60076020525f90815260409020546001600160401b031681565b6040516001600160401b039091168152602001610260565b6102567f30146866f3a846fe3c636beb2756dbd24cf321bc52c9113c837c21f47470dfeb81565b6102ee6106ef366004614996565b611de6565b610749610702366004614cb9565b60096020525f908152604090205460ff8082169161010081048216916201000082048116916301000000810482169164010000000082048116916501000000000090041686565b604080519615158752941515602087015292151593850193909352151560608401529015156080830152151560a082015260c001610260565b6103e8610790366004614aa6565b611e06565b6107a86107a3366004614a56565b611e5a565b604051610260919061502d565b6102ee6107c3366004614cb9565b611efa565b61027c6107d636600461503f565b611f3c565b5f6107e582612098565b92915050565b335f908152600160209081526040808320858452909152812080548391908390610816908490615096565b90915550506001600160a01b0384165f9081526001602090815260408083208684529091528120805484929061084d9084906150a9565b909155505060408051338082526020820185905285926001600160a01b038816925f80516020615c9b83398151915291015b60405180910390a45060015b9392505050565b5f61089b6120ca565b5f806108a9848601866151d4565b6020828101516001600160a01b03165f908152600990915260409020549193509150610100900460ff1680156108fb57506020808301516001600160a01b03165f9081526008909152604090205460ff165b1561095e5781602001516001600160a01b031663e849a8b6826040518263ffffffff1660e01b8152600401610930919061502d565b5f604051808303815f87803b158015610947575f80fd5b505af1158015610959573d5f803e3d5ffd5b505050505b604080516101008101825283516020850151928501516060860151610a22948493610992933093919291610120870161521f565b604051602081830303815290604052805190602001205f1c8152602001845f01516001600160a01b0316815260200184602001516001600160a01b03168152602001846040015160020b8152602001846060015160020b815260200184608001516001600160801b03168152602001886001600160a01b03168152602001886001600160a01b0316815250612124565b505050608001516001600160801b0316949350505050565b60605f610a456120ca565b5f80610a53858701876151d4565b915091505f30835f0151846020015185604001518660600151604051602001610a8095949392919061521f565b60408051808303601f1901815291815281516020928301205f81815260048452828120878501516001600160a01b03168252600990945291909120549092506301000000900460ff168015610af157506020808501516001600160a01b03165f9081526008909152604090205460ff165b15610b545783602001516001600160a01b03166340b62019846040518263ffffffff1660e01b8152600401610b26919061502d565b5f604051808303815f87803b158015610b3d575f80fd5b505af1158015610b4f573d5f803e3d5ffd5b505050505b5f610b61855f01516123cb565b5090505f80610b9483610b7a896040015160020b61243d565b610b8a8a6060015160020b61243d565b8a60800151612758565b604080516101408101825287546001600160801b038082168352600160801b918290048116602084015260018a01548385015260028a015460608085019190915260038b0154808316608086015292909204811660a084015260048a01546001600160a01b0390811660c085015260058b015490811660e0850152600160a01b900462ffffff1661010084015260068a015416610120830152918b0151918b01519395509193505f92610c4c928492909187876127f3565b50509050610c6785895f01518a604001518b60600151612982565b84546001600160801b03808316600160801b9092041610610ccf57845481908690601090610ca6908490600160801b90046001600160801b0316615255565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550610d2c565b8454610ceb90600160801b90046001600160801b031682615255565b855486905f90610d059084906001600160801b0316615274565b82546101009290920a6001600160801b038181021990931691831602179091558654168655505b6040805160028082526060820183525f9260208301908036833701905050905083815f81518110610d5f57610d5f615293565b6020026020010181815250508281600181518110610d7f57610d7f615293565b60209081029190910101526001600160801b03821660808a01526040517f9947dcc0369e358b6658b3c737e9b50fb988f069f55f189f250076b4db69937490610dcf908b903390889088906152a7565b60405180910390a199506001600160801b03169750505050505050505b9250929050565b335f8181526002602090815260408083206001600160a01b03881680855290835281842087855290925280832085905551919285927fb3fd5071835887567a0671151121894ddccc2842f1d10bedad13e0d17cace9a79061087f9087815260200190565b610e5f612b1b565b600a805460ff60a01b19169055565b60605f610e796120ca565b5f80610e8785870187615324565b915091505f30835f0151846020015185604001518660600151604051602001610eb495949392919061521f565b60408051808303601f190181529181528151602092830120858301516001600160a01b03165f9081526009909352912054909150640100000000900460ff168015610f1b57506020808401516001600160a01b03165f9081526008909152604090205460ff165b15610f7e5782602001516001600160a01b0316638b5ef33a836040518263ffffffff1660e01b8152600401610f50919061502d565b5f604051808303815f87803b158015610f67575f80fd5b505af1158015610f79573d5f803e3d5ffd5b505050505b5f8181526004602081815260409283902083516101408101855281546001600160801b038082168352600160801b91829004811694830194909452600183015495820195909552600282015460608201526003820154808416608080840191909152959004831660a0820152928101546001600160a01b0390811660c0850152600582015490811660e0850152600160a01b900462ffffff16610100840152600601548116610120830152918501519091161561106657600a54608085015160c0830151611066926001600160a01b03918216923392909116906001600160801b0316612b48565b60a08401516001600160801b0316156110aa57600a5460a085015160e08301516110aa926001600160a01b03918216923392909116906001600160801b0316612b48565b6040805160028082526060820183525f9260208301908036833701905050905084608001516001600160801b0316815f815181106110ea576110ea615293565b6020026020010181815250508460a001516001600160801b03168160018151811061111757611117615293565b6020026020010181815250507fd56018ecc6a046635457cebc1f2716e82f7fed949bf224bc2f3f58e2178682c085336040516111549291906153d2565b60405180910390a1985f98509650505050505050565b611172612b1b565b600a805460ff60a01b1916600160a01b179055565b335f818152602081815260408083206001600160a01b038716808552908352818420805460ff191687151590811790915591519182529293917fceb576d9f15e4e200fdb5096d64d5dfd667e16def20c1eefd14256d8e3faa267910160405180910390a350600192915050565b5f808080806112058688018861544c565b9350935093509350308484848460405160200161122695949392919061521f565b60408051601f198184030181529190528051602090910120979650505050505050565b611251612b1b565b61125a5f612bb5565b565b6060806112698484612c06565b915091509250929050565b5f61127d6120ca565b5f8061128b848601866151d4565b6020808301516001600160a01b03165f90815260099091526040902054919350915060ff1680156112d857506020808301516001600160a01b03165f9081526008909152604090205460ff165b1561133b5781602001516001600160a01b0316633fc32173826040518263ffffffff1660e01b815260040161130d919061502d565b5f604051808303815f87803b158015611324575f80fd5b505af1158015611336573d5f803e3d5ffd5b505050505b5f6114086040518061014001604052805f1515815260200130865f015187602001518860400151896060015160405160200161137b95949392919061521f565b604051602081830303815290604052805190602001205f1c8152602001855f01516001600160a01b0316815260200185602001516001600160a01b0316815260200185608001516001600160801b031681526020015f81526020015f8152602001856040015160020b8152602001856060015160020b8152602001896001600160a01b0316815250612e12565b50506001600160801b0316979650505050505050565b611426612b1b565b6001600160a01b039485165f908152600560209081526040808320805460ff1916971515979097179096559386168152600790935292909120805467ffffffffffffffff19166001600160401b03909216919091179055600a80546001600160a01b03191691909216179055565b5f805f805f6040518060600160405280875f01516001600160a01b0316815260200187602001516001600160a01b03168152602001876040015162ffffff1681525090506115027f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef826132b5565b91505f826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015611541573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061156591906154c1565b50505050505090505f61157b886080015161243d565b90505f61158b8960a0015161243d565b90506115a28383838c60c001518d60e0015161339b565b9750505050816001600160a01b0316633c8a7d8d876060015188608001518960a00151896040518060400160405280888152602001336001600160a01b031681525060405160200161162f9190815180516001600160a01b03908116835260208083015182168185015260409283015162ffffff1692840192909252920151909116606082015260800190565b6040516020818303038152906040526040518663ffffffff1660e01b815260040161165e959493929190615553565b60408051808303815f875af1158015611679573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061169d919061559f565b959790965091935090915050565b6060805f6116b76120ca565b5f806116c5868801886151d4565b915091505f30835f01518460200151856040015186606001516040516020016116f295949392919061521f565b60408051808303601f1901815291815281516020928301205f81815260048452828120878501516001600160a01b031682526009909452919091205490925062010000900460ff16801561176257506020808501516001600160a01b03165f9081526008909152604090205460ff165b156117c55783602001516001600160a01b031663753f19fb846040518263ffffffff1660e01b8152600401611797919061502d565b5f604051808303815f87803b1580156117ae575f80fd5b505af11580156117c0573d5f803e3d5ffd5b505050505b608084015181546001600160801b03918216916117ec91600160801b810482169116615255565b6001600160801b031610156118145760405163bb55fd2760e01b815260040160405180910390fd5b5f80611831865f015187604001518860600151896080015161345c565b87516040808a015160608b015191516309e3d67b60e31b81529496509294506001600160a01b0390911692634f1eb3d892611874923392889088906004016155c1565b60408051808303815f875af115801561188f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118b391906155fe565b50506118cc83875f015188604001518960600151612982565b6080860151835484906010906118f3908490600160801b90046001600160801b0316615274565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505f60026001600160401b0381111561193157611931614cd4565b60405190808252806020026020018201604052801561195a578160200160208202803683370190505b50600485015481519192506001600160a01b03169082905f9061197f5761197f615293565b6001600160a01b03928316602091820292909201015260058501548251911690829060019081106119b2576119b2615293565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183525f93919290918301908036833701905050905083815f815181106119ff576119ff615293565b6020026020010181815250508281600181518110611a1f57611a1f615293565b6020026020010181815250507f8643ccc443265e37c9da35348e57363bd63b37b6112bca61947776a86b637a3888338686604051611a6094939291906152a7565b60405180910390a160809790970151909c969b506001600160801b0316995094975050505050505050565b6060805f611a9b84860186615324565b506040805160028082526060820183529293505f929091602083019080368337019050509050815f01516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b24919061562b565b815f81518110611b3657611b36615293565b60200260200101906001600160a01b031690816001600160a01b031681525050815f01516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b95573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb9919061562b565b81600181518110611bcc57611bcc615293565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183525f93919290918301908036833701905050905082608001516001600160801b0316815f81518110611c2657611c26615293565b6020026020010181815250508260a001516001600160801b031681600181518110611c5357611c53615293565b602090810291909101015290969095509350505050565b6001600160a01b0382165f9081526008602052604090205460ff1615611ca3576040516325c3d4c360e01b815260040160405180910390fd5b6001600160a01b039091165f908152600960209081526040808320845181548487015184880151606089015160808a015160a0909a01511515650100000000000265ff0000000000199a1515640100000000029a909a1665ffff000000001991151563010000000263ff0000001993151562010000029390931663ffff0000199415156101000261ff00199715159790971661ffff1990961695909517959095179290921692909217919091171617949094179093556008905220805460ff19166001179055565b5f611d7882840184615646565b9050611da77f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef825f01516134ee565b508415611dc2578051516020820151611dc29190338861350f565b8315611ddf57611ddf815f0151602001518260200151338761350f565b5050505050565b611dee612b1b565b611e026001600160a01b038316338361353b565b5050565b604080516002808252606082810190935282915f9181602001602082028036833750506040805160028082526060820183529394505f93909250906020830190803683375093989197509095505050505050565b6060611e646120ca565b5f80611e72848601866156e9565b90925090505f826002811115611e8a57611e8a615722565b03611e9e57611e998682613571565b611ee2565b6001826002811115611eb257611eb2615722565b03611ec057611e9981613a27565b6002826002811115611ed457611ed4615722565b03611ee257611ee281613b47565b505060408051602081019091525f8152949350505050565b611f02612b1b565b6001600160a01b038116611f3057604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b611f3981612bb5565b50565b5f336001600160a01b03861614801590611f7757506001600160a01b0385165f9081526020818152604080832033845290915290205460ff16155b15611fe7576001600160a01b0385165f90815260026020908152604080832033845282528083208684529091529020545f198114611fe557611fb98382615096565b6001600160a01b0387165f90815260026020908152604080832033845282528083208884529091529020555b505b6001600160a01b0385165f90815260016020908152604080832086845290915281208054849290612019908490615096565b90915550506001600160a01b0384165f908152600160209081526040808320868452909152812080548492906120509084906150a9565b9091555050604080513381526020810184905284916001600160a01b0380881692908916915f80516020615c9b833981519152910160405180910390a4506001949350505050565b5f6301ffc9a760e01b6001600160e01b0319831614806107e55750506001600160e01b031916630f632fb360e01b1490565b335f9081526005602052604090205460ff166120f957604051630b094f2760e31b815260040160405180910390fd5b600a54600160a01b900460ff161561125a576040516313d0ff5960e31b815260040160405180910390fd5b80515f90815260046020526040812060a083015181548392916001600160801b039081169161215d91600160801b820481169116615255565b6001600160801b031610156121855760405163bb55fd2760e01b815260040160405180910390fd5b60208401516060850151608086015160a087015160405163a34123a760e01b8152600293840b60048201529190920b60248201526001600160801b0390911660448201525f9182916001600160a01b039091169063a34123a79060640160408051808303815f875af11580156121fd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612221919061559f565b9150915061223d83876020015188606001518960800151612982565b85602001516001600160a01b0316634f1eb3d88760e001518860600151896080015186866040518663ffffffff1660e01b81526004016122819594939291906155c1565b60408051808303815f875af115801561229c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122c091906155fe565b505060a0860151835484905f906122e19084906001600160801b0316615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055506123248660c00151875f01518860a001516001600160801b03166144c6565b7ff6712e9ab46ec463b822b25c7cd53a85bb9386675c5c5d547c78a4ebed1bd7816040518060a0016040528088602001516001600160a01b0316815260200188604001516001600160a01b03168152602001886060015160020b8152602001886080015160020b81526020018860a001516001600160801b03168152508760c0015184846040516123b894939291906152a7565b60405180910390a1909590945092505050565b5f80826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015612409573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061242d91906154c1565b5094989397509295505050505050565b5f805f8360020b12612452578260020b612459565b8260020b5f035b9050620d89e881111561247f576040516315e4079d60e11b815260040160405180910390fd5b5f816001165f0361249457600160801b6124a6565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff16905060028216156124da576ffff97272373d413259a46990580e213a0260801c5b60048216156124f9576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612518576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612537576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612556576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612575576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612594576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156125b4576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b6102008216156125d4576ff987a7253ac413176f2b074cf7815e540260801c5b6104008216156125f4576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612614576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612634576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612654576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612674576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612694576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156126b5576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b620200008216156126d5576e5d6af8dedb81196699c329225ee6040260801c5b620400008216156126f4576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615612711576b048a170391f7dc42444e8fa20260801c5b5f8460020b131561273057805f198161272c5761272c615736565b0490505b640100000000810615612744576001612746565b5f5b60ff16602082901c0192505050919050565b5f80836001600160a01b0316856001600160a01b03161115612778579293925b846001600160a01b0316866001600160a01b0316116127a35761279c858585614538565b91506127ea565b836001600160a01b0316866001600160a01b031610156127dc576127c8868585614538565b91506127d58587856145a6565b90506127ea565b6127e78585856145a6565b90505b94509492505050565b5f805f886128895761287c6040518061014001604052808a60c001516001600160a01b031681526020018a60e001516001600160a01b031681526020018a610100015162ffffff168152602001306001600160a01b031681526020018960020b81526020018860020b815260200187815260200186815260200187815260200186815250611494565b5091945092509050612976565b306001600160a01b0316639981bb9b6040518061014001604052808b60c001516001600160a01b031681526020018b60e001516001600160a01b031681526020018b610100015162ffffff168152602001306001600160a01b031681526020018a60020b81526020018960020b8152602001888152602001878152602001888152602001878152506040518263ffffffff1660e01b815260040161292d919061574a565b6080604051808303815f875af1158015612949573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061296d9190615805565b50919450925090505b96509650969350505050565b604080516bffffffffffffffffffffffff193060601b1660208083019190915260e885811b603484015284901b60378301528251808303601a018152603a830193849052805191012063514ea4bf60e01b909252603e81018290525f9081906001600160a01b0387169063514ea4bf90605e0160a060405180830381865afa158015612a10573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612a349190615843565b505060018a01548a5460068c0154939650919450612a7993508503916001600160801b03600160801b80840482169382169282169290920192909203909116906145f0565b6003880180546001600160801b0380821690930183166fffffffffffffffffffffffffffffffff199091161790556002880154885460068a0154612adc9392850392600160801b80840482169382169282169290920192909203909116906145f0565b6003880180546001600160801b03600160801b808304821690940181169093029216919091179055600187019190915560029095019490945550505050565b6003546001600160a01b0316331461125a5760405163118cdaa760e01b8152336004820152602401611f27565b6040516001600160a01b038481166024830152838116604483015260648201839052612baf9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061469a565b50505050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6060805f612c16848601866151d4565b5090505f612c26825f01516123cb565b5090505f80612c5983612c3f866040015160020b61243d565b612c4f876060015160020b61243d565b8760800151612758565b6040805160028082526060820183529395509193505f9290602083019080368337019050509050845f01516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cbf573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ce3919061562b565b815f81518110612cf557612cf5615293565b60200260200101906001600160a01b031690816001600160a01b031681525050845f01516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d54573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612d78919061562b565b81600181518110612d8b57612d8b615293565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183525f93919290918301908036833701905050905083815f81518110612dd857612dd8615293565b6020026020010181815250508281600181518110612df857612df8615293565b602090810291909101015290999098509650505050505050565b6020808201515f9081526004918290526040812091820154909182918291906001600160a01b0316612fd95784604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612e7e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ea2919061562b565b816004015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555084604001516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f09573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f2d919061562b565b816005015f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555084604001516001600160a01b031663ddca3f436040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f94573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612fb89190615893565b8160050160146101000a81548162ffffff021916908362ffffff1602179055505b5f612fe786604001516123cb565b50905085608001516001600160801b03165f0361304157613032816130128860e0015160020b61243d565b61302389610100015160020b61243d565b8960a001518a60c0015161339b565b6001600160801b031660808701525b60a0860151158015613055575060c0860151155b15613094576130898161306e8860e0015160020b61243d565b61307f89610100015160020b61243d565b8960800151612758565b60c088015260a08701525b8551604080516101408101825284546001600160801b038082168352600160801b9182900481166020840152600187015493830193909352600286015460608301526003860154808416608084015204821660a08083019190915260048601546001600160a01b0390811660c080850191909152600588015491821660e080860191909152600160a01b90920462ffffff16610100808601919091526006890154909516610120850152908b0151938b0151918b0151908b015161315b95949291906127f3565b60c089015260a08801526001600160801b03166080870152604086015160e08701516101008801516131909285929091612982565b6080860151825483905f906131af9084906001600160801b0316615274565b92506101000a8154816001600160801b0302191690836001600160801b031602179055506131f4866101200151876020015188608001516001600160801b03166146fb565b7fe37ed9ef07c82bfef5e4b1503d49939505996bb0aea458cb274ba82e934f86e66040518060a0016040528088604001516001600160a01b0316815260200188606001516001600160a01b031681526020018860e0015160020b815260200188610100015160020b815260200188608001516001600160801b03168152508761012001518860a001518960c0015160405161329294939291906152a7565b60405180910390a150505050608082015160a083015160c0909301519093909150565b5f81602001516001600160a01b0316825f01516001600160a01b0316106132da575f80fd5b815160208084015160408086015181516001600160a01b0395861681860152949092168482015262ffffff90911660608085019190915281518085038201815260808501909252815191909201206001600160f81b031960a08401529085901b6bffffffffffffffffffffffff191660a183015260b58201527f30146866f3a846fe3c636beb2756dbd24cf321bc52c9113c837c21f47470dfeb60d582015260f50160408051601f1981840301815291905280516020909101209392505050565b5f836001600160a01b0316856001600160a01b031611156133ba579293925b846001600160a01b0316866001600160a01b0316116133e5576133de858585614764565b9050613453565b836001600160a01b0316866001600160a01b03161015613445575f61340b878686614764565b90505f6134198789866147c5565b9050806001600160801b0316826001600160801b03161061343a578061343c565b815b92505050613453565b6134508585846147c5565b90505b95945050505050565b60405163a34123a760e01b8152600284810b600483015283900b60248201526001600160801b03821660448201525f9081906001600160a01b0387169063a34123a79060640160408051808303815f875af11580156134bd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134e1919061559f565b9097909650945050505050565b5f6134f983836132b5565b9050336001600160a01b038216146107e5575f80fd5b306001600160a01b0384160361352f5761352a84838361353b565b612baf565b612baf84848484612b48565b6040516001600160a01b0383811660248301526044820183905261356c91859182169063a9059cbb90606401612b7d565b505050565b5f8180602001905181019061358691906158ae565b90505f30825f01518360200151846040015185606001516040516020016135b195949392919061521f565b60408051601f1981840301815291815281516020928301205f81815260048452828120600685528382206001600160a01b038a1683529094529190912060a08501519193509015613754576080840151815482905f9061361b9084906001600160801b0316615274565b82546101009290920a6001600160801b03818102199093169183160217909155825467ffffffffffffffff60801b1916600160801b426001600160401b0316021783556080860151845490925084915f9161367891859116615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508360800151826006015f8282829054906101000a90046001600160801b03166136c59190615274565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613701868486608001516001600160801b03166144c6565b80546040517f3de445284e77f1fdf8fefe5c00363b9c7da97f34e3e07617973d5b16adf756e8916137479187918a91600160801b9091046001600160401b031690615996565b60405180910390a1613a1f565b6020808501516001600160a01b03165f9081526007909152604090205481544291613793916001600160401b0391821691600160801b909104166159cd565b6001600160401b031611156137bb57604051635ff1b24b60e11b815260040160405180910390fd5b6080840151825460068401546001600160801b0392831692600160801b83048116926137ea9282169116615274565b6137f49190615255565b6001600160801b0316101561381c5760405163bb55fd2760e01b815260040160405180910390fd5b835160408086015160608701516080880151925163a34123a760e01b8152600292830b6004820152910b60248201526001600160801b0390911660448201525f9182916001600160a01b039091169063a34123a79060640160408051808303815f875af115801561388f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906138b3919061559f565b87516040808a015160608b015191516309e3d67b60e31b81529496509294506001600160a01b0390911692634f1eb3d8926138f6928d92889088906004016155c1565b60408051808303815f875af1158015613911573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061393591906155fe565b505061394e84875f015188604001518960600151612982565b60808601516006850180545f9061396f9084906001600160801b0316615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055508560800151835f015f8282829054906101000a90046001600160801b03166139bb9190615255565b92506101000a8154816001600160801b0302191690836001600160801b031602179055507f6aa9934a1cc17e51db83b5b01a58a2331f4e98dd932a53ffa875e244a09d290186898384604051613a1494939291906159ec565b60405180910390a150505b505050505050565b5f805f8084806020019051810190613a3f9190615a20565b93509350935093505f3085858585604051602001613a6195949392919061521f565b60408051601f1981840301815291815281516020928301205f818152600490935290822090925090613a989087908690869061345c565b5050613aa681878686612982565b600a5460038201546040516309e3d67b60e31b81526001600160a01b0389811693634f1eb3d893613af7939290911691899189916001600160801b0380831692600160801b900416906004016155c1565b60408051808303815f875af1158015613b12573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613b3691906155fe565b50505f600390910155505050505050565b5f81806020019051810190613b5c9190615aef565b9050806060015160020b8160a001515f81518110613b7c57613b7c615293565b602002602001015160020b141580613bcc5750806080015160020b8160a0015160018360a0015151613bae9190615096565b81518110613bbe57613bbe615293565b602002602001015160020b14155b15613bea57604051631434ed7f60e01b815260040160405180910390fd5b613c69604051806101e001604052805f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f60020b81526020015f60020b81526020015f60020b81526020015f60020b81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b613c7682602001516123cb565b60020b60a08301526001600160a01b0390811682526040838101519091165f9081526009602052205465010000000000900460ff16613cc857604051632a1b540760e01b815260040160405180910390fd5b5f308360200151846040015185606001518660800151604051602001613cf295949392919061521f565b60408051601f19818403018152828252805160209182012061010084018352808452868201516001600160a01b039081168584015287840151811685850152606080890151600290810b918701919091526080808a015190910b90860152875181165f9081526001845284812083825290935292909120546001600160801b031660a0840152855190911660c08301523060e08301529150613d9390612124565b836020018460400182815250828152505050613ddb6040518060a001604052805f81526020015f81526020015f6001600160801b031681526020015f81526020015f81525090565b83602001516001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613e1b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613e3f9190615bb4565b600290810b60c085015260a08401515f910b13613e8d578260c001518360a00151613e6a9190615bcf565b8360c00151613e799190615bf0565b8360a00151613e889190615c15565b613eb0565b8260c001518360a00151613ea19190615bcf565b8360a00151613eb09190615c15565b60020b60e0840181905260c0840151613ec891615bf0565b600290810b610100850152606085015160a08501515f9291820b910b138015613efe5750846080015160020b8460a0015160020b125b6020850151606086015260408501516080860152905080156140ef57613f568460a001518660a0015160018860a0015151613f399190615096565b81518110613f4957613f49615293565b6020026020010151614801565b84610120018181525050613f7e8460a001518660a001515f81518110613f4957613f49615293565b61014085015260a0840151610100850151613f999190615c15565b60020b61016085015260e084015160a0850151613fb69190615c15565b60020b610180850152835160e08501516140319190613fd49061243d565b613fe287610100015161243d565b8761012001518861016001518960200151613ffd9190615c3a565b6140079190615c51565b8861014001518961018001518a604001516140229190615c3a565b61402c9190615c51565b61339b565b6001600160801b03166040830152835160e085015161406c91906140549061243d565b61406287610100015161243d565b8560400151612758565b6080840152606083015261016084015161012085015161408c9190615096565b826060015185602001516140a09190615096565b6140aa9190615c51565b6101a08501526101808401516101408501516140c69190615096565b826080015185604001516140da9190615096565b6140e49190615c51565b6101c0850152614142565b61410185608001518660600151614801565b6101408501819052610120850181905260208501516141209190615c51565b6101a0850152610140840151604085015161413b9190615c51565b6101c08501525b5f5b60018660a00151516141569190615096565b8110156143c4575f8660a00151828151811061417457614174615293565b602002602001015190505f8760a0015183600161419191906150a9565b815181106141a1576141a1615293565b602002602001015190508060020b8260020b126141d157604051631434ed7f60e01b815260040160405180910390fd5b8060020b8760a0015160020b13806141f257508160020b8760a0015160020b125b15614233575f6142028383614801565b905080886101a001516142159190615c3a565b86526101c0880151614228908290615c3a565b6020870152506142c7565b8660e0015160020b8260020b141580614257575086610100015160020b8160020b14155b1561427557604051631434ed7f60e01b815260040160405180910390fd5b86610120015187610160015188606001516142909190615c3a565b61429a9190615c51565b855261014087015161018088015160808901516142b79190615c3a565b6142c19190615c51565b60208601525b614371604051806101400160405280600115158152602001308b602001518c60400151878760405160200161430095949392919061521f565b60408051601f19818403018152918152815160209283012083528c8201516001600160a01b03908116848401528d8201518116918401919091525f6060840152895160808401529089015160a0830152600286810b60c084015285900b60e08301528b511661010090910152612e12565b6080880152606087018190526001600160801b03909116604087015260208801805161439e908390615096565b90525060808501516040880180516143b7908390615096565b9052505050600101614144565b505f8381526004602081815260409283902083516101408101855281546001600160801b038082168352600160801b91829004811683860152600184015496830196909652600283015460608301526003830154808716608084015204851660a0820152928101546001600160a01b0390811660c0850152600582015490811660e0850152600160a01b900462ffffff16610100840152600601549092166101208201529085015115614492578551602086015160c0830151614492926001600160a01b039091169161353b565b6040850151156144bd578551604086015160e08301516144bd926001600160a01b039091169161353b565b50505050505050565b6001600160a01b0383165f908152600160209081526040808320858452909152812080548392906144f8908490615096565b9091555050604080513381526020810183905283915f916001600160a01b038716915f80516020615c9b83398151915291015b60405180910390a4505050565b5f826001600160a01b0316846001600160a01b03161115614557579192915b836001600160a01b0316614590606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166145f0565b8161459d5761459d615736565b04949350505050565b5f826001600160a01b0316846001600160a01b031611156145c5579192915b6145e8826001600160801b03168585036001600160a01b0316600160601b6145f0565b949350505050565b5f80805f19858709858702925082811083820303915050805f03614624575f8411614619575f80fd5b50829004905061088b565b80841161462f575f80fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f6146ae6001600160a01b03841683614832565b905080515f141580156146d25750808060200190518101906146d09190615c64565b155b1561356c57604051635274afe760e01b81526001600160a01b0384166004820152602401611f27565b6001600160a01b0383165f9081526001602090815260408083208584529091528120805483929061472d9084906150a9565b9091555050604080513381526020810183905283916001600160a01b038616915f915f80516020615c9b833981519152910161452b565b5f826001600160a01b0316846001600160a01b03161115614783579192915b5f6147a5856001600160a01b0316856001600160a01b0316600160601b6145f0565b90506134536147c084838888036001600160a01b03166145f0565b61483f565b5f826001600160a01b0316846001600160a01b031611156147e4579192915b6145e86147c083600160601b8787036001600160a01b03166145f0565b5f8160020b8360020b1361481e576148198383615c15565b614828565b6148288284615c15565b60020b9392505050565b606061088b83835f614859565b806001600160801b0381168114614854575f80fd5b919050565b60608147101561487e5760405163cd78605960e01b8152306004820152602401611f27565b5f80856001600160a01b031684866040516148999190615c7f565b5f6040518083038185875af1925050503d805f81146148d3576040519150601f19603f3d011682016040523d82523d5f602084013e6148d8565b606091505b50915091506148e88683836148f2565b9695505050505050565b606082614907576149028261494e565b61088b565b815115801561491e57506001600160a01b0384163b155b1561494757604051639996b31560e01b81526001600160a01b0385166004820152602401611f27565b508061088b565b80511561495e5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114611f39575f80fd5b803561485481614977565b5f80604083850312156149a7575f80fd5b82356149b281614977565b946020939093013593505050565b5f602082840312156149d0575f80fd5b81356001600160e01b03198116811461088b575f80fd5b5f805f606084860312156149f9575f80fd5b8335614a0481614977565b95602085013595506040909401359392505050565b5f8083601f840112614a29575f80fd5b5081356001600160401b03811115614a3f575f80fd5b602083019150836020828501011115610dec575f80fd5b5f805f60408486031215614a68575f80fd5b8335614a7381614977565b925060208401356001600160401b03811115614a8d575f80fd5b614a9986828701614a19565b9497909650939450505050565b5f8060208385031215614ab7575f80fd5b82356001600160401b03811115614acc575f80fd5b614ad885828601614a19565b90969095509350505050565b5f8151808452602084019350602083015f5b82811015614b14578151865260209586019590910190600101614af6565b5093949350505050565b604081525f614b306040830185614ae4565b90508260208301529392505050565b8015158114611f39575f80fd5b5f8060408385031215614b5d575f80fd5b8235614b6881614977565b91506020830135614b7881614b3f565b809150509250929050565b5f805f60608486031215614b95575f80fd5b8335614ba081614977565b92506020840135614bb081614977565b929592945050506040919091013590565b5f8060408385031215614bd2575f80fd5b823591506020830135614b7881614977565b5f8151808452602084019350602083015f5b82811015614b145781516001600160a01b0316865260209586019590910190600101614bf6565b604081525f614c2f6040830185614be4565b82810360208401526134538185614ae4565b5f805f805f60a08688031215614c55575f80fd5b8535614c6081614977565b94506020860135614c7081614b3f565b93506040860135614c8081614977565b925060608601356001600160401b0381168114614c9b575f80fd5b91506080860135614cab81614977565b809150509295509295909350565b5f60208284031215614cc9575f80fd5b813561088b81614977565b634e487b7160e01b5f52604160045260245ffd5b60405161014081016001600160401b0381118282101715614d0b57614d0b614cd4565b60405290565b60405160c081016001600160401b0381118282101715614d0b57614d0b614cd4565b604051606081016001600160401b0381118282101715614d0b57614d0b614cd4565b604051601f8201601f191681016001600160401b0381118282101715614d7d57614d7d614cd4565b604052919050565b62ffffff81168114611f39575f80fd5b803561485481614d85565b8060020b8114611f39575f80fd5b803561485481614da0565b5f610140828403128015614dcb575f80fd5b50614dd4614ce8565b614ddd8361498b565b8152614deb6020840161498b565b6020820152614dfc60408401614d95565b6040820152614e0d6060840161498b565b6060820152614e1e60808401614dae565b6080820152614e2f60a08401614dae565b60a082015260c0838101359082015260e080840135908201526101008084013590820152610120928301359281019290925250919050565b606081525f614e796060830186614be4565b8281036020840152614e8b8186614ae4565b915050826040830152949350505050565b5f8060408385031215614ead575f80fd5b8235614eb881614977565b91506020830135614b7881614977565b5f8082840360e0811215614eda575f80fd5b8335614ee581614977565b925060c0601f1982011215614ef8575f80fd5b50614f01614d11565b6020840135614f0f81614b3f565b81526040840135614f1f81614b3f565b60208201526060840135614f3281614b3f565b60408201526080840135614f4581614b3f565b606082015260a0840135614f5881614b3f565b608082015260c0840135614f6b81614b3f565b60a0820152919491935090915050565b5f805f8060608587031215614f8e575f80fd5b843593506020850135925060408501356001600160401b03811115614fb1575f80fd5b614fbd87828801614a19565b95989497509550505050565b5f60208284031215614fd9575f80fd5b5035919050565b5f5b83811015614ffa578181015183820152602001614fe2565b50505f910152565b5f8151808452615019816020860160208601614fe0565b601f01601f19169290920160200192915050565b602081525f61088b6020830184615002565b5f805f8060808587031215615052575f80fd5b843561505d81614977565b9350602085013561506d81614977565b93969395505050506040820135916060013590565b634e487b7160e01b5f52601160045260245ffd5b818103818111156107e5576107e5615082565b808201808211156107e5576107e5615082565b6001600160801b0381168114611f39575f80fd5b5f60a082840312156150e0575f80fd5b60405160a081016001600160401b038111828210171561510257615102614cd4565b604052905080823561511381614977565b8152602083013561512381614977565b6020820152604083013561513681614da0565b6040820152606083013561514981614da0565b6060820152608083013561515c816150bc565b6080919091015292915050565b5f82601f830112615178575f80fd5b81356001600160401b0381111561519157615191614cd4565b6151a4601f8201601f1916602001614d55565b8181528460208386010111156151b8575f80fd5b816020850160208301375f918101602001919091529392505050565b5f8060c083850312156151e5575f80fd5b6151ef84846150d0565b915060a08301356001600160401b03811115615209575f80fd5b61521585828601615169565b9150509250929050565b6001600160a01b0395861681529385166020850152919093166040830152600292830b606083015290910b608082015260a00190565b6001600160801b0382811682821603908111156107e5576107e5615082565b6001600160801b0381811683821601908111156107e5576107e5615082565b634e487b7160e01b5f52603260045260245ffd5b6101008101615300828760018060a01b03815116825260018060a01b036020820151166020830152604081015160020b6040830152606081015160020b60608301526001600160801b0360808201511660808301525050565b6001600160a01b039490941660a082015260c081019290925260e090910152919050565b5f8082840360e0811215615336575f80fd5b60c0811215615343575f80fd5b5061534c614d11565b833561535781614977565b8152602084013561536781614977565b6020820152604084013561537a81614da0565b6040820152606084013561538d81614da0565b606082015260808401356153a0816150bc565b608082015260a08401356153b3816150bc565b60a0820152915060c08301356001600160401b03811115615209575f80fd5b5f60e08201905060018060a01b03845116825260018060a01b036020850151166020830152604084015160020b6040830152606084015160020b60608301526001600160801b0360808501511660808301526001600160801b0360a08501511660a083015261088b60c08301846001600160a01b03169052565b5f805f806080858703121561545f575f80fd5b843561546a81614977565b9350602085013561547a81614977565b9250604085013561548a81614da0565b9150606085013561549a81614da0565b939692955090935050565b805161485481614da0565b805161ffff81168114614854575f80fd5b5f805f805f805f60e0888a0312156154d7575f80fd5b87516154e281614977565b60208901519097506154f381614da0565b9550615501604089016154b0565b945061550f606089016154b0565b935061551d608089016154b0565b925060a088015160ff81168114615532575f80fd5b60c089015190925061554381614b3f565b8091505092959891949750929550565b60018060a01b03861681528460020b60208201528360020b60408201526001600160801b038316606082015260a060808201525f61559460a0830184615002565b979650505050505050565b5f80604083850312156155b0575f80fd5b505080516020909101519092909150565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b5f806040838503121561560f575f80fd5b825161561a816150bc565b6020840151909250614b78816150bc565b5f6020828403121561563b575f80fd5b815161088b81614977565b5f818303608081128015615658575f80fd5b50604080519081016001600160401b038111828210171561567b5761567b614cd4565b604052606082121561568b575f80fd5b615693614d33565b915083356156a081614977565b825260208401356156b081614977565b602083015260408401356156c381614d85565b60408301529081526060830135906156da82614977565b60208101919091529392505050565b5f80604083850312156156fa575f80fd5b823560038110615708575f80fd5b915060208301356001600160401b03811115615209575f80fd5b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52601260045260245ffd5b81516001600160a01b031681526101408101602083015161577660208401826001600160a01b03169052565b50604083015161578d604084018262ffffff169052565b5060608301516157a860608401826001600160a01b03169052565b5060808301516157bd608084018260020b9052565b5060a08301516157d260a084018260020b9052565b5060c083015160c083015260e083015160e083015261010083015161010083015261012083015161012083015292915050565b5f805f8060808587031215615818575f80fd5b8451615823816150bc565b602086015160408701516060880151929650909450925061549a81614977565b5f805f805f60a08688031215615857575f80fd5b8551615862816150bc565b6020870151604088015160608901519297509095509350615882816150bc565b6080870151909250614cab816150bc565b5f602082840312156158a3575f80fd5b815161088b81614d85565b5f60c08284031280156158bf575f80fd5b506158c8614d11565b82516158d381614977565b815260208301516158e381614977565b602082015260408301516158f681614da0565b6040820152606083015161590981614da0565b6060820152608083015161591c816150bc565b608082015260a083015161592f81614b3f565b60a08201529392505050565b60018060a01b03815116825260018060a01b036020820151166020830152604081015160020b6040830152606081015160020b60608301526001600160801b03608082015116608083015260a0810151151560a08301525050565b61010081016159a5828661593b565b6001600160a01b039390931660c08201526001600160401b039190911660e090910152919050565b6001600160401b0381811683821601908111156107e5576107e5615082565b61012081016159fb828761593b565b6001600160a01b039490941660c082015260e081019290925261010090910152919050565b5f805f8060808587031215615a33575f80fd5b8451615a3e81614977565b6020860151909450615a4f81614977565b6040860151909350615a6081614da0565b606086015190925061549a81614da0565b5f82601f830112615a80575f80fd5b81516001600160401b03811115615a9957615a99614cd4565b8060051b615aa960208201614d55565b91825260208185018101929081019086841115615ac4575f80fd5b6020860192505b838310156148e8578251615ade81614da0565b825260209283019290910190615acb565b5f60208284031215615aff575f80fd5b81516001600160401b03811115615b14575f80fd5b820160c08185031215615b25575f80fd5b615b2d614d11565b8151615b3881614977565b81526020820151615b4881614977565b60208201526040820151615b5b81614977565b6040820152615b6c606083016154a5565b6060820152615b7d608083016154a5565b608082015260a08201516001600160401b03811115615b9a575f80fd5b615ba686828501615a71565b60a083015250949350505050565b5f60208284031215615bc4575f80fd5b815161088b81614da0565b5f8260020b80615be157615be1615736565b808360020b0791505092915050565b600281810b9083900b01627fffff8113627fffff19821217156107e5576107e5615082565b600282810b9082900b03627fffff198112627fffff821317156107e5576107e5615082565b80820281158282048414176107e5576107e5615082565b5f82615c5f57615c5f615736565b500490565b5f60208284031215615c74575f80fd5b815161088b81614b3f565b5f8251615c90818460208701614fe0565b919091019291505056fe1b3d7edb2e9c0b0e7c525b20aaaef0f5940d2ed71663c7d39266ecafac728859a264697066735822122007300567b2cf05fafa901c618b1ec890e8e79aa223d752eb696875500872ee5364736f6c634300081a0033

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

0000000000000000000000009dc698c4c72e407eccb8244bf341e90ce71026b200000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef30146866f3a846fe3c636beb2756dbd24cf321bc52c9113c837c21f47470dfeb

-----Decoded View---------------
Arg [0] : _feeReceiver (address): 0x9DC698C4c72e407ECcb8244bf341e90CE71026b2
Arg [1] : _factory (address): 0x56CFC796bC88C9c7e1b38C2b0aF9B7120B079aef
Arg [2] : _pool_init_code_hash (bytes32): 0x30146866f3a846fe3c636beb2756dbd24cf321bc52c9113c837c21f47470dfeb

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000009dc698c4c72e407eccb8244bf341e90ce71026b2
Arg [1] : 00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef
Arg [2] : 30146866f3a846fe3c636beb2756dbd24cf321bc52c9113c837c21f47470dfeb


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
[ Download: CSV Export  ]

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