ETH Price: $3,603.60 (+8.45%)

Contract

0x8CA6fa325bc32f86a12cC4964Edf1f71655007A7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Remove Liquidity138000812021-12-14 0:19:001079 days ago1639441140IN
0x8CA6fa32...1655007A7
0 ETH0.0259046398.90966516
Remove Liquidity133996312021-10-11 21:21:331142 days ago1633987293IN
0x8CA6fa32...1655007A7
0 ETH0.04449894166.81766013
Remove Liquidity131689192021-09-06 0:14:411178 days ago1630887281IN
0x8CA6fa32...1655007A7
0 ETH0.0239782787.09331932
Remove Liquidity131548252021-09-03 20:06:361180 days ago1630699596IN
0x8CA6fa32...1655007A7
0 ETH0.03429309130
Rebalance And Ad...131461702021-09-02 12:06:271182 days ago1630584387IN
0x8CA6fa32...1655007A7
0 ETH0.0456891697.81891753
Remove Liquidity131256102021-08-30 7:45:171185 days ago1630309517IN
0x8CA6fa32...1655007A7
0 ETH0.0147536752.52640969
Remove Liquidity131211032021-08-29 15:14:061186 days ago1630250046IN
0x8CA6fa32...1655007A7
0 ETH0.0250016189
Remove Liquidity131158262021-08-28 19:31:241187 days ago1630179084IN
0x8CA6fa32...1655007A7
0 ETH0.0180033367.50003368
Rebalance And Ad...131099932021-08-27 21:55:051187 days ago1630101305IN
0x8CA6fa32...1655007A7
0 ETH0.0269247364
Remove Liquidity131049842021-08-27 3:11:331188 days ago1630033893IN
0x8CA6fa32...1655007A7
0 ETH0.0272189791.95071134
Rebalance And Ad...131037852021-08-26 22:42:371188 days ago1630017757IN
0x8CA6fa32...1655007A7
0 ETH0.0354108879.44736106
Remove Liquidity130932202021-08-25 7:32:341190 days ago1629876754IN
0x8CA6fa32...1655007A7
0 ETH0.015630156.5717798
Remove Liquidity130869502021-08-24 8:29:251191 days ago1629793765IN
0x8CA6fa32...1655007A7
0 ETH0.0192229770.91884974
Remove Liquidity130869062021-08-24 8:17:281191 days ago1629793048IN
0x8CA6fa32...1655007A7
0 ETH0.0153803257.40085355
Remove Liquidity130868762021-08-24 8:09:291191 days ago1629792569IN
0x8CA6fa32...1655007A7
0 ETH0.0140073150.99727272
Rebalance And Ad...130816262021-08-23 12:43:551192 days ago1629722635IN
0x8CA6fa32...1655007A7
0 ETH0.0144648233.15582322
Rebalance And Ad...130775362021-08-22 21:21:441192 days ago1629667304IN
0x8CA6fa32...1655007A7
0 ETH0.0128360428
Rebalance And Ad...130712312021-08-21 22:04:351193 days ago1629583475IN
0x8CA6fa32...1655007A7
0 ETH0.0208487145.65988469
Rebalance And Ad...130685002021-08-21 12:05:211194 days ago1629547521IN
0x8CA6fa32...1655007A7
0 ETH0.0122751928.15024428
Rebalance And Ad...130650052021-08-20 22:53:091194 days ago1629499989IN
0x8CA6fa32...1655007A7
0 ETH0.0151073833.48231823
Rebalance And Ad...130624632021-08-20 13:43:401195 days ago1629467020IN
0x8CA6fa32...1655007A7
0 ETH0.0191808942
Rebalance And Ad...130578152021-08-19 20:12:461195 days ago1629403966IN
0x8CA6fa32...1655007A7
0 ETH0.0259604554.88456982
Rebalance And Ad...130496652021-08-18 14:06:141197 days ago1629295574IN
0x8CA6fa32...1655007A7
0 ETH0.0173449337.0636379
Remove Liquidity130448952021-08-17 20:22:491197 days ago1629231769IN
0x8CA6fa32...1655007A7
0 ETH0.0156173356
Rebalance And Ad...130412272021-08-17 6:53:591198 days ago1629183239IN
0x8CA6fa32...1655007A7
0 ETH0.0155872434.65866292
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
126738882021-06-20 22:23:591255 days ago1624227839
0x8CA6fa32...1655007A7
0.00027772 ETH
126738882021-06-20 22:23:591255 days ago1624227839
0x8CA6fa32...1655007A7
0.00027772 ETH
126703712021-06-20 9:12:411256 days ago1624180361
0x8CA6fa32...1655007A7
1.96167524 ETH
126703712021-06-20 9:12:411256 days ago1624180361
0x8CA6fa32...1655007A7
1.96167524 ETH
126703712021-06-20 9:12:411256 days ago1624180361
0x8CA6fa32...1655007A7
1.98 ETH
126703712021-06-20 9:12:411256 days ago1624180361
0x8CA6fa32...1655007A7
1.98 ETH
126703292021-06-20 9:03:591256 days ago1624179839
0x8CA6fa32...1655007A7
3.98479511 ETH
126703292021-06-20 9:03:591256 days ago1624179839
0x8CA6fa32...1655007A7
3.98479511 ETH
126703292021-06-20 9:03:591256 days ago1624179839
0x8CA6fa32...1655007A7
4 ETH
126703292021-06-20 9:03:591256 days ago1624179839
0x8CA6fa32...1655007A7
4 ETH
126677882021-06-19 23:37:471256 days ago1624145867
0x8CA6fa32...1655007A7
0.1738 ETH
126677882021-06-19 23:37:471256 days ago1624145867
0x8CA6fa32...1655007A7
0.1738 ETH
126659512021-06-19 16:44:351257 days ago1624121075
0x8CA6fa32...1655007A7
0.00000126 ETH
126659512021-06-19 16:44:351257 days ago1624121075
0x8CA6fa32...1655007A7
0.00000126 ETH
126653512021-06-19 14:32:001257 days ago1624113120
0x8CA6fa32...1655007A7
0.00001307 ETH
126653512021-06-19 14:32:001257 days ago1624113120
0x8CA6fa32...1655007A7
0.00001307 ETH
126652092021-06-19 13:58:461257 days ago1624111126
0x8CA6fa32...1655007A7
0.37484894 ETH
126652092021-06-19 13:58:461257 days ago1624111126
0x8CA6fa32...1655007A7
0.37484894 ETH
126652092021-06-19 13:58:461257 days ago1624111126
0x8CA6fa32...1655007A7
3 ETH
126652092021-06-19 13:58:461257 days ago1624111126
0x8CA6fa32...1655007A7
3 ETH
126652082021-06-19 13:58:291257 days ago1624111109
0x8CA6fa32...1655007A7
0.00054327 ETH
126652082021-06-19 13:58:291257 days ago1624111109
0x8CA6fa32...1655007A7
0.00054327 ETH
126652082021-06-19 13:58:291257 days ago1624111109
0x8CA6fa32...1655007A7
0.01337 ETH
126652082021-06-19 13:58:291257 days ago1624111109
0x8CA6fa32...1655007A7
0.01337 ETH
126652062021-06-19 13:58:151257 days ago1624111095
0x8CA6fa32...1655007A7
0.00161187 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GUniRouter

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 10 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 21 : 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 {
    FullMath,
    LiquidityAmounts
} from "./vendor/uniswap/LiquidityAmounts.sol";
import {TickMath} from "./vendor/uniswap/TickMath.sol";

contract GUniRouter is IGUniRouter, IUniswapV3SwapCallback {
    using Address for address payable;
    using SafeERC20 for IERC20;
    using TickMath for int24;
    IWETH public immutable weth;
    IUniswapV3Factory public immutable factory;

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

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

    function addLiquidity(
        IGUniPool pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        override
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        (uint256 amount0In, uint256 amount1In, uint256 _mintAmount) =
            pool.getMintAmounts(amount0Max, amount1Max);
        require(
            amount0In >= amount0Min && amount1In >= amount1Min,
            "below min amounts"
        );
        if (amount0In > 0) {
            pool.token0().safeTransferFrom(
                msg.sender,
                address(this),
                amount0In
            );
        }
        if (amount1In > 0) {
            pool.token1().safeTransferFrom(
                msg.sender,
                address(this),
                amount1In
            );
        }

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

    // 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
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        (uint256 amount0In, uint256 amount1In, uint256 _mintAmount) =
            pool.getMintAmounts(amount0Max, amount1Max);
        require(
            amount0In >= amount0Min && amount1In >= amount1Min,
            "below min amounts"
        );

        if (isToken0Weth(address(pool.token0()), address(pool.token1()))) {
            require(
                amount0Max == msg.value,
                "mismatching amount of ETH forwarded"
            );
            if (amount0In > 0) {
                weth.deposit{value: amount0In}();
            }
            if (amount1In > 0) {
                pool.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) {
                pool.token0().safeTransferFrom(
                    msg.sender,
                    address(this),
                    amount0In
                );
            }
        }

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

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

    // 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
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        (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);
    }

    // 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
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 mintAmount
        )
    {
        (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);
        }
    }

    function removeLiquidity(
        IGUniPool pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    )
        external
        override
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        )
    {
        IERC20(address(pool)).safeTransferFrom(
            msg.sender,
            address(this),
            burnAmount
        );
        (amount0, amount1, liquidityBurned) = pool.burn(burnAmount, receiver);
        require(
            amount0 >= amount0Min && amount1 >= amount1Min,
            "received below minimum"
        );
    }

    // solhint-disable-next-line code-complexity, function-max-lines
    function removeLiquidityETH(
        IGUniPool pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address payable receiver
    )
        external
        override
        returns (
            uint256 amount0,
            uint256 amount1,
            uint128 liquidityBurned
        )
    {
        bool wethToken0 =
            isToken0Weth(address(pool.token0()), address(pool.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) {
                pool.token1().safeTransfer(receiver, amount1);
            }
        } else {
            if (amount1 > 0) {
                weth.withdraw(amount1);
                receiver.sendValue(amount1);
            }
            if (amount0 > 0) {
                pool.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;
    }

    function _prepareRebalanceDeposit(
        IGUniPool pool,
        uint256 amount0In,
        uint256 amount1In,
        bool zeroForOne,
        uint256 swapAmount,
        uint160 swapThreshold
    )
        internal
        returns (
            uint256 amount0Use,
            uint256 amount1Use,
            uint256 mintAmount
        )
    {
        if (amount0In > 0) {
            pool.token0().safeTransferFrom(
                msg.sender,
                address(this),
                amount0In
            );
        }
        if (amount1In > 0) {
            pool.token1().safeTransferFrom(
                msg.sender,
                address(this),
                amount1In
            );
        }

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

        uint256 amount0Max = pool.token0().balanceOf(address(this));
        uint256 amount1Max = pool.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
        )
    {
        bool wethToken0 =
            isToken0Weth(address(pool.token0()), address(pool.token1()));

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

        if (amount1In > 0) {
            if (wethToken0) {
                pool.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 = pool.token0().balanceOf(address(this));
        uint256 amount1Max = pool.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 isToken0Weth(address token0, address token1)
        public
        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");
        }
    }

    function getPoolUnderlyingBalances(IGUniPool pool)
        public
        view
        override
        returns (uint256 amount0, uint256 amount1)
    {
        IUniswapV3Pool uniPool = pool.pool();
        (uint128 liquidity, , , , ) = uniPool.positions(pool.getPositionID());
        (uint160 sqrtPriceX96, , , , , , ) = uniPool.slot0();
        uint160 lowerSqrtPrice = pool.lowerTick().getSqrtRatioAtTick();
        uint160 upperSqrtPrice = pool.upperTick().getSqrtRatioAtTick();
        return
            LiquidityAmounts.getAmountsForLiquidity(
                sqrtPriceX96,
                lowerSqrtPrice,
                upperSqrtPrice,
                liquidity
            );
    }

    function getUnderlyingBalances(
        IGUniPool pool,
        address account,
        uint256 balance
    ) external view override returns (uint256 amount0, uint256 amount1) {
        (uint256 gross0, uint256 gross1) = getPoolUnderlyingBalances(pool);
        balance = balance == 0 ? pool.balanceOf(account) : balance;
        uint256 supply = pool.totalSupply();
        amount0 = FullMath.mulDiv(gross0, balance, supply);
        amount1 = FullMath.mulDiv(gross1, balance, supply);
    }

    // solhint-disable-next-line no-empty-blocks
    receive() external payable {}
}

File 2 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 3 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

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'
        // solhint-disable-next-line max-line-length
        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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 4 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

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

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

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

}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 15 of 21 : 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 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);

    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 getPositionID() external view returns (bytes32 positionID);
}

File 16 of 21 : 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
        );

    function getPoolUnderlyingBalances(IGUniPool pool)
        external
        view
        returns (uint256 amount0, uint256 amount1);

    function getUnderlyingBalances(
        IGUniPool pool,
        address account,
        uint256 balance
    ) external view returns (uint256 amount0, uint256 amount1);
}

File 17 of 21 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        uint256 r = ratio;
        uint256 msb = 0;

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

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

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

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

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

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

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

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 10
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IUniswapV3Factory","name":"_factory","type":"address"},{"internalType":"contract IWETH","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"uint256","name":"amount0Max","type":"uint256"},{"internalType":"uint256","name":"amount1Max","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"uint256","name":"amount0Max","type":"uint256"},{"internalType":"uint256","name":"amount1Max","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"addLiquidityETH","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IUniswapV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"}],"name":"getPoolUnderlyingBalances","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"getUnderlyingBalances","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"isToken0Weth","outputs":[{"internalType":"bool","name":"wethToken0","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"uint256","name":"amount0In","type":"uint256"},{"internalType":"uint256","name":"amount1In","type":"uint256"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint160","name":"swapThreshold","type":"uint160"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"rebalanceAndAddLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"uint256","name":"amount0In","type":"uint256"},{"internalType":"uint256","name":"amount1In","type":"uint256"},{"internalType":"bool","name":"zeroForOne","type":"bool"},{"internalType":"uint256","name":"swapAmount","type":"uint256"},{"internalType":"uint160","name":"swapThreshold","type":"uint160"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"rebalanceAndAddLiquidityETH","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"uint256","name":"burnAmount","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint128","name":"liquidityBurned","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGUniPool","name":"pool","type":"address"},{"internalType":"uint256","name":"burnAmount","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"removeLiquidityETH","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint128","name":"liquidityBurned","type":"uint128"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c06040523480156200001157600080fd5b506040516200358c3803806200358c833981016040819052620000349162000054565b6001600160601b0319606091821b811660805291901b1660a052620000ab565b6000806040838503121562000067578182fd5b8251620000748162000092565b6020840151909250620000878162000092565b809150509250929050565b6001600160a01b0381168114620000a857600080fd5b50565b60805160601c60a05160601c61346862000124600039600081816101fc0152610fb8015260008181610129015281816102aa015281816102ec01528181610699015281816107be01528181610bc101528181610c6401528181611414015281816114f8015281816121e5015261230c01526134686000f3fe60806040526004361061009b5760003560e01c8063207e88f7146100a757806333f9ab55146100dc5780633fc8cef31461011757806359f842b2146101585780636587e4ce1461019c578063c0c108e8146101bc578063c45a0155146101ea578063dcdf72021461021e578063efb31b1214610231578063fa461e3314610251578063fb9f478914610273578063fbec41a81461029357600080fd5b366100a257005b600080fd5b3480156100b357600080fd5b506100c76100c2366004612d70565b6102a6565b60405190151581526020015b60405180910390f35b3480156100e857600080fd5b506100fc6100f7366004612e38565b61037d565b604080519384526020840192909252908201526060016100d3565b34801561012357600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516100d391906131b8565b34801561016457600080fd5b50610178610173366004612ec6565b6103eb565b6040805193845260208401929092526001600160801b0316908201526060016100d3565b3480156101a857600080fd5b506101786101b7366004612ec6565b6104c2565b3480156101c857600080fd5b506101dc6101d7366004612ddc565b610886565b6040516100d39291906132cd565b3480156101f657600080fd5b5061014b7f000000000000000000000000000000000000000000000000000000000000000081565b6100fc61022c366004612e38565b610b49565b34801561023d57600080fd5b506101dc61024c366004612df8565b610ce8565b34801561025d57600080fd5b5061027161026c366004612fb5565b610e21565b005b34801561027f57600080fd5b506100fc61028e366004612f1b565b6110d4565b6100fc6102a1366004612f1b565b611282565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614156102ea57506001610377565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316141561032c57506000610377565b60405162461bcd60e51b815260206004820152601b60248201527a0dedcca40e0deded840e8ded6cadc40daeae6e840c4ca40ae8aa89602b1b60448201526064015b60405180910390fd5b92915050565b6000806000806000806103948f8f8f8f8f8f61164f565b9250925092508883101580156103aa5750878210155b6103c65760405162461bcd60e51b815260040161036e90613248565b6103d38f8484848b6118e8565b95509550955050505099509950999650505050505050565b600080806104046001600160a01b03891633308a611aa9565b604051633f34d4cf60e21b81526001600160a01b0389169063fcd3533c90610432908a9088906004016132b6565b606060405180830381600087803b15801561044c57600080fd5b505af1158015610460573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610484919061313b565b9194509250905085831080159061049b5750848210155b6104b75760405162461bcd60e51b815260040161036e90613218565b955095509592505050565b6000806000806105ad896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561050457600080fd5b505afa158015610518573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053c9190612d54565b8a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561057557600080fd5b505afa158015610589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c29190612d54565b90506105c46001600160a01b038a1633308b611aa9565b604051633f34d4cf60e21b81526001600160a01b038a169063fcd3533c906105f2908b9030906004016132b6565b606060405180830381600087803b15801561060c57600080fd5b505af1158015610620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610644919061313b565b9195509350915086841080159061065b5750858310155b6106775760405162461bcd60e51b815260040161036e90613218565b80156107a257831561071157604051632e1a7d4d60e01b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156106e557600080fd5b505af11580156106f9573d6000803e3d6000fd5b50610711925050506001600160a01b03861685611b1a565b821561079d5761079d85848b6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b505afa158015610769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078d9190612d54565b6001600160a01b03169190611c35565b61087a565b821561083657604051632e1a7d4d60e01b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b50610836925050506001600160a01b03861684611b1a565b831561087a5761087a85858b6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b50955095509592505050565b6000806000836001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fc9190612d54565b90506000816001600160a01b031663514ea4bf866001600160a01b031663df28408a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561094857600080fd5b505afa15801561095c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109809190612dc4565b6040518263ffffffff1660e01b815260040161099e91815260200190565b60a06040518083038186803b1580156109b657600080fd5b505afa1580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee919061302f565b5050505090506000826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a679190613085565b50505050505090506000610aed876001600160a01b0316639b1344ac6040518163ffffffff1660e01b815260040160206040518083038186803b158015610aad57600080fd5b505afa158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae59190612f78565b60020b611c54565b90506000610b2d886001600160a01b031663727dd2286040518163ffffffff1660e01b815260040160206040518083038186803b158015610aad57600080fd5b9050610b3b83838387612066565b965096505050505050915091565b600080600080600080610b608f8f8f8f8f8f612103565b925092509250888310158015610b765750878210155b610b925760405162461bcd60e51b815260040161036e90613248565b610b9f8f8484848b6118e8565b6040516370a0823160e01b815292985090965094506000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610bf69030906004016131b8565b60206040518083038186803b158015610c0e57600080fd5b505afa158015610c22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c469190612dc4565b90508015610cd557604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610cb057600080fd5b505af1158015610cc4573d6000803e3d6000fd5b50610cd59250339150839050611b1a565b5050505099509950999650505050505050565b600080600080610cf787610886565b9150915084600014610d095784610d85565b6040516370a0823160e01b81526001600160a01b038816906370a0823190610d359089906004016131b8565b60206040518083038186803b158015610d4d57600080fd5b505afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d859190612dc4565b94506000876001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc257600080fd5b505afa158015610dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa9190612dc4565b9050610e0783878361258c565b9450610e1482878361258c565b9350505050935093915050565b60003390506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6157600080fd5b505afa158015610e75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e999190612d54565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed657600080fd5b505afa158015610eea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0e9190612d54565b90506000836001600160a01b031663ddca3f436040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4b57600080fd5b505afa158015610f5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f839190613118565b604051630b4c774160e11b81526001600160a01b038581166004830152848116602483015262ffffff831660448301529192507f000000000000000000000000000000000000000000000000000000000000000090911690631698ee829060640160206040518083038186803b158015610ffc57600080fd5b505afa158015611010573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110349190612d54565b6001600160a01b0316336001600160a01b03161461108b5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d5b9a5cddd85c081c1bdbdb60621b604482015260640161036e565b60008813156110ad576110a86001600160a01b038416338a611c35565b6110ca565b60008713156110ca576110ca6001600160a01b0383163389611c35565b5050505050505050565b6000806000806000808b6001600160a01b0316639894f21a8c8c6040518363ffffffff1660e01b815260040161110b9291906132cd565b60606040518083038186803b15801561112357600080fd5b505afa158015611137573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115b919061316f565b9250925092508883101580156111715750878210155b61118d5760405162461bcd60e51b815260040161036e90613248565b821561121b5761121b3330858f6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b505afa1580156111e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120a9190612d54565b6001600160a01b0316929190611aa9565b8115611260576112603330848f6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b61126d8c8484848b6118e8565b95509550955050505096509650969350505050565b6000806000806000808b6001600160a01b0316639894f21a8c8c6040518363ffffffff1660e01b81526004016112b99291906132cd565b60606040518083038186803b1580156112d157600080fd5b505afa1580156112e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611309919061316f565b92509250925088831015801561131f5750878210155b61133b5760405162461bcd60e51b815260040161036e90613248565b6113e88c6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561137757600080fd5b505afa15801561138b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113af9190612d54565b8d6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561057557600080fd5b156114d157348b1461140c5760405162461bcd60e51b815260040161036e90613273565b8215611487577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561146d57600080fd5b505af1158015611481573d6000803e3d6000fd5b50505050505b81156114cc576114cc3330848f6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b6115b0565b348a146114f05760405162461bcd60e51b815260040161036e90613273565b811561156b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561155157600080fd5b505af1158015611565573d6000803e3d6000fd5b50505050505b82156115b0576115b03330858f6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b6115bd8c8484848b6118e8565b8096508197508298505050506116058c6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561137757600080fd5b1561162b57828b11156116265761162661161f848d61334e565b3390611b1a565b611640565b818a11156116405761164061161f838c61334e565b50505096509650969350505050565b6000808087156116985761169833308a8c6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b86156116dd576116dd3330898c6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b6116e989878787612641565b6000896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561172457600080fd5b505afa158015611738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175c9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161178791906131b8565b60206040518083038186803b15801561179f57600080fd5b505afa1580156117b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d79190612dc4565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561181457600080fd5b505afa158015611828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184c9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161187791906131b8565b60206040518083038186803b15801561188f57600080fd5b505afa1580156118a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c79190612dc4565b90506118d48b8383612759565b919d909c50909a5098505050505050505050565b6000808086156119785761197888888a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561193057600080fd5b505afa158015611944573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119689190612d54565b6001600160a01b0316919061288a565b85156119bc576119bc88878a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561193057600080fd5b6040516394bf804d60e01b81526001600160a01b038916906394bf804d906119ea90889088906004016132b6565b606060405180830381600087803b158015611a0457600080fd5b505af1158015611a18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3c919061313b565b5090935091508683148015611a5057508582145b611a9b5760405162461bcd60e51b815260206004820152601c60248201527b1d5b995e1c1958dd195908185b5bdd5b9d1cc819195c1bdcda5d195960221b604482015260640161036e565b849050955095509592505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611b149085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612939565b50505050565b80471015611b6a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161036e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611bb7576040519150601f19603f3d011682016040523d82523d6000602084013e611bbc565b606091505b5050905080611c305760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b606482015260840161036e565b505050565b611c308363a9059cbb60e01b8484604051602401611add9291906131cc565b60008060008360020b12611c6b578260020b611c78565b8260020b611c78906133c6565b9050611c87620d89e7196133a5565b60020b811115611cbd5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640161036e565b600060018216611cd157600160801b611ce3565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615611d18576080611d13826ffff97272373d413259a46990580e213a613307565b901c90505b6004821615611d42576080611d3d826ffff2e50f5f656932ef12357cf3c7fdcc613307565b901c90505b6008821615611d6c576080611d67826fffe5caca7e10e4e61c3624eaa0941cd0613307565b901c90505b6010821615611d96576080611d91826fffcb9843d60f6159c9db58835c926644613307565b901c90505b6020821615611dc0576080611dbb826fff973b41fa98c081472e6896dfb254c0613307565b901c90505b6040821615611dea576080611de5826fff2ea16466c96a3843ec78b326b52861613307565b901c90505b6080821615611e14576080611e0f826ffe5dee046a99a2a811c461f1969c3053613307565b901c90505b610100821615611e3f576080611e3a826ffcbe86c7900a88aedcffc83b479aa3a4613307565b901c90505b610200821615611e6a576080611e65826ff987a7253ac413176f2b074cf7815e54613307565b901c90505b610400821615611e95576080611e90826ff3392b0822b70005940c7a398e4b70f3613307565b901c90505b610800821615611ec0576080611ebb826fe7159475a2c29b7443b29c7fa6e889d9613307565b901c90505b611000821615611eeb576080611ee6826fd097f3bdfd2022b8845ad8f792aa5825613307565b901c90505b612000821615611f16576080611f11826fa9f746462d870fdf8a65dc1f90e061e5613307565b901c90505b614000821615611f41576080611f3c826f70d869a156d2a1b890bb3df62baf32f7613307565b901c90505b618000821615611f6c576080611f67826f31be135f97d08fd981231505542fcfa6613307565b901c90505b62010000821615611f98576080611f93826f09aa508b5b7a84e1c677de54f3e99bc9613307565b901c90505b62020000821615611fc3576080611fbe826e5d6af8dedb81196699c329225ee604613307565b901c90505b62040000821615611fed576080611fe8826d2216e584f5fa1ea926041bedfe98613307565b901c90505b62080000821615612015576080612010826b048a170391f7dc42444e8fa2613307565b901c90505b60008460020b13156120305761202d816000196132f3565b90505b61203e600160201b82613391565b1561204a57600161204d565b60005b61205e9060ff16602083901c6132db565b949350505050565b600080836001600160a01b0316856001600160a01b03161115612087579293925b846001600160a01b0316866001600160a01b031610156120b3576120ac858585612a0b565b91506120fa565b836001600160a01b0316866001600160a01b031610156120ec576120d8868585612a0b565b91506120e5858785612a75565b90506120fa565b6120f7858585612a75565b90505b94509492505050565b6000806000806121b68a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561214557600080fd5b505afa158015612159573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217d9190612d54565b8b6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561057557600080fd5b9050881561229b57801561225c573489146121e35760405162461bcd60e51b815260040161036e90613273565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08a6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561223e57600080fd5b505af1158015612252573d6000803e3d6000fd5b505050505061229b565b61229b33308b8d6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b871561237f5780156122eb576122e633308a8d6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b61237f565b34881461230a5760405162461bcd60e51b815260040161036e90613273565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0896040518263ffffffff1660e01b81526004016000604051808303818588803b15801561236557600080fd5b505af1158015612379573d6000803e3d6000fd5b50505050505b61238b8a888888612641565b60008a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156123c657600080fd5b505afa1580156123da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fe9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161242991906131b8565b60206040518083038186803b15801561244157600080fd5b505afa158015612455573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124799190612dc4565b905060008b6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156124b657600080fd5b505afa1580156124ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ee9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161251991906131b8565b60206040518083038186803b15801561253157600080fd5b505afa158015612545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125699190612dc4565b90506125778c838386612abf565b919e909d50909b509950505050505050505050565b6000808060001985870985870292508281108382030391505080600014156125c657600084116125bb57600080fd5b50829004905061263a565b8084116125d257600080fd5b600084868809851960019081018716968790049682860381900495909211909303600082900391909104909201919091029190911760038402600290811880860282030280860282030280860282030280860282030280860282030280860290910302029150505b9392505050565b836001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561267a57600080fd5b505afa15801561268e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b29190612d54565b604051630251596160e31b81523060048201528415156024820152604481018490526001600160a01b03838116606483015260a06084830152600060a4830152919091169063128acb089060c4016040805180830381600087803b15801561271957600080fd5b505af115801561272d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127519190612f92565b505050505050565b6000806000856001600160a01b0316639894f21a86866040518363ffffffff1660e01b815260040161278c9291906132cd565b60606040518083038186803b1580156127a457600080fd5b505afa1580156127b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127dc919061316f565b919450925090508285111561283257612832336127f9858861334e565b886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b818411156128815761288133612848848761334e565b886001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b93509350939050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b1580156128d657600080fd5b505afa1580156128ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290e9190612dc4565b61291891906132db565b9050611b148463095ea7b360e01b8584604051602401611add9291906131cc565b600061298e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c099092919063ffffffff16565b805190915015611c3057808060200190518101906129ac9190612da8565b611c305760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161036e565b6000826001600160a01b0316846001600160a01b03161115612a2b579192915b6001600160a01b038416612a6b600160601b600160e01b03606085901b16612a538787613326565b6001600160a01b0316866001600160a01b031661258c565b61205e91906132f3565b6000826001600160a01b0316846001600160a01b03161115612a95579192915b61205e6001600160801b038316612aac8686613326565b6001600160a01b0316600160601b61258c565b6000806000866001600160a01b0316639894f21a87876040518363ffffffff1660e01b8152600401612af29291906132cd565b60606040518083038186803b158015612b0a57600080fd5b505afa158015612b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b42919061316f565b919450925090508286118015612b56575083155b15612ba757612ba233612b69858961334e565b896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b612bff565b8185118015612bb35750835b15612bff57612bff33612bc6848861334e565b896001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b9450945094915050565b606061205e848460008585843b612c625760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161036e565b600080866001600160a01b03168587604051612c7e919061319c565b60006040518083038185875af1925050503d8060008114612cbb576040519150601f19603f3d011682016040523d82523d6000602084013e612cc0565b606091505b5091509150612cd0828286612cdb565b979650505050505050565b60608315612cea57508161263a565b825115612cfa5782518084602001fd5b8160405162461bcd60e51b815260040161036e91906131e5565b8051600281900b8114612d2657600080fd5b919050565b80516001600160801b0381168114612d2657600080fd5b805161ffff81168114612d2657600080fd5b600060208284031215612d65578081fd5b815161263a8161340c565b60008060408385031215612d82578081fd5b8235612d8d8161340c565b91506020830135612d9d8161340c565b809150509250929050565b600060208284031215612db9578081fd5b815161263a81613424565b600060208284031215612dd5578081fd5b5051919050565b600060208284031215612ded578081fd5b813561263a8161340c565b600080600060608486031215612e0c578081fd5b8335612e178161340c565b92506020840135612e278161340c565b929592945050506040919091013590565b60008060008060008060008060006101208a8c031215612e56578485fd5b8935612e618161340c565b985060208a0135975060408a0135965060608a0135612e7f81613424565b955060808a0135945060a08a0135612e968161340c565b935060c08a0135925060e08a013591506101008a0135612eb58161340c565b809150509295985092959850929598565b600080600080600060a08688031215612edd578283fd5b8535612ee88161340c565b94506020860135935060408601359250606086013591506080860135612f0d8161340c565b809150509295509295909350565b60008060008060008060c08789031215612f33578384fd5b8635612f3e8161340c565b95506020870135945060408701359350606087013592506080870135915060a0870135612f6a8161340c565b809150509295509295509295565b600060208284031215612f89578081fd5b61263a82612d14565b60008060408385031215612fa4578182fd5b505080516020909101519092909150565b60008060008060608587031215612fca578182fd5b843593506020850135925060408501356001600160401b0380821115612fee578384fd5b818701915087601f830112613001578384fd5b81358181111561300f578485fd5b886020828501011115613020578485fd5b95989497505060200194505050565b600080600080600060a08688031215613046578283fd5b61304f86612d2b565b9450602086015193506040860151925061306b60608701612d2b565b915061307960808701612d2b565b90509295509295909350565b600080600080600080600060e0888a03121561309f578081fd5b87516130aa8161340c565b96506130b860208901612d14565b95506130c660408901612d42565b94506130d460608901612d42565b93506130e260808901612d42565b925060a088015160ff811681146130f7578182fd5b60c089015190925061310881613424565b8091505092959891949750929550565b600060208284031215613129578081fd5b815162ffffff8116811461263a578182fd5b60008060006060848603121561314f578081fd5b835192506020840151915061316660408501612d2b565b90509250925092565b600080600060608486031215613183578081fd5b8351925060208401519150604084015190509250925092565b600082516131ae818460208701613365565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020815260008251806020840152613204816040850160208701613365565b601f01601f19169190910160400192915050565b60208082526016908201527572656365697665642062656c6f77206d696e696d756d60501b604082015260600190565b60208082526011908201527062656c6f77206d696e20616d6f756e747360781b604082015260600190565b60208082526023908201527f6d69736d61746368696e6720616d6f756e74206f662045544820666f7277617260408201526219195960ea1b606082015260800190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b600082198211156132ee576132ee6133e0565b500190565b600082613302576133026133f6565b500490565b6000816000190483118215151615613321576133216133e0565b500290565b60006001600160a01b0383811690831681811015613346576133466133e0565b039392505050565b600082821015613360576133606133e0565b500390565b60005b83811015613380578181015183820152602001613368565b83811115611b145750506000910152565b6000826133a0576133a06133f6565b500690565b60008160020b627fffff198114156133bf576133bf6133e0565b9003919050565b6000600160ff1b8214156133dc576133dc6133e0565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461342157600080fd5b50565b801515811461342157600080fdfea264697066735822122089742a1a54400a9f6eadc02ceea482a6895b85ffd739c8890062df553c92d72764736f6c634300080400330000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Deployed Bytecode

0x60806040526004361061009b5760003560e01c8063207e88f7146100a757806333f9ab55146100dc5780633fc8cef31461011757806359f842b2146101585780636587e4ce1461019c578063c0c108e8146101bc578063c45a0155146101ea578063dcdf72021461021e578063efb31b1214610231578063fa461e3314610251578063fb9f478914610273578063fbec41a81461029357600080fd5b366100a257005b600080fd5b3480156100b357600080fd5b506100c76100c2366004612d70565b6102a6565b60405190151581526020015b60405180910390f35b3480156100e857600080fd5b506100fc6100f7366004612e38565b61037d565b604080519384526020840192909252908201526060016100d3565b34801561012357600080fd5b5061014b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516100d391906131b8565b34801561016457600080fd5b50610178610173366004612ec6565b6103eb565b6040805193845260208401929092526001600160801b0316908201526060016100d3565b3480156101a857600080fd5b506101786101b7366004612ec6565b6104c2565b3480156101c857600080fd5b506101dc6101d7366004612ddc565b610886565b6040516100d39291906132cd565b3480156101f657600080fd5b5061014b7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b6100fc61022c366004612e38565b610b49565b34801561023d57600080fd5b506101dc61024c366004612df8565b610ce8565b34801561025d57600080fd5b5061027161026c366004612fb5565b610e21565b005b34801561027f57600080fd5b506100fc61028e366004612f1b565b6110d4565b6100fc6102a1366004612f1b565b611282565b60007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316836001600160a01b031614156102ea57506001610377565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b0316141561032c57506000610377565b60405162461bcd60e51b815260206004820152601b60248201527a0dedcca40e0deded840e8ded6cadc40daeae6e840c4ca40ae8aa89602b1b60448201526064015b60405180910390fd5b92915050565b6000806000806000806103948f8f8f8f8f8f61164f565b9250925092508883101580156103aa5750878210155b6103c65760405162461bcd60e51b815260040161036e90613248565b6103d38f8484848b6118e8565b95509550955050505099509950999650505050505050565b600080806104046001600160a01b03891633308a611aa9565b604051633f34d4cf60e21b81526001600160a01b0389169063fcd3533c90610432908a9088906004016132b6565b606060405180830381600087803b15801561044c57600080fd5b505af1158015610460573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610484919061313b565b9194509250905085831080159061049b5750848210155b6104b75760405162461bcd60e51b815260040161036e90613218565b955095509592505050565b6000806000806105ad896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561050457600080fd5b505afa158015610518573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053c9190612d54565b8a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561057557600080fd5b505afa158015610589573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100c29190612d54565b90506105c46001600160a01b038a1633308b611aa9565b604051633f34d4cf60e21b81526001600160a01b038a169063fcd3533c906105f2908b9030906004016132b6565b606060405180830381600087803b15801561060c57600080fd5b505af1158015610620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610644919061313b565b9195509350915086841080159061065b5750858310155b6106775760405162461bcd60e51b815260040161036e90613218565b80156107a257831561071157604051632e1a7d4d60e01b8152600481018590527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b1580156106e557600080fd5b505af11580156106f9573d6000803e3d6000fd5b50610711925050506001600160a01b03861685611b1a565b821561079d5761079d85848b6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b505afa158015610769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078d9190612d54565b6001600160a01b03169190611c35565b61087a565b821561083657604051632e1a7d4d60e01b8152600481018490527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561080a57600080fd5b505af115801561081e573d6000803e3d6000fd5b50610836925050506001600160a01b03861684611b1a565b831561087a5761087a85858b6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b50955095509592505050565b6000806000836001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108c457600080fd5b505afa1580156108d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fc9190612d54565b90506000816001600160a01b031663514ea4bf866001600160a01b031663df28408a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561094857600080fd5b505afa15801561095c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109809190612dc4565b6040518263ffffffff1660e01b815260040161099e91815260200190565b60a06040518083038186803b1580156109b657600080fd5b505afa1580156109ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ee919061302f565b5050505090506000826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a679190613085565b50505050505090506000610aed876001600160a01b0316639b1344ac6040518163ffffffff1660e01b815260040160206040518083038186803b158015610aad57600080fd5b505afa158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae59190612f78565b60020b611c54565b90506000610b2d886001600160a01b031663727dd2286040518163ffffffff1660e01b815260040160206040518083038186803b158015610aad57600080fd5b9050610b3b83838387612066565b965096505050505050915091565b600080600080600080610b608f8f8f8f8f8f612103565b925092509250888310158015610b765750878210155b610b925760405162461bcd60e51b815260040161036e90613248565b610b9f8f8484848b6118e8565b6040516370a0823160e01b815292985090965094506000906001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906370a0823190610bf69030906004016131b8565b60206040518083038186803b158015610c0e57600080fd5b505afa158015610c22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c469190612dc4565b90508015610cd557604051632e1a7d4d60e01b8152600481018290527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610cb057600080fd5b505af1158015610cc4573d6000803e3d6000fd5b50610cd59250339150839050611b1a565b5050505099509950999650505050505050565b600080600080610cf787610886565b9150915084600014610d095784610d85565b6040516370a0823160e01b81526001600160a01b038816906370a0823190610d359089906004016131b8565b60206040518083038186803b158015610d4d57600080fd5b505afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d859190612dc4565b94506000876001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc257600080fd5b505afa158015610dd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfa9190612dc4565b9050610e0783878361258c565b9450610e1482878361258c565b9350505050935093915050565b60003390506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6157600080fd5b505afa158015610e75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e999190612d54565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610ed657600080fd5b505afa158015610eea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0e9190612d54565b90506000836001600160a01b031663ddca3f436040518163ffffffff1660e01b815260040160206040518083038186803b158015610f4b57600080fd5b505afa158015610f5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f839190613118565b604051630b4c774160e11b81526001600160a01b038581166004830152848116602483015262ffffff831660448301529192507f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98490911690631698ee829060640160206040518083038186803b158015610ffc57600080fd5b505afa158015611010573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110349190612d54565b6001600160a01b0316336001600160a01b03161461108b5760405162461bcd60e51b81526020600482015260146024820152731a5b9d985b1a59081d5b9a5cddd85c081c1bdbdb60621b604482015260640161036e565b60008813156110ad576110a86001600160a01b038416338a611c35565b6110ca565b60008713156110ca576110ca6001600160a01b0383163389611c35565b5050505050505050565b6000806000806000808b6001600160a01b0316639894f21a8c8c6040518363ffffffff1660e01b815260040161110b9291906132cd565b60606040518083038186803b15801561112357600080fd5b505afa158015611137573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115b919061316f565b9250925092508883101580156111715750878210155b61118d5760405162461bcd60e51b815260040161036e90613248565b821561121b5761121b3330858f6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b505afa1580156111e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120a9190612d54565b6001600160a01b0316929190611aa9565b8115611260576112603330848f6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b61126d8c8484848b6118e8565b95509550955050505096509650969350505050565b6000806000806000808b6001600160a01b0316639894f21a8c8c6040518363ffffffff1660e01b81526004016112b99291906132cd565b60606040518083038186803b1580156112d157600080fd5b505afa1580156112e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611309919061316f565b92509250925088831015801561131f5750878210155b61133b5760405162461bcd60e51b815260040161036e90613248565b6113e88c6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561137757600080fd5b505afa15801561138b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113af9190612d54565b8d6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561057557600080fd5b156114d157348b1461140c5760405162461bcd60e51b815260040161036e90613273565b8215611487577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561146d57600080fd5b505af1158015611481573d6000803e3d6000fd5b50505050505b81156114cc576114cc3330848f6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b6115b0565b348a146114f05760405162461bcd60e51b815260040161036e90613273565b811561156b577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561155157600080fd5b505af1158015611565573d6000803e3d6000fd5b50505050505b82156115b0576115b03330858f6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b6115bd8c8484848b6118e8565b8096508197508298505050506116058c6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561137757600080fd5b1561162b57828b11156116265761162661161f848d61334e565b3390611b1a565b611640565b818a11156116405761164061161f838c61334e565b50505096509650969350505050565b6000808087156116985761169833308a8c6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b86156116dd576116dd3330898c6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b6116e989878787612641565b6000896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561172457600080fd5b505afa158015611738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061175c9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161178791906131b8565b60206040518083038186803b15801561179f57600080fd5b505afa1580156117b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d79190612dc4565b905060008a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561181457600080fd5b505afa158015611828573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184c9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161187791906131b8565b60206040518083038186803b15801561188f57600080fd5b505afa1580156118a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c79190612dc4565b90506118d48b8383612759565b919d909c50909a5098505050505050505050565b6000808086156119785761197888888a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561193057600080fd5b505afa158015611944573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119689190612d54565b6001600160a01b0316919061288a565b85156119bc576119bc88878a6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561193057600080fd5b6040516394bf804d60e01b81526001600160a01b038916906394bf804d906119ea90889088906004016132b6565b606060405180830381600087803b158015611a0457600080fd5b505af1158015611a18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3c919061313b565b5090935091508683148015611a5057508582145b611a9b5760405162461bcd60e51b815260206004820152601c60248201527b1d5b995e1c1958dd195908185b5bdd5b9d1cc819195c1bdcda5d195960221b604482015260640161036e565b849050955095509592505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611b149085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612939565b50505050565b80471015611b6a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161036e565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611bb7576040519150601f19603f3d011682016040523d82523d6000602084013e611bbc565b606091505b5050905080611c305760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b606482015260840161036e565b505050565b611c308363a9059cbb60e01b8484604051602401611add9291906131cc565b60008060008360020b12611c6b578260020b611c78565b8260020b611c78906133c6565b9050611c87620d89e7196133a5565b60020b811115611cbd5760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640161036e565b600060018216611cd157600160801b611ce3565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615611d18576080611d13826ffff97272373d413259a46990580e213a613307565b901c90505b6004821615611d42576080611d3d826ffff2e50f5f656932ef12357cf3c7fdcc613307565b901c90505b6008821615611d6c576080611d67826fffe5caca7e10e4e61c3624eaa0941cd0613307565b901c90505b6010821615611d96576080611d91826fffcb9843d60f6159c9db58835c926644613307565b901c90505b6020821615611dc0576080611dbb826fff973b41fa98c081472e6896dfb254c0613307565b901c90505b6040821615611dea576080611de5826fff2ea16466c96a3843ec78b326b52861613307565b901c90505b6080821615611e14576080611e0f826ffe5dee046a99a2a811c461f1969c3053613307565b901c90505b610100821615611e3f576080611e3a826ffcbe86c7900a88aedcffc83b479aa3a4613307565b901c90505b610200821615611e6a576080611e65826ff987a7253ac413176f2b074cf7815e54613307565b901c90505b610400821615611e95576080611e90826ff3392b0822b70005940c7a398e4b70f3613307565b901c90505b610800821615611ec0576080611ebb826fe7159475a2c29b7443b29c7fa6e889d9613307565b901c90505b611000821615611eeb576080611ee6826fd097f3bdfd2022b8845ad8f792aa5825613307565b901c90505b612000821615611f16576080611f11826fa9f746462d870fdf8a65dc1f90e061e5613307565b901c90505b614000821615611f41576080611f3c826f70d869a156d2a1b890bb3df62baf32f7613307565b901c90505b618000821615611f6c576080611f67826f31be135f97d08fd981231505542fcfa6613307565b901c90505b62010000821615611f98576080611f93826f09aa508b5b7a84e1c677de54f3e99bc9613307565b901c90505b62020000821615611fc3576080611fbe826e5d6af8dedb81196699c329225ee604613307565b901c90505b62040000821615611fed576080611fe8826d2216e584f5fa1ea926041bedfe98613307565b901c90505b62080000821615612015576080612010826b048a170391f7dc42444e8fa2613307565b901c90505b60008460020b13156120305761202d816000196132f3565b90505b61203e600160201b82613391565b1561204a57600161204d565b60005b61205e9060ff16602083901c6132db565b949350505050565b600080836001600160a01b0316856001600160a01b03161115612087579293925b846001600160a01b0316866001600160a01b031610156120b3576120ac858585612a0b565b91506120fa565b836001600160a01b0316866001600160a01b031610156120ec576120d8868585612a0b565b91506120e5858785612a75565b90506120fa565b6120f7858585612a75565b90505b94509492505050565b6000806000806121b68a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561214557600080fd5b505afa158015612159573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061217d9190612d54565b8b6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561057557600080fd5b9050881561229b57801561225c573489146121e35760405162461bcd60e51b815260040161036e90613273565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08a6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561223e57600080fd5b505af1158015612252573d6000803e3d6000fd5b505050505061229b565b61229b33308b8d6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b871561237f5780156122eb576122e633308a8d6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156111d257600080fd5b61237f565b34881461230a5760405162461bcd60e51b815260040161036e90613273565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0896040518263ffffffff1660e01b81526004016000604051808303818588803b15801561236557600080fd5b505af1158015612379573d6000803e3d6000fd5b50505050505b61238b8a888888612641565b60008a6001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156123c657600080fd5b505afa1580156123da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fe9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161242991906131b8565b60206040518083038186803b15801561244157600080fd5b505afa158015612455573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124799190612dc4565b905060008b6001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156124b657600080fd5b505afa1580156124ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ee9190612d54565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161251991906131b8565b60206040518083038186803b15801561253157600080fd5b505afa158015612545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125699190612dc4565b90506125778c838386612abf565b919e909d50909b509950505050505050505050565b6000808060001985870985870292508281108382030391505080600014156125c657600084116125bb57600080fd5b50829004905061263a565b8084116125d257600080fd5b600084868809851960019081018716968790049682860381900495909211909303600082900391909104909201919091029190911760038402600290811880860282030280860282030280860282030280860282030280860282030280860290910302029150505b9392505050565b836001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561267a57600080fd5b505afa15801561268e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b29190612d54565b604051630251596160e31b81523060048201528415156024820152604481018490526001600160a01b03838116606483015260a06084830152600060a4830152919091169063128acb089060c4016040805180830381600087803b15801561271957600080fd5b505af115801561272d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127519190612f92565b505050505050565b6000806000856001600160a01b0316639894f21a86866040518363ffffffff1660e01b815260040161278c9291906132cd565b60606040518083038186803b1580156127a457600080fd5b505afa1580156127b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127dc919061316f565b919450925090508285111561283257612832336127f9858861334e565b886001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b818411156128815761288133612848848761334e565b886001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b93509350939050565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b1580156128d657600080fd5b505afa1580156128ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290e9190612dc4565b61291891906132db565b9050611b148463095ea7b360e01b8584604051602401611add9291906131cc565b600061298e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c099092919063ffffffff16565b805190915015611c3057808060200190518101906129ac9190612da8565b611c305760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161036e565b6000826001600160a01b0316846001600160a01b03161115612a2b579192915b6001600160a01b038416612a6b600160601b600160e01b03606085901b16612a538787613326565b6001600160a01b0316866001600160a01b031661258c565b61205e91906132f3565b6000826001600160a01b0316846001600160a01b03161115612a95579192915b61205e6001600160801b038316612aac8686613326565b6001600160a01b0316600160601b61258c565b6000806000866001600160a01b0316639894f21a87876040518363ffffffff1660e01b8152600401612af29291906132cd565b60606040518083038186803b158015612b0a57600080fd5b505afa158015612b1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b42919061316f565b919450925090508286118015612b56575083155b15612ba757612ba233612b69858961334e565b896001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b612bff565b8185118015612bb35750835b15612bff57612bff33612bc6848861334e565b896001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b15801561075557600080fd5b9450945094915050565b606061205e848460008585843b612c625760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161036e565b600080866001600160a01b03168587604051612c7e919061319c565b60006040518083038185875af1925050503d8060008114612cbb576040519150601f19603f3d011682016040523d82523d6000602084013e612cc0565b606091505b5091509150612cd0828286612cdb565b979650505050505050565b60608315612cea57508161263a565b825115612cfa5782518084602001fd5b8160405162461bcd60e51b815260040161036e91906131e5565b8051600281900b8114612d2657600080fd5b919050565b80516001600160801b0381168114612d2657600080fd5b805161ffff81168114612d2657600080fd5b600060208284031215612d65578081fd5b815161263a8161340c565b60008060408385031215612d82578081fd5b8235612d8d8161340c565b91506020830135612d9d8161340c565b809150509250929050565b600060208284031215612db9578081fd5b815161263a81613424565b600060208284031215612dd5578081fd5b5051919050565b600060208284031215612ded578081fd5b813561263a8161340c565b600080600060608486031215612e0c578081fd5b8335612e178161340c565b92506020840135612e278161340c565b929592945050506040919091013590565b60008060008060008060008060006101208a8c031215612e56578485fd5b8935612e618161340c565b985060208a0135975060408a0135965060608a0135612e7f81613424565b955060808a0135945060a08a0135612e968161340c565b935060c08a0135925060e08a013591506101008a0135612eb58161340c565b809150509295985092959850929598565b600080600080600060a08688031215612edd578283fd5b8535612ee88161340c565b94506020860135935060408601359250606086013591506080860135612f0d8161340c565b809150509295509295909350565b60008060008060008060c08789031215612f33578384fd5b8635612f3e8161340c565b95506020870135945060408701359350606087013592506080870135915060a0870135612f6a8161340c565b809150509295509295509295565b600060208284031215612f89578081fd5b61263a82612d14565b60008060408385031215612fa4578182fd5b505080516020909101519092909150565b60008060008060608587031215612fca578182fd5b843593506020850135925060408501356001600160401b0380821115612fee578384fd5b818701915087601f830112613001578384fd5b81358181111561300f578485fd5b886020828501011115613020578485fd5b95989497505060200194505050565b600080600080600060a08688031215613046578283fd5b61304f86612d2b565b9450602086015193506040860151925061306b60608701612d2b565b915061307960808701612d2b565b90509295509295909350565b600080600080600080600060e0888a03121561309f578081fd5b87516130aa8161340c565b96506130b860208901612d14565b95506130c660408901612d42565b94506130d460608901612d42565b93506130e260808901612d42565b925060a088015160ff811681146130f7578182fd5b60c089015190925061310881613424565b8091505092959891949750929550565b600060208284031215613129578081fd5b815162ffffff8116811461263a578182fd5b60008060006060848603121561314f578081fd5b835192506020840151915061316660408501612d2b565b90509250925092565b600080600060608486031215613183578081fd5b8351925060208401519150604084015190509250925092565b600082516131ae818460208701613365565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6020815260008251806020840152613204816040850160208701613365565b601f01601f19169190910160400192915050565b60208082526016908201527572656365697665642062656c6f77206d696e696d756d60501b604082015260600190565b60208082526011908201527062656c6f77206d696e20616d6f756e747360781b604082015260600190565b60208082526023908201527f6d69736d61746368696e6720616d6f756e74206f662045544820666f7277617260408201526219195960ea1b606082015260800190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b600082198211156132ee576132ee6133e0565b500190565b600082613302576133026133f6565b500490565b6000816000190483118215151615613321576133216133e0565b500290565b60006001600160a01b0383811690831681811015613346576133466133e0565b039392505050565b600082821015613360576133606133e0565b500390565b60005b83811015613380578181015183820152602001613368565b83811115611b145750506000910152565b6000826133a0576133a06133f6565b500690565b60008160020b627fffff198114156133bf576133bf6133e0565b9003919050565b6000600160ff1b8214156133dc576133dc6133e0565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461342157600080fd5b50565b801515811461342157600080fdfea264697066735822122089742a1a54400a9f6eadc02ceea482a6895b85ffd739c8890062df553c92d72764736f6c63430008040033

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

0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

-----Decoded View---------------
Arg [0] : _factory (address): 0x1F98431c8aD98523631AE4a59f267346ea31F984
Arg [1] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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