false
true
0

Contract Address Details

0x9dE3F4847186677E51CC9E39e07d30bd58927f6A

Contract Name
GUniRouter
Creator
0x88215a–831c78 at 0x82df59–4dba1b
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
26200153
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
GUniRouter




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
10
EVM Version
istanbul




Verified at
2026-04-04T17:19:19.703746Z

Constructor Arguments

0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000014e6d67f824c3a7b4329d3228807f8654294e4bd

Arg [0] (address) : 0x1f98431c8ad98523631ae4a59f267346ea31f984
Arg [1] (address) : 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] (address) : 0x14e6d67f824c3a7b4329d3228807f8654294e4bd

              

contracts/GUniRouter.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.4;

import {IGUniRouter} from "./interfaces/IGUniRouter.sol";
import {IGUniPool} from "./interfaces/IGUniPool.sol";
import {IUniswapV3Pool} from "./interfaces/IUniswapV3Pool.sol";
import {IWETH} from "./interfaces/IWETH.sol";
import {
    IERC20,
    SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {
    IUniswapV3SwapCallback
} from "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";
import {
    IUniswapV3Factory
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import {
    Initializable
} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {
    PausableUpgradeable
} from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import {
    OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract GUniRouter is
    IGUniRouter,
    IUniswapV3SwapCallback,
    Initializable,
    PausableUpgradeable,
    OwnableUpgradeable
{
    using Address for address payable;
    using SafeERC20 for IERC20;

    IWETH public immutable weth;
    IUniswapV3Factory public immutable factory;
    address internal immutable _blacklistedRouter;

    constructor(
        IUniswapV3Factory _factory,
        IWETH _weth,
        address _blacklisted
    ) {
        weth = _weth;
        factory = _factory;
        _blacklistedRouter = _blacklisted;
    }

    function initialize() external initializer {
        __Pausable_init();
        __Ownable_init();
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    /// @notice Uniswap v3 callback fn, called back on pool.swap
    // solhint-disable-next-line code-complexity
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata
    ) external override {
        IUniswapV3Pool pool = IUniswapV3Pool(msg.sender);
        address token0 = pool.token0();
        address token1 = pool.token1();
        uint24 fee = pool.fee();

        require(
            msg.sender == factory.getPool(token0, token1, fee),
            "invalid uniswap pool"
        );

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

    /// @notice addLiquidity adds liquidity to G-UNI pool of interest (mints G-UNI LP tokens)
    /// @param pool address of G-UNI pool to add liquidity to
    /// @param amount0Max the maximum amount of token0 msg.sender willing to input
    /// @param amount1Max the maximum amount of token1 msg.sender willing to input
    /// @param amount0Min the minimum amount of token0 actually input (slippage protection)
    /// @param amount1Min the minimum amount of token1 actually input (slippage protection)
    /// @param receiver account to receive minted G-UNI tokens
    /// @return amount0 amount of token0 transferred from msg.sender to mint `mintAmount`
    /// @return amount1 amount of token1 transferred from msg.sender to mint `mintAmount`
    /// @return mintAmount amount of G-UNI tokens minted and transferred to `receiver`
    // solhint-disable-next-line function-max-lines
    function addLiquidity(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        override
        whenNotPaused
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        IERC20 token0 = pool.token0();
        IERC20 token1 = pool.token1();
        _hasRevoked(pool, token0, token1, receiver);
        (uint256 amount0In, uint256 amount1In, uint256 _mintAmount) =
            pool.getMintAmounts(amount0Max, amount1Max);
        require(
            amount0In >= amount0Min && amount1In >= amount1Min,
            "below min amounts"
        );
        if (amount0In > 0) {
            token0.safeTransferFrom(msg.sender, address(this), amount0In);
        }
        if (amount1In > 0) {
            token1.safeTransferFrom(msg.sender, address(this), amount1In);
        }

        return _deposit(pool, amount0In, amount1In, _mintAmount, receiver);
    }

    /// @notice addLiquidityETH same as addLiquidity but expects ETH transfers (instead of WETH)
    // solhint-disable-next-line code-complexity, function-max-lines
    function addLiquidityETH(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        payable
        override
        whenNotPaused
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        IERC20 token0 = pool.token0();
        IERC20 token1 = pool.token1();
        _hasRevoked(pool, token0, token1, receiver);

        (uint256 amount0In, uint256 amount1In, uint256 _mintAmount) =
            pool.getMintAmounts(amount0Max, amount1Max);
        require(
            amount0In >= amount0Min && amount1In >= amount1Min,
            "below min amounts"
        );

        if (_isToken0Weth(address(token0), address(token1))) {
            require(
                amount0Max == msg.value,
                "mismatching amount of ETH forwarded"
            );
            if (amount0In > 0) {
                weth.deposit{value: amount0In}();
            }
            if (amount1In > 0) {
                token1.safeTransferFrom(msg.sender, address(this), amount1In);
            }
        } else {
            require(
                amount1Max == msg.value,
                "mismatching amount of ETH forwarded"
            );
            if (amount1In > 0) {
                weth.deposit{value: amount1In}();
            }
            if (amount0In > 0) {
                token0.safeTransferFrom(msg.sender, address(this), amount0In);
            }
        }

        (amount0, amount1, mintAmount) = _deposit(
            pool,
            amount0In,
            amount1In,
            _mintAmount,
            receiver
        );

        if (_isToken0Weth(address(token0), address(token1))) {
            if (amount0Max > amount0In) {
                payable(msg.sender).sendValue(amount0Max - amount0In);
            }
        } else {
            if (amount1Max > amount1In) {
                payable(msg.sender).sendValue(amount1Max - amount1In);
            }
        }
    }

    /// @notice rebalanceAndAddLiquidity accomplishes same task as addLiquidity/addLiquidityETH
    /// but msg.sender rebalances their holdings (performs a swap) before adding liquidity.
    /// @param pool address of G-UNI pool to add liquidity to
    /// @param amount0In the amount of token0 msg.sender forwards to router
    /// @param amount1In the amount of token1 msg.sender forwards to router
    /// @param zeroForOne Which token to swap (true = token0, false = token1)
    /// @param swapAmount the amount of token to swap
    /// @param swapThreshold the slippage parameter of the swap as a min or max sqrtPriceX96
    /// @param amount0Min the minimum amount of token0 actually deposited (slippage protection)
    /// @param amount1Min the minimum amount of token1 actually deposited (slippage protection)
    /// @param receiver account to receive minted G-UNI tokens
    /// @return amount0 amount of token0 actually deposited into pool
    /// @return amount1 amount of token1 actually deposited into pool
    /// @return mintAmount amount of G-UNI tokens minted and transferred to `receiver`
    /// @dev because router performs a swap on behalf of msg.sender and slippage is possible
    /// some value unused in mint can be returned to msg.sender in token0 and token1 make sure
    /// to consult return values or measure balance changes after a rebalanceAndAddLiquidity call.
    // solhint-disable-next-line function-max-lines
    function rebalanceAndAddLiquidity(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        override
        whenNotPaused
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        _hasRevoked(pool, pool.token0(), pool.token1(), receiver);

        (uint256 amount0Use, uint256 amount1Use, uint256 _mintAmount) =
            _prepareRebalanceDeposit(
                pool,
                amount0In,
                amount1In,
                zeroForOne,
                swapAmount,
                swapThreshold
            );
        require(
            amount0Use >= amount0Min && amount1Use >= amount1Min,
            "below min amounts"
        );

        return _deposit(pool, amount0Use, amount1Use, _mintAmount, receiver);
    }

    /// @notice rebalanceAndAddLiquidityETH same as rebalanceAndAddLiquidity
    /// except this function expects ETH transfer (instead of WETH)
    // solhint-disable-next-line function-max-lines, code-complexity
    function rebalanceAndAddLiquidityETH(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        payable
        override
        whenNotPaused
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        _hasRevoked(pool, pool.token0(), pool.token1(), receiver);

        (uint256 amount0Use, uint256 amount1Use, uint256 _mintAmount) =
            _prepareAndRebalanceDepositETH(
                pool,
                amount0In,
                amount1In,
                zeroForOne,
                swapAmount,
                swapThreshold
            );
        require(
            amount0Use >= amount0Min && amount1Use >= amount1Min,
            "below min amounts"
        );

        (amount0, amount1, mintAmount) = _deposit(
            pool,
            amount0Use,
            amount1Use,
            _mintAmount,
            receiver
        );

        uint256 leftoverBalance =
            IERC20(address(weth)).balanceOf(address(this));
        if (leftoverBalance > 0) {
            weth.withdraw(leftoverBalance);
            payable(msg.sender).sendValue(leftoverBalance);
        }
    }

    /// @notice removeLiquidity removes liquidity from a G-UNI pool and burns G-UNI LP tokens
    /// @param burnAmount The number of G-UNI tokens to burn
    /// @param amount0Min Minimum amount of token0 received after burn (slippage protection)
    /// @param amount1Min Minimum amount of token1 received after burn (slippage protection)
    /// @param receiver The account to receive the underlying amounts of token0 and token1
    /// @return amount0 actual amount of token0 transferred to receiver for burning `burnAmount`
    /// @return amount1 actual amount of token1 transferred to receiver for burning `burnAmount`
    /// @return liquidityBurned amount of liquidity removed from the underlying Uniswap V3 position
    function removeLiquidity(
        IGUniPool pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        override
        whenNotPaused
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        )
    {
        _hasRevoked(pool, pool.token0(), pool.token1(), receiver);
        IERC20(address(pool)).safeTransferFrom(
            msg.sender,
            address(this),
            burnAmount
        );
        (amount0, amount1, liquidityBurned) = pool.burn(burnAmount, receiver);
        require(
            amount0 >= amount0Min && amount1 >= amount1Min,
            "received below minimum"
        );
    }

    /// @notice removeLiquidityETH same as removeLiquidity
    /// except this function unwraps WETH and sends ETH to receiver account
    // solhint-disable-next-line code-complexity, function-max-lines
    function removeLiquidityETH(
        IGUniPool pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address payable receiver
    )
        external
        override
        whenNotPaused
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        )
    {
        IERC20 token0 = pool.token0();
        IERC20 token1 = pool.token1();
        _hasRevoked(pool, token0, token1, receiver);

        bool wethToken0 = _isToken0Weth(address(token0), address(token1));

        IERC20(address(pool)).safeTransferFrom(
            msg.sender,
            address(this),
            burnAmount
        );
        (amount0, amount1, liquidityBurned) = pool.burn(
            burnAmount,
            address(this)
        );
        require(
            amount0 >= amount0Min && amount1 >= amount1Min,
            "received below minimum"
        );

        if (wethToken0) {
            if (amount0 > 0) {
                weth.withdraw(amount0);
                receiver.sendValue(amount0);
            }
            if (amount1 > 0) {
                token1.safeTransfer(receiver, amount1);
            }
        } else {
            if (amount1 > 0) {
                weth.withdraw(amount1);
                receiver.sendValue(amount1);
            }
            if (amount0 > 0) {
                token0.safeTransfer(receiver, amount0);
            }
        }
    }

    function _deposit(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        uint256 _mintAmount,
        address receiver
    )
        internal
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        if (amount0In > 0) {
            pool.token0().safeIncreaseAllowance(address(pool), amount0In);
        }
        if (amount1In > 0) {
            pool.token1().safeIncreaseAllowance(address(pool), amount1In);
        }

        (amount0, amount1, ) = pool.mint(_mintAmount, receiver);
        require(
            amount0 == amount0In && amount1 == amount1In,
            "unexpected amounts deposited"
        );
        mintAmount = _mintAmount;
    }

    // solhint-disable-next-line function-max-lines
    function _prepareRebalanceDeposit(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold
    )
        internal
        returns (
            uint256 amount0Use,
            uint256 amount1Use,
            uint256 mintAmount
        )
    {
        IERC20 token0 = pool.token0();
        IERC20 token1 = pool.token1();
        if (amount0In > 0) {
            token0.safeTransferFrom(msg.sender, address(this), amount0In);
        }
        if (amount1In > 0) {
            token1.safeTransferFrom(msg.sender, address(this), amount1In);
        }

        _swap(pool, zeroForOne, int256(swapAmount), swapThreshold);

        uint256 amount0Max = token0.balanceOf(address(this));
        uint256 amount1Max = token1.balanceOf(address(this));

        (amount0Use, amount1Use, mintAmount) = _getAmountsAndRefund(
            pool,
            amount0Max,
            amount1Max
        );
    }

    // solhint-disable-next-line code-complexity, function-max-lines
    function _prepareAndRebalanceDepositETH(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold
    )
        internal
        returns (
            uint256 amount0Use,
            uint256 amount1Use,
            uint256 mintAmount
        )
    {
        IERC20 token0 = pool.token0();
        IERC20 token1 = pool.token1();
        bool wethToken0 = _isToken0Weth(address(token0), address(token1));

        if (amount0In > 0) {
            if (wethToken0) {
                require(
                    amount0In == msg.value,
                    "mismatching amount of ETH forwarded"
                );
                weth.deposit{value: amount0In}();
            } else {
                token0.safeTransferFrom(msg.sender, address(this), amount0In);
            }
        }

        if (amount1In > 0) {
            if (wethToken0) {
                token1.safeTransferFrom(msg.sender, address(this), amount1In);
            } else {
                require(
                    amount1In == msg.value,
                    "mismatching amount of ETH forwarded"
                );
                weth.deposit{value: amount1In}();
            }
        }

        _swap(pool, zeroForOne, int256(swapAmount), swapThreshold);

        uint256 amount0Max = token0.balanceOf(address(this));
        uint256 amount1Max = token1.balanceOf(address(this));

        (amount0Use, amount1Use, mintAmount) = _getAmountsAndRefundExceptETH(
            pool,
            amount0Max,
            amount1Max,
            wethToken0
        );
    }

    function _swap(
        IGUniPool pool,
        bool zeroForOne,
        int256 swapAmount,
        uint160 swapThreshold
    ) internal {
        pool.pool().swap(
            address(this),
            zeroForOne,
            swapAmount,
            swapThreshold,
            ""
        );
    }

    function _getAmountsAndRefund(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max
    )
        internal
        returns (
            uint256 amount0In,
            uint256 amount1In,
            uint256 mintAmount
        )
    {
        (amount0In, amount1In, mintAmount) = pool.getMintAmounts(
            amount0Max,
            amount1Max
        );
        if (amount0Max > amount0In) {
            pool.token0().safeTransfer(msg.sender, amount0Max - amount0In);
        }
        if (amount1Max > amount1In) {
            pool.token1().safeTransfer(msg.sender, amount1Max - amount1In);
        }
    }

    function _getAmountsAndRefundExceptETH(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max,
        bool wethToken0
    )
        internal
        returns (
            uint256 amount0In,
            uint256 amount1In,
            uint256 mintAmount
        )
    {
        (amount0In, amount1In, mintAmount) = pool.getMintAmounts(
            amount0Max,
            amount1Max
        );

        if (amount0Max > amount0In && !wethToken0) {
            pool.token0().safeTransfer(msg.sender, amount0Max - amount0In);
        } else if (amount1Max > amount1In && wethToken0) {
            pool.token1().safeTransfer(msg.sender, amount1Max - amount1In);
        }
    }

    function _hasRevoked(
        IGUniPool pool,
        IERC20 token0,
        IERC20 token1,
        address receiver
    ) internal view {
        uint256 allowance0 = token0.allowance(receiver, _blacklistedRouter);
        uint256 allowance1 = token1.allowance(receiver, _blacklistedRouter);
        uint256 allowanceG =
            IERC20(address(pool)).allowance(receiver, _blacklistedRouter);
        require(
            allowance0 == 0 && allowance1 == 0 && allowanceG == 0,
            "NEEDS REVOKE"
        );
    }

    function _isToken0Weth(address token0, address token1)
        internal
        view
        returns (bool wethToken0)
    {
        if (token0 == address(weth)) {
            wethToken0 = true;
        } else if (token1 == address(weth)) {
            wethToken0 = false;
        } else {
            revert("one pool token must be WETH");
        }
    }
}
        

/callback/IUniswapV3SwapCallback.sol

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

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

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

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

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

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

/PausableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

/pool/IUniswapV3PoolState.sol

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

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

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

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

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

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

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

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

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

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

/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}
          

/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

/ContextUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}
          

/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

/IUniswapV3Factory.sol

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

/// @title The interface for the Uniswap V3 Factory
/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
interface IUniswapV3Factory {
    /// @notice Emitted when the owner of the factory is changed
    /// @param oldOwner The owner before the owner was changed
    /// @param newOwner The owner after the owner was changed
    event OwnerChanged(address indexed oldOwner, address indexed newOwner);

    /// @notice Emitted when a pool is created
    /// @param token0 The first token of the pool by address sort order
    /// @param token1 The second token of the pool by address sort order
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks
    /// @param pool The address of the created pool
    event PoolCreated(
        address indexed token0,
        address indexed token1,
        uint24 indexed fee,
        int24 tickSpacing,
        address pool
    );

    /// @notice Emitted when a new fee amount is enabled for pool creation via the factory
    /// @param fee The enabled fee, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee
    event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);

    /// @notice Returns the current owner of the factory
    /// @dev Can be changed by the current owner via setOwner
    /// @return The address of the factory owner
    function owner() external view returns (address);

    /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled
    /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context
    /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee
    /// @return The tick spacing
    function feeAmountTickSpacing(uint24 fee) external view returns (int24);

    /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @return pool The pool address
    function getPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external view returns (address pool);

    /// @notice Creates a pool for the given two tokens and fee
    /// @param tokenA One of the two tokens in the desired pool
    /// @param tokenB The other of the two tokens in the desired pool
    /// @param fee The desired fee for the pool
    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
    /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
    /// are invalid.
    /// @return pool The address of the newly created pool
    function createPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external returns (address pool);

    /// @notice Updates the owner of the factory
    /// @dev Must be called by the current owner
    /// @param _owner The new owner of the factory
    function setOwner(address _owner) external;

    /// @notice Enables a fee amount with the given tickSpacing
    /// @dev Fee amounts may never be removed once enabled
    /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount
    function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
}
          

/IUniswapV3Pool.sol

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

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

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

}
          

/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../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;

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

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

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

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

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

    /**
     * @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, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

/Address.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

/IUniswapV3Pool.sol

// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;

import {
    IUniswapV3Pool
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
          

/IGUniRouter.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.4;

import {IGUniPool} from "./IGUniPool.sol";

interface IGUniRouter {
    function addLiquidity(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        );

    function addLiquidityETH(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        payable
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        );

    function rebalanceAndAddLiquidity(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        );

    function rebalanceAndAddLiquidityETH(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        payable
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        );

    function removeLiquidity(
        IGUniPool pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        );

    function removeLiquidityETH(
        IGUniPool pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address payable receiver
    )
        external
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        );
}
          

/IGUniPool.sol

// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import {
    IUniswapV3Pool
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

interface IGUniPool {
    function mint(uint256 mintAmount, address receiver)
        external
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityMinted
        );

    function burn(uint256 burnAmount, address receiver)
        external
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        );

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

    function getUnderlyingBalances()
        external
        view
        returns (uint256 amount0, uint256 amount1);

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

    function token0() external view returns (IERC20);

    function token1() external view returns (IERC20);

    function upperTick() external view returns (int24);

    function lowerTick() external view returns (int24);

    function pool() external view returns (IUniswapV3Pool);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);
}
          

/IWETH.sol

// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;

interface IWETH {
    function deposit() external payable;

    function transfer(address to, uint256 value) external returns (bool);

    function withdraw(uint256) external;
}
          

Compiler Settings

{"remappings":[],"optimizer":{"runs":10,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"contracts/GUniRouter.sol":"GUniRouter"}}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_factory","internalType":"contract IUniswapV3Factory"},{"type":"address","name":"_weth","internalType":"contract IWETH"},{"type":"address","name":"_blacklisted","internalType":"address"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"amount0","internalType":"uint256"},{"type":"uint256","name":"amount1","internalType":"uint256"},{"type":"uint256","name":"mintAmount","internalType":"uint256"}],"name":"addLiquidity","inputs":[{"type":"address","name":"pool","internalType":"contract IGUniPool"},{"type":"uint256","name":"amount0Max","internalType":"uint256"},{"type":"uint256","name":"amount1Max","internalType":"uint256"},{"type":"uint256","name":"amount0Min","internalType":"uint256"},{"type":"uint256","name":"amount1Min","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"amount0","internalType":"uint256"},{"type":"uint256","name":"amount1","internalType":"uint256"},{"type":"uint256","name":"mintAmount","internalType":"uint256"}],"name":"addLiquidityETH","inputs":[{"type":"address","name":"pool","internalType":"contract IGUniPool"},{"type":"uint256","name":"amount0Max","internalType":"uint256"},{"type":"uint256","name":"amount1Max","internalType":"uint256"},{"type":"uint256","name":"amount0Min","internalType":"uint256"},{"type":"uint256","name":"amount1Min","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IUniswapV3Factory"}],"name":"factory","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"amount0","internalType":"uint256"},{"type":"uint256","name":"amount1","internalType":"uint256"},{"type":"uint256","name":"mintAmount","internalType":"uint256"}],"name":"rebalanceAndAddLiquidity","inputs":[{"type":"address","name":"pool","internalType":"contract IGUniPool"},{"type":"uint256","name":"amount0In","internalType":"uint256"},{"type":"uint256","name":"amount1In","internalType":"uint256"},{"type":"bool","name":"zeroForOne","internalType":"bool"},{"type":"uint256","name":"swapAmount","internalType":"uint256"},{"type":"uint160","name":"swapThreshold","internalType":"uint160"},{"type":"uint256","name":"amount0Min","internalType":"uint256"},{"type":"uint256","name":"amount1Min","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"amount0","internalType":"uint256"},{"type":"uint256","name":"amount1","internalType":"uint256"},{"type":"uint256","name":"mintAmount","internalType":"uint256"}],"name":"rebalanceAndAddLiquidityETH","inputs":[{"type":"address","name":"pool","internalType":"contract IGUniPool"},{"type":"uint256","name":"amount0In","internalType":"uint256"},{"type":"uint256","name":"amount1In","internalType":"uint256"},{"type":"bool","name":"zeroForOne","internalType":"bool"},{"type":"uint256","name":"swapAmount","internalType":"uint256"},{"type":"uint160","name":"swapThreshold","internalType":"uint160"},{"type":"uint256","name":"amount0Min","internalType":"uint256"},{"type":"uint256","name":"amount1Min","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"amount0","internalType":"uint256"},{"type":"uint256","name":"amount1","internalType":"uint256"},{"type":"uint128","name":"liquidityBurned","internalType":"uint128"}],"name":"removeLiquidity","inputs":[{"type":"address","name":"pool","internalType":"contract IGUniPool"},{"type":"uint256","name":"burnAmount","internalType":"uint256"},{"type":"uint256","name":"amount0Min","internalType":"uint256"},{"type":"uint256","name":"amount1Min","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"amount0","internalType":"uint256"},{"type":"uint256","name":"amount1","internalType":"uint256"},{"type":"uint128","name":"liquidityBurned","internalType":"uint128"}],"name":"removeLiquidityETH","inputs":[{"type":"address","name":"pool","internalType":"contract IGUniPool"},{"type":"uint256","name":"burnAmount","internalType":"uint256"},{"type":"uint256","name":"amount0Min","internalType":"uint256"},{"type":"uint256","name":"amount1Min","internalType":"uint256"},{"type":"address","name":"receiver","internalType":"address payable"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"uniswapV3SwapCallback","inputs":[{"type":"int256","name":"amount0Delta","internalType":"int256"},{"type":"int256","name":"amount1Delta","internalType":"int256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IWETH"}],"name":"weth","inputs":[]}]
              

Contract Creation Code

0x60e06040523480156200001157600080fd5b50604051620032e6380380620032e683398101604081905262000034916200005b565b6001600160601b0319606092831b811660805292821b831660a052901b1660c052620000c7565b60008060006060848603121562000070578283fd5b83516200007d81620000ae565b60208501519093506200009081620000ae565b6040850151909250620000a381620000ae565b809150509250925092565b6001600160a01b0381168114620000c457600080fd5b50565b60805160601c60a05160601c60c05160601c61318b6200015b6000396000818161169a0152818161172801526117ca01526000818161024d0152610f5b015260008181610131015281816108860152818161093901528181610c0001528181610ca3015281816114bf0152818161157901528181611dc701528181611e090152818161221001526122e3015261318b6000f3fe6080604052600436106100c35760003560e01c806333f9ab55146100c85780633f4ba83a146101085780633fc8cef31461011f57806359f842b2146101605780635c975abb146101a45780636587e4ce146101c7578063715018a6146101e75780638129fc1c146101fc5780638456cb59146102115780638da5cb5b14610226578063c45a01551461023b578063dcdf72021461026f578063f2fde38b14610282578063fa461e33146102a2578063fb9f4789146102c2578063fbec41a8146102e2575b600080fd5b3480156100d457600080fd5b506100e86100e3366004612c43565b6102f5565b604080519384526020840192909252908201526060015b60405180910390f35b34801561011457600080fd5b5061011d610482565b005b34801561012b57600080fd5b506101537f000000000000000000000000000000000000000000000000000000000000000081565b6040516100ff9190612ee8565b34801561016c57600080fd5b5061018061017b366004612cd1565b6104bb565b6040805193845260208401929092526001600160801b0316908201526060016100ff565b3480156101b057600080fd5b5060335460ff1660405190151581526020016100ff565b3480156101d357600080fd5b506101806101e2366004612cd1565b61066a565b3480156101f357600080fd5b5061011d6109d9565b34801561020857600080fd5b5061011d610a12565b34801561021d57600080fd5b5061011d610adb565b34801561023257600080fd5b50610153610b12565b34801561024757600080fd5b506101537f000000000000000000000000000000000000000000000000000000000000000081565b6100e861027d366004612c43565b610b21565b34801561028e57600080fd5b5061011d61029d366004612bef565b610d27565b3480156102ae57600080fd5b5061011d6102bd366004612da6565b610dc4565b3480156102ce57600080fd5b506100e86102dd366004612d26565b611077565b6100e86102f0366004612d26565b6112ad565b600080600061030660335460ff1690565b1561032c5760405162461bcd60e51b815260040161032390612f62565b60405180910390fd5b6104188c8d6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561036957600080fd5b505afa15801561037d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a19190612c0b565b8e6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156103da57600080fd5b505afa1580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104129190612c0b565b87611671565b600080600061042b8f8f8f8f8f8f6118b2565b9250925092508883101580156104415750878210155b61045d5760405162461bcd60e51b815260040161032390612ff1565b61046a8f8484848b611b04565b95509550955050505099509950999650505050505050565b3361048b610b12565b6001600160a01b0316146104b15760405162461bcd60e51b815260040161032390612fbc565b6104b9611cc5565b565b60008060006104cc60335460ff1690565b156104e95760405162461bcd60e51b815260040161032390612f62565b61059788896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561052657600080fd5b505afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e9190612c0b565b8a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156103da57600080fd5b6105ac6001600160a01b03891633308a611d52565b604051633f34d4cf60e21b81526001600160a01b0389169063fcd3533c906105da908a9088906004016130aa565b606060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062c9190612e5b565b919450925090508583108015906106435750848210155b61065f5760405162461bcd60e51b815260040161032390612f8c565b955095509592505050565b600080600061067b60335460ff1690565b156106985760405162461bcd60e51b815260040161032390612f62565b6000886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156106d357600080fd5b505afa1580156106e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070b9190612c0b565b90506000896001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561074857600080fd5b505afa15801561075c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107809190612c0b565b905061078e8a838389611671565b600061079a8383611dc3565b90506107b16001600160a01b038c1633308d611d52565b604051633f34d4cf60e21b81526001600160a01b038c169063fcd3533c906107df908d9030906004016130aa565b606060405180830381600087803b1580156107f957600080fd5b505af115801561080d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108319190612e5b565b919750955093508886108015906108485750878510155b6108645760405162461bcd60e51b815260040161032390612f8c565b801561091d5785156108fe57604051632e1a7d4d60e01b8152600481018790527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156108d257600080fd5b505af11580156108e6573d6000803e3d6000fd5b506108fe925050506001600160a01b03881687611e95565b8415610918576109186001600160a01b0383168887611fb0565b6109cb565b84156109b157604051632e1a7d4d60e01b8152600481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561098557600080fd5b505af1158015610999573d6000803e3d6000fd5b506109b1925050506001600160a01b03881686611e95565b85156109cb576109cb6001600160a01b0384168888611fb0565b505050955095509592505050565b336109e2610b12565b6001600160a01b031614610a085760405162461bcd60e51b815260040161032390612fbc565b6104b96000611fcf565b600054610100900460ff16610a2d5760005460ff1615610a31565b303b155b610a945760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610323565b600054610100900460ff16158015610ab6576000805461ffff19166101011790555b610abe612021565b610ac6612058565b8015610ad8576000805461ff00191690555b50565b33610ae4610b12565b6001600160a01b031614610b0a5760405162461bcd60e51b815260040161032390612fbc565b6104b961208f565b6065546001600160a01b031690565b6000806000610b3260335460ff1690565b15610b4f5760405162461bcd60e51b815260040161032390612f62565b610b8c8c8d6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561036957600080fd5b6000806000610b9f8f8f8f8f8f8f6120e7565b925092509250888310158015610bb55750878210155b610bd15760405162461bcd60e51b815260040161032390612ff1565b610bde8f8484848b611b04565b6040516370a0823160e01b815292985090965094506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610c35903090600401612ee8565b60206040518083038186803b158015610c4d57600080fd5b505afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c859190612e43565b90508015610d1457604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b50610d149250339150839050611e95565b5050505099509950999650505050505050565b33610d30610b12565b6001600160a01b031614610d565760405162461bcd60e51b815260040161032390612fbc565b6001600160a01b038116610dbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610323565b610ad881611fcf565b60003390506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0457600080fd5b505afa158015610e18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3c9190612c0b565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e7957600080fd5b505afa158015610e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb19190612c0b565b90506000836001600160a01b031663ddca3f436040518163ffffffff1660e01b815260040160206040518083038186803b158015610eee57600080fd5b505afa158015610f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f269190612e20565b604051630b4c774160e11b81526001600160a01b038581166004830152848116602483015262ffffff831660448301529192507f000000000000000000000000000000000000000000000000000000000000000090911690631698ee829060640160206040518083038186803b158015610f9f57600080fd5b505afa158015610fb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd79190612c0b565b6001600160a01b0316336001600160a01b03161461102e5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d5b9a5cddd85c081c1bdbdb60621b6044820152606401610323565b60008813156110505761104b6001600160a01b038416338a611fb0565b61106d565b600087131561106d5761106d6001600160a01b0383163389611fb0565b5050505050505050565b600080600061108860335460ff1690565b156110a55760405162461bcd60e51b815260040161032390612f62565b6000896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156110e057600080fd5b505afa1580156110f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111189190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561115557600080fd5b505afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d9190612c0b565b905061119b8b838389611671565b604051634c4a790d60e11b8152600481018b9052602481018a9052600090819081906001600160a01b038f1690639894f21a9060440160606040518083038186803b1580156111e957600080fd5b505afa1580156111fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112219190612e9f565b9250925092508a83101580156112375750898210155b6112535760405162461bcd60e51b815260040161032390612ff1565b821561126e5761126e6001600160a01b038616333086611d52565b8115611289576112896001600160a01b038516333085611d52565b6112968e8484848d611b04565b975097509750505050505096509650969350505050565b60008060006112be60335460ff1690565b156112db5760405162461bcd60e51b815260040161032390612f62565b6000896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561131657600080fd5b505afa15801561132a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134e9190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561138b57600080fd5b505afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190612c0b565b90506113d18b838389611671565b604051634c4a790d60e11b8152600481018b9052602481018a9052600090819081906001600160a01b038f1690639894f21a9060440160606040518083038186803b15801561141f57600080fd5b505afa158015611433573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114579190612e9f565b9250925092508a831015801561146d5750898210155b6114895760405162461bcd60e51b815260040161032390612ff1565b6114938585611dc3565b1561155257348d146114b75760405162461bcd60e51b81526004016103239061301c565b8215611532577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561151857600080fd5b505af115801561152c573d6000803e3d6000fd5b50505050505b811561154d5761154d6001600160a01b038516333085611d52565b611607565b348c146115715760405162461bcd60e51b81526004016103239061301c565b81156115ec577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b50505050505b8215611607576116076001600160a01b038616333086611d52565b6116148e8484848d611b04565b919950975095506116258585611dc3565b1561164b57828d11156116465761164661163f848f6130d9565b3390611e95565b611660565b818c11156116605761166061163f838e6130d9565b505050505096509650969350505050565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e906116c29085907f000000000000000000000000000000000000000000000000000000000000000090600401612efc565b60206040518083038186803b1580156116da57600080fd5b505afa1580156116ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117129190612e43565b90506000836001600160a01b031663dd62ed3e847f00000000000000000000000000000000000000000000000000000000000000006040518363ffffffff1660e01b8152600401611764929190612efc565b60206040518083038186803b15801561177c57600080fd5b505afa158015611790573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b49190612e43565b90506000866001600160a01b031663dd62ed3e857f00000000000000000000000000000000000000000000000000000000000000006040518363ffffffff1660e01b8152600401611806929190612efc565b60206040518083038186803b15801561181e57600080fd5b505afa158015611832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118569190612e43565b905082158015611864575081155b801561186e575080155b6118a95760405162461bcd60e51b815260206004820152600c60248201526b4e45454453205245564f4b4560a01b6044820152606401610323565b50505050505050565b600080600080896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156118f157600080fd5b505afa158015611905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119299190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561196657600080fd5b505afa15801561197a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199e9190612c0b565b905089156119bb576119bb6001600160a01b03831633308d611d52565b88156119d6576119d66001600160a01b03821633308c611d52565b6119e28b89898961248c565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611a11903090600401612ee8565b60206040518083038186803b158015611a2957600080fd5b505afa158015611a3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a619190612e43565b90506000826001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611a919190612ee8565b60206040518083038186803b158015611aa957600080fd5b505afa158015611abd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae19190612e43565b9050611aee8d83836125a4565b919f909e50909c509a5050505050505050505050565b600080808615611b9457611b9488888a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611b4c57600080fd5b505afa158015611b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b849190612c0b565b6001600160a01b03169190612720565b8515611bd857611bd888878a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015611b4c57600080fd5b6040516394bf804d60e01b81526001600160a01b038916906394bf804d90611c0690889088906004016130aa565b606060405180830381600087803b158015611c2057600080fd5b505af1158015611c34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c589190612e5b565b5090935091508683148015611c6c57508582145b611cb75760405162461bcd60e51b815260206004820152601c60248201527b1d5b995e1c1958dd195908185b5bdd5b9d1cc819195c1bdcda5d195960221b6044820152606401610323565b849050955095509592505050565b60335460ff16611d0e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610323565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611d489190612ee8565b60405180910390a1565b6040516001600160a01b0380851660248301528316604482015260648101829052611dbd9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127cc565b50505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03161415611e0757506001611e8f565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161415611e4957506000611e8f565b60405162461bcd60e51b815260206004820152601b60248201527a0dedcca40e0deded840e8ded6cadc40daeae6e840c4ca40ae8aa89602b1b6044820152606401610323565b92915050565b80471015611ee55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610323565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f32576040519150601f19603f3d011682016040523d82523d6000602084013e611f37565b606091505b5050905080611fab5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b6064820152608401610323565b505050565b611fab8363a9059cbb60e01b8484604051602401611d86929190612f16565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166120485760405162461bcd60e51b81526004016103239061305f565b61205061289e565b6104b96128c5565b600054610100900460ff1661207f5760405162461bcd60e51b81526004016103239061305f565b61208761289e565b6104b96128f8565b60335460ff16156120b25760405162461bcd60e51b815260040161032390612f62565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d3b3390565b600080600080896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561212657600080fd5b505afa15801561213a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215e9190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561219b57600080fd5b505afa1580156121af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d39190612c0b565b905060006121e18383611dc3565b90508a1561229c57801561228757348b1461220e5760405162461bcd60e51b81526004016103239061301c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08c6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561226957600080fd5b505af115801561227d573d6000803e3d6000fd5b505050505061229c565b61229c6001600160a01b03841633308e611d52565b89156123565780156122c2576122bd6001600160a01b03831633308d611d52565b612356565b348a146122e15760405162461bcd60e51b81526004016103239061301c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08b6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561233c57600080fd5b505af1158015612350573d6000803e3d6000fd5b50505050505b6123628c8a8a8a61248c565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612391903090600401612ee8565b60206040518083038186803b1580156123a957600080fd5b505afa1580156123bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e19190612e43565b90506000836001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016124119190612ee8565b60206040518083038186803b15801561242957600080fd5b505afa15801561243d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124619190612e43565b905061246f8e838386612928565b809850819950829a50505050505050505096509650969350505050565b836001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156124c557600080fd5b505afa1580156124d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124fd9190612c0b565b604051630251596160e31b81523060048201528415156024820152604481018490526001600160a01b03838116606483015260a06084830152600060a4830152919091169063128acb089060c4016040805180830381600087803b15801561256457600080fd5b505af1158015612578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259c9190612d83565b505050505050565b604051634c4a790d60e11b81526004810183905260248101829052600090819081906001600160a01b03871690639894f21a9060440160606040518083038186803b1580156125f257600080fd5b505afa158015612606573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262a9190612e9f565b91945092509050828511156126c8576126c83361264785886130d9565b886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b505afa158015612694573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b89190612c0b565b6001600160a01b03169190611fb0565b8184111561271757612717336126de84876130d9565b886001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b93509350939050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b8152600401612751929190612efc565b60206040518083038186803b15801561276957600080fd5b505afa15801561277d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a19190612e43565b6127ab91906130c1565b9050611dbd8463095ea7b360e01b8584604051602401611d86929190612f16565b6000612821826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a759092919063ffffffff16565b805190915015611fab578080602001905181019061283f9190612c27565b611fab5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610323565b600054610100900460ff166104b95760405162461bcd60e51b81526004016103239061305f565b600054610100900460ff166128ec5760405162461bcd60e51b81526004016103239061305f565b6033805460ff19169055565b600054610100900460ff1661291f5760405162461bcd60e51b81526004016103239061305f565b6104b933611fcf565b604051634c4a790d60e11b81526004810184905260248101839052600090819081906001600160a01b03881690639894f21a9060440160606040518083038186803b15801561297657600080fd5b505afa15801561298a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ae9190612e9f565b9194509250905082861180156129c2575083155b15612a1357612a0e336129d585896130d9565b896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b612a6b565b8185118015612a1f5750835b15612a6b57612a6b33612a3284886130d9565b896001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b9450945094915050565b6060612a848484600085612a8e565b90505b9392505050565b606082471015612aef5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610323565b843b612b3d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610323565b600080866001600160a01b03168587604051612b599190612ecc565b60006040518083038185875af1925050503d8060008114612b96576040519150601f19603f3d011682016040523d82523d6000602084013e612b9b565b606091505b5091509150612bab828286612bb6565b979650505050505050565b60608315612bc5575081612a87565b825115612bd55782518084602001fd5b8160405162461bcd60e51b81526004016103239190612f2f565b600060208284031215612c00578081fd5b8135612a8781613132565b600060208284031215612c1c578081fd5b8151612a8781613132565b600060208284031215612c38578081fd5b8151612a8781613147565b60008060008060008060008060006101208a8c031215612c61578485fd5b8935612c6c81613132565b985060208a0135975060408a0135965060608a0135612c8a81613147565b955060808a0135945060a08a0135612ca181613132565b935060c08a0135925060e08a013591506101008a0135612cc081613132565b809150509295985092959850929598565b600080600080600060a08688031215612ce8578081fd5b8535612cf381613132565b94506020860135935060408601359250606086013591506080860135612d1881613132565b809150509295509295909350565b60008060008060008060c08789031215612d3e578182fd5b8635612d4981613132565b95506020870135945060408701359350606087013592506080870135915060a0870135612d7581613132565b809150509295509295509295565b60008060408385031215612d95578182fd5b505080516020909101519092909150565b60008060008060608587031215612dbb578182fd5b843593506020850135925060408501356001600160401b0380821115612ddf578384fd5b818701915087601f830112612df2578384fd5b813581811115612e00578485fd5b886020828501011115612e11578485fd5b95989497505060200194505050565b600060208284031215612e31578081fd5b815162ffffff81168114612a87578182fd5b600060208284031215612e54578081fd5b5051919050565b600080600060608486031215612e6f578081fd5b83516020850151604086015191945092506001600160801b0381168114612e94578182fd5b809150509250925092565b600080600060608486031215612eb3578081fd5b8351925060208401519150604084015190509250925092565b60008251612ede8184602087016130f0565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6020815260008251806020840152612f4e8160408501602087016130f0565b601f01601f19169190910160400192915050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526016908201527572656365697665642062656c6f77206d696e696d756d60501b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526011908201527062656c6f77206d696e20616d6f756e747360781b604082015260600190565b60208082526023908201527f6d69736d61746368696e6720616d6f756e74206f662045544820666f7277617260408201526219195960ea1b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b9182526001600160a01b0316602082015260400190565b600082198211156130d4576130d461311c565b500190565b6000828210156130eb576130eb61311c565b500390565b60005b8381101561310b5781810151838201526020016130f3565b83811115611dbd5750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610ad857600080fd5b8015158114610ad857600080fdfea264697066735822122034534e49aa2e5fa739159091b96347263606cfeca550d56dc4b7345cd2a74fd364736f6c634300080400330000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000014e6d67f824c3a7b4329d3228807f8654294e4bd

Deployed ByteCode

0x6080604052600436106100c35760003560e01c806333f9ab55146100c85780633f4ba83a146101085780633fc8cef31461011f57806359f842b2146101605780635c975abb146101a45780636587e4ce146101c7578063715018a6146101e75780638129fc1c146101fc5780638456cb59146102115780638da5cb5b14610226578063c45a01551461023b578063dcdf72021461026f578063f2fde38b14610282578063fa461e33146102a2578063fb9f4789146102c2578063fbec41a8146102e2575b600080fd5b3480156100d457600080fd5b506100e86100e3366004612c43565b6102f5565b604080519384526020840192909252908201526060015b60405180910390f35b34801561011457600080fd5b5061011d610482565b005b34801561012b57600080fd5b506101537f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516100ff9190612ee8565b34801561016c57600080fd5b5061018061017b366004612cd1565b6104bb565b6040805193845260208401929092526001600160801b0316908201526060016100ff565b3480156101b057600080fd5b5060335460ff1660405190151581526020016100ff565b3480156101d357600080fd5b506101806101e2366004612cd1565b61066a565b3480156101f357600080fd5b5061011d6109d9565b34801561020857600080fd5b5061011d610a12565b34801561021d57600080fd5b5061011d610adb565b34801561023257600080fd5b50610153610b12565b34801561024757600080fd5b506101537f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b6100e861027d366004612c43565b610b21565b34801561028e57600080fd5b5061011d61029d366004612bef565b610d27565b3480156102ae57600080fd5b5061011d6102bd366004612da6565b610dc4565b3480156102ce57600080fd5b506100e86102dd366004612d26565b611077565b6100e86102f0366004612d26565b6112ad565b600080600061030660335460ff1690565b1561032c5760405162461bcd60e51b815260040161032390612f62565b60405180910390fd5b6104188c8d6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561036957600080fd5b505afa15801561037d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a19190612c0b565b8e6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156103da57600080fd5b505afa1580156103ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104129190612c0b565b87611671565b600080600061042b8f8f8f8f8f8f6118b2565b9250925092508883101580156104415750878210155b61045d5760405162461bcd60e51b815260040161032390612ff1565b61046a8f8484848b611b04565b95509550955050505099509950999650505050505050565b3361048b610b12565b6001600160a01b0316146104b15760405162461bcd60e51b815260040161032390612fbc565b6104b9611cc5565b565b60008060006104cc60335460ff1690565b156104e95760405162461bcd60e51b815260040161032390612f62565b61059788896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561052657600080fd5b505afa15801561053a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055e9190612c0b565b8a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156103da57600080fd5b6105ac6001600160a01b03891633308a611d52565b604051633f34d4cf60e21b81526001600160a01b0389169063fcd3533c906105da908a9088906004016130aa565b606060405180830381600087803b1580156105f457600080fd5b505af1158015610608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062c9190612e5b565b919450925090508583108015906106435750848210155b61065f5760405162461bcd60e51b815260040161032390612f8c565b955095509592505050565b600080600061067b60335460ff1690565b156106985760405162461bcd60e51b815260040161032390612f62565b6000886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156106d357600080fd5b505afa1580156106e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070b9190612c0b565b90506000896001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561074857600080fd5b505afa15801561075c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107809190612c0b565b905061078e8a838389611671565b600061079a8383611dc3565b90506107b16001600160a01b038c1633308d611d52565b604051633f34d4cf60e21b81526001600160a01b038c169063fcd3533c906107df908d9030906004016130aa565b606060405180830381600087803b1580156107f957600080fd5b505af115801561080d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108319190612e5b565b919750955093508886108015906108485750878510155b6108645760405162461bcd60e51b815260040161032390612f8c565b801561091d5785156108fe57604051632e1a7d4d60e01b8152600481018790527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156108d257600080fd5b505af11580156108e6573d6000803e3d6000fd5b506108fe925050506001600160a01b03881687611e95565b8415610918576109186001600160a01b0383168887611fb0565b6109cb565b84156109b157604051632e1a7d4d60e01b8152600481018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561098557600080fd5b505af1158015610999573d6000803e3d6000fd5b506109b1925050506001600160a01b03881686611e95565b85156109cb576109cb6001600160a01b0384168888611fb0565b505050955095509592505050565b336109e2610b12565b6001600160a01b031614610a085760405162461bcd60e51b815260040161032390612fbc565b6104b96000611fcf565b600054610100900460ff16610a2d5760005460ff1615610a31565b303b155b610a945760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610323565b600054610100900460ff16158015610ab6576000805461ffff19166101011790555b610abe612021565b610ac6612058565b8015610ad8576000805461ff00191690555b50565b33610ae4610b12565b6001600160a01b031614610b0a5760405162461bcd60e51b815260040161032390612fbc565b6104b961208f565b6065546001600160a01b031690565b6000806000610b3260335460ff1690565b15610b4f5760405162461bcd60e51b815260040161032390612f62565b610b8c8c8d6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561036957600080fd5b6000806000610b9f8f8f8f8f8f8f6120e7565b925092509250888310158015610bb55750878210155b610bd15760405162461bcd60e51b815260040161032390612ff1565b610bde8f8484848b611b04565b6040516370a0823160e01b815292985090965094506000906001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906370a0823190610c35903090600401612ee8565b60206040518083038186803b158015610c4d57600080fd5b505afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c859190612e43565b90508015610d1457604051632e1a7d4d60e01b8152600481018290527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b50610d149250339150839050611e95565b5050505099509950999650505050505050565b33610d30610b12565b6001600160a01b031614610d565760405162461bcd60e51b815260040161032390612fbc565b6001600160a01b038116610dbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610323565b610ad881611fcf565b60003390506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0457600080fd5b505afa158015610e18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3c9190612c0b565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610e7957600080fd5b505afa158015610e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb19190612c0b565b90506000836001600160a01b031663ddca3f436040518163ffffffff1660e01b815260040160206040518083038186803b158015610eee57600080fd5b505afa158015610f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f269190612e20565b604051630b4c774160e11b81526001600160a01b038581166004830152848116602483015262ffffff831660448301529192507f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98490911690631698ee829060640160206040518083038186803b158015610f9f57600080fd5b505afa158015610fb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd79190612c0b565b6001600160a01b0316336001600160a01b03161461102e5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d5b9a5cddd85c081c1bdbdb60621b6044820152606401610323565b60008813156110505761104b6001600160a01b038416338a611fb0565b61106d565b600087131561106d5761106d6001600160a01b0383163389611fb0565b5050505050505050565b600080600061108860335460ff1690565b156110a55760405162461bcd60e51b815260040161032390612f62565b6000896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156110e057600080fd5b505afa1580156110f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111189190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561115557600080fd5b505afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d9190612c0b565b905061119b8b838389611671565b604051634c4a790d60e11b8152600481018b9052602481018a9052600090819081906001600160a01b038f1690639894f21a9060440160606040518083038186803b1580156111e957600080fd5b505afa1580156111fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112219190612e9f565b9250925092508a83101580156112375750898210155b6112535760405162461bcd60e51b815260040161032390612ff1565b821561126e5761126e6001600160a01b038616333086611d52565b8115611289576112896001600160a01b038516333085611d52565b6112968e8484848d611b04565b975097509750505050505096509650969350505050565b60008060006112be60335460ff1690565b156112db5760405162461bcd60e51b815260040161032390612f62565b6000896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561131657600080fd5b505afa15801561132a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134e9190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561138b57600080fd5b505afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190612c0b565b90506113d18b838389611671565b604051634c4a790d60e11b8152600481018b9052602481018a9052600090819081906001600160a01b038f1690639894f21a9060440160606040518083038186803b15801561141f57600080fd5b505afa158015611433573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114579190612e9f565b9250925092508a831015801561146d5750898210155b6114895760405162461bcd60e51b815260040161032390612ff1565b6114938585611dc3565b1561155257348d146114b75760405162461bcd60e51b81526004016103239061301c565b8215611532577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561151857600080fd5b505af115801561152c573d6000803e3d6000fd5b50505050505b811561154d5761154d6001600160a01b038516333085611d52565b611607565b348c146115715760405162461bcd60e51b81526004016103239061301c565b81156115ec577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156115d257600080fd5b505af11580156115e6573d6000803e3d6000fd5b50505050505b8215611607576116076001600160a01b038616333086611d52565b6116148e8484848d611b04565b919950975095506116258585611dc3565b1561164b57828d11156116465761164661163f848f6130d9565b3390611e95565b611660565b818c11156116605761166061163f838e6130d9565b505050505096509650969350505050565b604051636eb1769f60e11b81526000906001600160a01b0385169063dd62ed3e906116c29085907f00000000000000000000000014e6d67f824c3a7b4329d3228807f8654294e4bd90600401612efc565b60206040518083038186803b1580156116da57600080fd5b505afa1580156116ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117129190612e43565b90506000836001600160a01b031663dd62ed3e847f00000000000000000000000014e6d67f824c3a7b4329d3228807f8654294e4bd6040518363ffffffff1660e01b8152600401611764929190612efc565b60206040518083038186803b15801561177c57600080fd5b505afa158015611790573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b49190612e43565b90506000866001600160a01b031663dd62ed3e857f00000000000000000000000014e6d67f824c3a7b4329d3228807f8654294e4bd6040518363ffffffff1660e01b8152600401611806929190612efc565b60206040518083038186803b15801561181e57600080fd5b505afa158015611832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118569190612e43565b905082158015611864575081155b801561186e575080155b6118a95760405162461bcd60e51b815260206004820152600c60248201526b4e45454453205245564f4b4560a01b6044820152606401610323565b50505050505050565b600080600080896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156118f157600080fd5b505afa158015611905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119299190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561196657600080fd5b505afa15801561197a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199e9190612c0b565b905089156119bb576119bb6001600160a01b03831633308d611d52565b88156119d6576119d66001600160a01b03821633308c611d52565b6119e28b89898961248c565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611a11903090600401612ee8565b60206040518083038186803b158015611a2957600080fd5b505afa158015611a3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a619190612e43565b90506000826001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611a919190612ee8565b60206040518083038186803b158015611aa957600080fd5b505afa158015611abd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae19190612e43565b9050611aee8d83836125a4565b919f909e50909c509a5050505050505050505050565b600080808615611b9457611b9488888a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611b4c57600080fd5b505afa158015611b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b849190612c0b565b6001600160a01b03169190612720565b8515611bd857611bd888878a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015611b4c57600080fd5b6040516394bf804d60e01b81526001600160a01b038916906394bf804d90611c0690889088906004016130aa565b606060405180830381600087803b158015611c2057600080fd5b505af1158015611c34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c589190612e5b565b5090935091508683148015611c6c57508582145b611cb75760405162461bcd60e51b815260206004820152601c60248201527b1d5b995e1c1958dd195908185b5bdd5b9d1cc819195c1bdcda5d195960221b6044820152606401610323565b849050955095509592505050565b60335460ff16611d0e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610323565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051611d489190612ee8565b60405180910390a1565b6040516001600160a01b0380851660248301528316604482015260648101829052611dbd9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127cc565b50505050565b60007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316836001600160a01b03161415611e0757506001611e8f565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b03161415611e4957506000611e8f565b60405162461bcd60e51b815260206004820152601b60248201527a0dedcca40e0deded840e8ded6cadc40daeae6e840c4ca40ae8aa89602b1b6044820152606401610323565b92915050565b80471015611ee55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610323565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f32576040519150601f19603f3d011682016040523d82523d6000602084013e611f37565b606091505b5050905080611fab5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b6064820152608401610323565b505050565b611fab8363a9059cbb60e01b8484604051602401611d86929190612f16565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166120485760405162461bcd60e51b81526004016103239061305f565b61205061289e565b6104b96128c5565b600054610100900460ff1661207f5760405162461bcd60e51b81526004016103239061305f565b61208761289e565b6104b96128f8565b60335460ff16156120b25760405162461bcd60e51b815260040161032390612f62565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d3b3390565b600080600080896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561212657600080fd5b505afa15801561213a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215e9190612c0b565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561219b57600080fd5b505afa1580156121af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121d39190612c0b565b905060006121e18383611dc3565b90508a1561229c57801561228757348b1461220e5760405162461bcd60e51b81526004016103239061301c565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08c6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561226957600080fd5b505af115801561227d573d6000803e3d6000fd5b505050505061229c565b61229c6001600160a01b03841633308e611d52565b89156123565780156122c2576122bd6001600160a01b03831633308d611d52565b612356565b348a146122e15760405162461bcd60e51b81526004016103239061301c565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08b6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561233c57600080fd5b505af1158015612350573d6000803e3d6000fd5b50505050505b6123628c8a8a8a61248c565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612391903090600401612ee8565b60206040518083038186803b1580156123a957600080fd5b505afa1580156123bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e19190612e43565b90506000836001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016124119190612ee8565b60206040518083038186803b15801561242957600080fd5b505afa15801561243d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124619190612e43565b905061246f8e838386612928565b809850819950829a50505050505050505096509650969350505050565b836001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156124c557600080fd5b505afa1580156124d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124fd9190612c0b565b604051630251596160e31b81523060048201528415156024820152604481018490526001600160a01b03838116606483015260a06084830152600060a4830152919091169063128acb089060c4016040805180830381600087803b15801561256457600080fd5b505af1158015612578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259c9190612d83565b505050505050565b604051634c4a790d60e11b81526004810183905260248101829052600090819081906001600160a01b03871690639894f21a9060440160606040518083038186803b1580156125f257600080fd5b505afa158015612606573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262a9190612e9f565b91945092509050828511156126c8576126c83361264785886130d9565b886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b505afa158015612694573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b89190612c0b565b6001600160a01b03169190611fb0565b8184111561271757612717336126de84876130d9565b886001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b93509350939050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b8152600401612751929190612efc565b60206040518083038186803b15801561276957600080fd5b505afa15801561277d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a19190612e43565b6127ab91906130c1565b9050611dbd8463095ea7b360e01b8584604051602401611d86929190612f16565b6000612821826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a759092919063ffffffff16565b805190915015611fab578080602001905181019061283f9190612c27565b611fab5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610323565b600054610100900460ff166104b95760405162461bcd60e51b81526004016103239061305f565b600054610100900460ff166128ec5760405162461bcd60e51b81526004016103239061305f565b6033805460ff19169055565b600054610100900460ff1661291f5760405162461bcd60e51b81526004016103239061305f565b6104b933611fcf565b604051634c4a790d60e11b81526004810184905260248101839052600090819081906001600160a01b03881690639894f21a9060440160606040518083038186803b15801561297657600080fd5b505afa15801561298a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ae9190612e9f565b9194509250905082861180156129c2575083155b15612a1357612a0e336129d585896130d9565b896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b612a6b565b8185118015612a1f5750835b15612a6b57612a6b33612a3284886130d9565b896001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561268057600080fd5b9450945094915050565b6060612a848484600085612a8e565b90505b9392505050565b606082471015612aef5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610323565b843b612b3d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610323565b600080866001600160a01b03168587604051612b599190612ecc565b60006040518083038185875af1925050503d8060008114612b96576040519150601f19603f3d011682016040523d82523d6000602084013e612b9b565b606091505b5091509150612bab828286612bb6565b979650505050505050565b60608315612bc5575081612a87565b825115612bd55782518084602001fd5b8160405162461bcd60e51b81526004016103239190612f2f565b600060208284031215612c00578081fd5b8135612a8781613132565b600060208284031215612c1c578081fd5b8151612a8781613132565b600060208284031215612c38578081fd5b8151612a8781613147565b60008060008060008060008060006101208a8c031215612c61578485fd5b8935612c6c81613132565b985060208a0135975060408a0135965060608a0135612c8a81613147565b955060808a0135945060a08a0135612ca181613132565b935060c08a0135925060e08a013591506101008a0135612cc081613132565b809150509295985092959850929598565b600080600080600060a08688031215612ce8578081fd5b8535612cf381613132565b94506020860135935060408601359250606086013591506080860135612d1881613132565b809150509295509295909350565b60008060008060008060c08789031215612d3e578182fd5b8635612d4981613132565b95506020870135945060408701359350606087013592506080870135915060a0870135612d7581613132565b809150509295509295509295565b60008060408385031215612d95578182fd5b505080516020909101519092909150565b60008060008060608587031215612dbb578182fd5b843593506020850135925060408501356001600160401b0380821115612ddf578384fd5b818701915087601f830112612df2578384fd5b813581811115612e00578485fd5b886020828501011115612e11578485fd5b95989497505060200194505050565b600060208284031215612e31578081fd5b815162ffffff81168114612a87578182fd5b600060208284031215612e54578081fd5b5051919050565b600080600060608486031215612e6f578081fd5b83516020850151604086015191945092506001600160801b0381168114612e94578182fd5b809150509250925092565b600080600060608486031215612eb3578081fd5b8351925060208401519150604084015190509250925092565b60008251612ede8184602087016130f0565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6020815260008251806020840152612f4e8160408501602087016130f0565b601f01601f19169190910160400192915050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526016908201527572656365697665642062656c6f77206d696e696d756d60501b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526011908201527062656c6f77206d696e20616d6f756e747360781b604082015260600190565b60208082526023908201527f6d69736d61746368696e6720616d6f756e74206f662045544820666f7277617260408201526219195960ea1b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b9182526001600160a01b0316602082015260400190565b600082198211156130d4576130d461311c565b500190565b6000828210156130eb576130eb61311c565b500390565b60005b8381101561310b5781810151838201526020016130f3565b83811115611dbd5750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610ad857600080fd5b8015158114610ad857600080fdfea264697066735822122034534e49aa2e5fa739159091b96347263606cfeca550d56dc4b7345cd2a74fd364736f6c63430008040033