ETH Price: $2,162.65 (+0.51%)

Contract

0x5EC191A7Fd4CcC4f1369C2A6281E95aAf0AE9d8d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw172910692023-05-19 4:06:231040 days ago1684469183IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0100090234
Withdraw144868712022-03-30 9:42:331455 days ago1648633353IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0284515299.70711655
Withdraw144428892022-03-23 13:42:211462 days ago1648042941IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0087287231.99516775
Withdraw144077722022-03-18 2:44:331467 days ago1647571473IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0216966973.10600893
Withdraw144077612022-03-18 2:43:281467 days ago1647571408IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0319022195.84561346
Change Config140548702022-01-22 10:32:101522 days ago1642847530IN
0x5EC191A7...Af0AE9d8d
0 ETH0.00935615285.31828047
Change Config140363442022-01-19 13:53:301525 days ago1642600410IN
0x5EC191A7...Af0AE9d8d
0 ETH0.00427726130.48400319
Withdraw140301812022-01-18 15:00:271526 days ago1642518027IN
0x5EC191A7...Af0AE9d8d
0 ETH0.03878582124.6763836
Withdraw138683192021-12-24 14:01:121551 days ago1640354472IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0185344764.7981583
Withdraw137969052021-12-13 12:47:071562 days ago1639399627IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0129810942.43034892
Deposit137639742021-12-08 9:11:561567 days ago1638954716IN
0x5EC191A7...Af0AE9d8d
0 ETH0.016355460
Change Config137563502021-12-07 3:59:491568 days ago1638849589IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0031376395.68306313
Deposit137562752021-12-07 3:42:331568 days ago1638848553IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0252364184.9647988
Deposit137393152021-12-04 10:32:151571 days ago1638613935IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0203330872
Withdraw137372092021-12-04 2:16:411571 days ago1638584201IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0235850373.84839514
Deposit137354722021-12-03 19:42:051572 days ago1638560525IN
0x5EC191A7...Af0AE9d8d
0 ETH0.03760822110.29515675
Deposit137335172021-12-03 12:07:201572 days ago1638533240IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0241714276.42774475
Deposit137278982021-12-02 14:37:151573 days ago1638455835IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0200759872.47754177
Deposit137260812021-12-02 7:39:151573 days ago1638430755IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0136151879.14837597
Change Max Share137250172021-12-02 3:29:531573 days ago1638415793IN
0x5EC191A7...Af0AE9d8d
0 ETH0.00499167127.57291286
Deposit137230832021-12-01 20:09:531574 days ago1638389393IN
0x5EC191A7...Af0AE9d8d
0 ETH0.02121852120
Deposit137219682021-12-01 15:56:011574 days ago1638374161IN
0x5EC191A7...Af0AE9d8d
0 ETH0.03847015147.77171943
Deposit137216872021-12-01 14:49:541574 days ago1638370194IN
0x5EC191A7...Af0AE9d8d
0 ETH0.03651284131.60865279
Deposit137211382021-12-01 12:44:441574 days ago1638362684IN
0x5EC191A7...Af0AE9d8d
0 ETH0.02504478
Deposit137205122021-12-01 10:26:101574 days ago1638354370IN
0x5EC191A7...Af0AE9d8d
0 ETH0.0284165391.01156195
View all transactions

Latest 2 internal transactions

Advanced mode:
Parent Transaction Hash Method Block
From
To
-137141762021-11-30 10:15:001575 days ago1638267300
0x5EC191A7...Af0AE9d8d
 Contract Creation0 ETH
-137141762021-11-30 10:15:001575 days ago1638267300
0x5EC191A7...Af0AE9d8d
 Contract Creation0 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniverseVaultV3

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 23 : UniverseVaultV3.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;

import "../libraries/SafeERC20.sol";
import "../libraries/SafeMath.sol";
import "../libraries/Math.sol";
import "../libraries/FullMath.sol";
import "../libraries/FixedPoint96.sol";
import "../libraries/PoolAddress.sol";
import "../libraries/PositionHelperV3.sol";

import "../interfaces/IUniverseVaultV3.sol";
import "../interfaces/Ownable.sol";
import "../interfaces/IERC20.sol";
import "../interfaces/IUniswapV3Pool.sol";

import "./UToken.sol";

contract UniverseVaultV3 is IUniverseVaultV3, Ownable {

    using SafeERC20 for IERC20;
    using SafeMath for uint256;
    using SafeMath for uint128;
    using PositionHelperV3 for PositionHelperV3.Position;

    // Uni POOL
    bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;

    // Important Addresses
    address immutable uniFactory;
    address operator;
    /// @inheritdoc IUniverseVaultV3
    IERC20 public immutable override token0;
    /// @inheritdoc IUniverseVaultV3
    IERC20 public immutable override token1;
    mapping(address => bool) poolMap;

    // Core Params
    address swapPool;
    uint8 performanceFee;
    /// @dev For Safety, maximum tick bias from decision
    uint24 diffTick;
    /// @dev Profit distribution ratio, 50%-150% param for rate of Token0
    uint8 profitScale = 100;
    /// @dev control maximum lost for the current position, prevent attack by price manipulate; param <= 1e5
    uint32 safetyParam = 99700;

    struct MaxShares {
        uint256 maxToken0Amt;
        uint256 maxToken1Amt;
        uint256 maxSingeDepositAmt0;
        uint256 maxSingeDepositAmt1;
    }

    /// @inheritdoc IUniverseVaultV3
    MaxShares public override maxShares;

    /// @dev Amount of Token0 & Token1 belongs to protocol
    struct ProtocolFees {
        uint128 fee0;
        uint128 fee1;
    }
    /// @inheritdoc IUniverseVaultV3
    ProtocolFees public override protocolFees;

    /// @inheritdoc IUniverseVaultV3
    PositionHelperV3.Position public override position;

    /// @dev Share Token for Token0
    UToken immutable uToken0;
    /// @dev Share Token for Token1
    UToken immutable uToken1;

    /// @dev White list of contract address
    mapping(address => bool) contractWhiteLists;

    constructor(
        address _uniFactory,
        address _poolAddress,
        address _operator,
        address _swapPool,
        uint8 _performanceFee,
        uint24 _diffTick,
        uint256 _maxToken0,
        uint256 _maxToken1,
        uint256 _maxSingeDepositAmt0,
        uint256 _maxSingeDepositAmt1
    ) {
        require(_uniFactory != address(0), 'set _uniFactory to the zero address');
        require(_poolAddress != address(0), 'set _poolAddress to the zero address');
        require(_operator != address(0), 'set _operator to the zero address');
        require(_swapPool != address(0), 'set _swapPool to the zero address');
        uniFactory = _uniFactory;
        // pool info
        IUniswapV3Pool pool = IUniswapV3Pool(_poolAddress);
        IERC20 _token0 = IERC20(pool.token0());
        IERC20 _token1 = IERC20(pool.token1());
        poolMap[_poolAddress] = true;
        // variable
        operator = _operator;
        swapPool = _swapPool;
        if (_poolAddress != _swapPool) {
            poolMap[_swapPool] = true;
        }
        performanceFee = _performanceFee;
        diffTick = _diffTick;
        // Share Token
        uToken0 = new UToken(string(abi.encodePacked('U', _token0.symbol())), _token0.decimals());
        uToken1 = new UToken(string(abi.encodePacked('U', _token1.symbol())), _token1.decimals());
        token0 = _token0;
        token1 = _token1;
        // Control Param
        maxShares = MaxShares({
            maxToken0Amt : _maxToken0,
            maxToken1Amt : _maxToken1,
            maxSingeDepositAmt0 : _maxSingeDepositAmt0,
            maxSingeDepositAmt1 : _maxSingeDepositAmt1
        });
    }

    /* ========== MODIFIERS ========== */

    /// @dev Only be called by the Operator
    modifier onlyManager {
        require(tx.origin == operator, "OM");
        _;
    }

    /* ========== ONLY OWNER ========== */

    /// @inheritdoc IVaultOwnerActions
    function changeManager(address _operator) external override onlyOwner {
        require(_operator != address(0), "ZERO ADDRESS");
        operator = _operator;
        emit ChangeManger(_operator);
    }

    /// @inheritdoc IVaultOwnerActions
    function updateWhiteList(address _address, bool status) external override onlyOwner {
        require(_address != address(0), "ar");
        contractWhiteLists[_address] = status;
        emit UpdateWhiteList(_address, status);
    }

    /// @inheritdoc IVaultOwnerActions
    function withdrawPerformanceFee(address to) external override onlyOwner {
        require(to != address(0), "ar");
        ProtocolFees memory pf = protocolFees;
        if(pf.fee0 > 1){
            token0.transfer(to, pf.fee0 - 1);
            pf.fee0 = 1;
        }
        if(pf.fee1 > 1){
            token1.transfer(to, pf.fee1 - 1);
            pf.fee1 = 1;
        }
        protocolFees = pf;
    }

    /* ========== PURE ========== */

    function _min(uint256 x, uint256 y) internal pure returns (uint256 z) {
        if (x > y) {
            z = y;
        } else {
            z = x;
        }
    }

    function _max(uint256 x, uint256 y) internal pure returns (uint256 z) {
        if (x > y) {
            z = x;
        } else {
            z = y;
        }
    }

    function _toUint128(uint256 x) internal pure returns (uint128) {
        assert(x <= type(uint128).max);
        return uint128(x);
    }

    /// @dev Calculate totalValue on Token1
    function netValueToken1(
        uint256 amount0,
        uint256 amount1,
        uint256 priceX96
    ) internal pure returns (uint256 netValue) {
        netValue = FullMath.mulDiv(amount0, priceX96, FixedPoint96.Q96).add(amount1);
    }

    /// @dev Get effective Tick Values
    function tickRegulate(
        int24 _lowerTick,
        int24 _upperTick,
        int24 tickSpacing
    ) internal pure returns (int24 lowerTick, int24 upperTick) {
        lowerTick = PositionHelperV3._floor(_lowerTick, tickSpacing);
        upperTick = PositionHelperV3._floor(_upperTick, tickSpacing);
        require(_upperTick > _lowerTick, "Bad Ticks");
    }

    /// @dev amt * totalShare / totalAmt
    function _quantityTransform(
        uint256 newAmt,
        uint256 totalShare,
        uint256 totalAmt
    ) internal pure returns(uint256 newShare){
        if (newAmt != 0) {
            if (totalShare == 0) {
                newShare = newAmt;
            } else {
                newShare = FullMath.mulDiv(newAmt, totalShare, totalAmt);
            }
        }
    }

    /* ========== VIEW ========== */

    /// @dev 50% - 150%
    function _changeProfitScale(uint8 _profitScale) internal {
        if (_profitScale >= 50 && _profitScale <= 150) {
            profitScale = _profitScale;
        }
    }

    /// @dev Calculate UniswapV3 Pool Address
    function _computeAddress(uint24 fee) internal view returns (address pool) {
        pool = address(
            uint256(
                keccak256(
                    abi.encodePacked(
                        hex'ff',
                        uniFactory,
                        keccak256(abi.encode(address(token0), address(token1), fee)),
                        POOL_INIT_CODE_HASH
                    )
                )
            )
        );
    }

    /// @dev Get the pool's balance of token0 Belong to the user
    function _balance0() internal view returns (uint256) {
        return token0.balanceOf(address(this)) - protocolFees.fee0;
    }

    /// @dev Get the pool's balance of token1 Belong to the user
    function _balance1() internal view returns (uint256) {
        return token1.balanceOf(address(this)) - protocolFees.fee1;
    }

    /// @dev Amount to Share. Make Sure All mint and burn after this
    function _calcShare(
        uint256 amount0Desired,
        uint256 amount1Desired
    ) internal view returns (uint256 share0, uint256 share1, uint256 total0, uint256 total1) {
        // read Current Status
        (total0, total1, , ) = _getTotalAmounts(true);
        uint256 ts0 = uToken0.totalSupply();
        uint256 ts1 = uToken1.totalSupply();
        share0 = _quantityTransform(amount0Desired, ts0, total0);
        share1 = _quantityTransform(amount1Desired, ts1, total1);
    }

    /// @dev Share To Amount. Make Sure All mint and burn after this
    function _calcBal(
        uint256 share0,
        uint256 share1
    ) internal view returns (
        uint256 bal0,
        uint256 bal1,
        uint256 free0,
        uint256 free1,
        uint256 rate,
        bool zeroBig
    ) {
        uint256 total0;
        uint256 total1;
        // read Current Status
        (total0, total1, free0, free1) = _getTotalAmounts(false);
        // Calculate the amount to withdraw
        bal0 = _quantityTransform(share0, total0, uToken0.totalSupply());
        bal1 = _quantityTransform(share1, total1, uToken1.totalSupply());
        // calc burn liq rate
        uint256 rate0;
        uint256 rate1;
        if(bal0 > free0){
            rate0 = FullMath.mulDiv(bal0.sub(free0), 1e5, total0.sub(free0));
        }
        if(bal1 > free1){
            rate1 = FullMath.mulDiv(bal1.sub(free1), 1e5, total1.sub(free1));
        }
        if(rate0 >= rate1){
            zeroBig = true;
        }
        rate = _max(rate0, rate1);
    }

    function _getTotalAmounts(bool forDeposit) internal view returns (
        uint256 total0,
        uint256 total1,
        uint256 free0,
        uint256 free1
    ) {
        // read in memory
        PositionHelperV3.Position memory pos = position;
        free0 = _balance0();
        free1 = _balance1();
        total0 = free0;
        total1 = free1;
        if (pos.status) {
            // get amount in Uniswap
            (uint256 now0, uint256 now1) = pos._getTotalAmounts(performanceFee);
            if(now0 > 0 || now1 > 0){ //
                // profit distribution
                uint256 priceX96 = _priceX96(pos.poolAddress);
                (now0, now1) = _getTargetToken(pos.principal0, pos.principal1, now0, now1, priceX96, forDeposit);
                // get Total
                total0 = total0.add(now0);
                total1 = total1.add(now1);
            }
        }
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend
    function getTotalAmounts() external view override returns (
        uint256 total0,
        uint256 total1,
        uint256 free0,
        uint256 free1,
        uint256 utilizationRate0,
        uint256 utilizationRate1
    ) {
        (total0, total1, free0, free1) = _getTotalAmounts(false);
        if (total0 > 0) {utilizationRate0 = 1e5 - free0.mul(1e5).div(total0);}
        if (total1 > 0) {utilizationRate1 = 1e5 - free1.mul(1e5).div(total1);}
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend
    function getPNL() external view override returns (uint256 rate, uint256 param) {
        param = safetyParam;
        // read in memory
        PositionHelperV3.Position memory pos = position;
        if (pos.status) {
            // total in v3
            (uint256 total0, uint256 total1) = pos._getTotalAmounts(performanceFee);
            // _priceX96
            uint256 priceX96 = _priceX96(pos.poolAddress);
            // calculate rate
            uint256 start_nv = netValueToken1(pos.principal0, pos.principal1, priceX96);
            uint256 end_nv = netValueToken1(total0, total1, priceX96);
            rate = end_nv.mul(1e5).div(start_nv);
        }
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend serving deposit
    function getShares(
        uint256 amount0Desired,
        uint256 amount1Desired
    ) external view override returns (uint256 share0, uint256 share1) {
        (share0, share1, , ) = _calcShare(amount0Desired, amount1Desired);
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend serving withdraw
    function getBals(
        uint256 share0,
        uint256 share1
    ) external view override returns (uint256 amount0, uint256 amount1) {
        (amount0, amount1, , , ,) = _calcBal(share0, share1);
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend
    function getUserShares(address user) external view override returns (uint256 share0, uint256 share1) {
        share0 = uToken0.balanceOf(user);
        share1 = uToken1.balanceOf(user);
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend
    function getUserBals(address user) external view override returns (uint256 amount0, uint256 amount1) {
        uint256 share0 = uToken0.balanceOf(user);
        uint256 share1 = uToken1.balanceOf(user);
        (amount0, amount1, , , ,) = _calcBal(share0, share1);
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend
    function totalShare0() external view override returns (uint256) {
        return uToken0.totalSupply();
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Frontend
    function totalShare1() external view override returns (uint256) {
        return uToken1.totalSupply();
    }

    /* ========== INTERNAL ========== */

    /// @dev if position out of range, don't add liquidity; Add liquidity, always update principal
    /// @dev Make Sure pos.status is alwasy True | Always update the principals
    function _addAll(PositionHelperV3.Position memory pos) internal {
        // Read Fee Token Amount
        uint256 add0 = _balance0();
        uint256 add1 = _balance1();
        if(add0 > 0 && add1 > 0){
            // add liquidity
            (add0, add1) = pos._addAll(add0, add1);
            // increase principal
            pos.principal0 = pos.principal0.add128(_toUint128(add0));
            pos.principal1 = pos.principal1.add128(_toUint128(add1));
            // update Status
            pos.status = true;
        }
        // upadate position
        position = pos;
    }

    /// @dev BurnAll Liquidity | CollectAll | Profit Distribution
    function _stopAll() internal {
        // burn all liquidity
        (uint256 collect0, uint256 collect1, uint256 fee0, uint256 fee1) = position._burnAll();
        // collect fee
        (uint256 feesToProtocol0, uint256 feesToProtocol1) = _collectPerformanceFee(fee0, fee1);
        _trim(collect0.sub(feesToProtocol0), collect1.sub(feesToProtocol1), 0, true);
    }

    /// @dev BurnPart Liquidity | CollectAll | Profit Distribution | Return Cost
    function _stopPart(uint128 liq, bool withdrawZero) internal returns(int256 amtSelfDiff) {
        // burn liquidity
        (uint256 collect0, uint256 collect1, uint256 fee0, uint256 fee1) = position._burn(liq);
        // collect fee
        (uint256 feesToProtocol0, uint256 feesToProtocol1) = _collectPerformanceFee(fee0, fee1);
        //
        (amtSelfDiff) = _trim(collect0.sub(feesToProtocol0), collect1.sub(feesToProtocol1), liq, withdrawZero);
    }

    /// @dev Profit Distribution Based on Param
    function _trim(
        uint256 stop0,
        uint256 stop1,
        uint128 liq,
        bool withdrawZero
    ) internal returns(int256 amtSelfDiff) {
        if(stop0 == 0 && stop1 == 0) return (0); //
        // read position in memory
        PositionHelperV3.Position memory pos = position;
        // calculate
        uint256 priceX96 = _priceX96(pos.poolAddress);
        uint256 start0 = pos.principal0;
        uint256 start1 = pos.principal1;
        if (liq != 0) { // Liquidate Part, Update Principal
            (uint128 total_liq, , , , ) = pos._positionInfo();
            start0 = FullMath.mulDiv(start0, liq, total_liq + liq);
            start1 = FullMath.mulDiv(start1, liq, total_liq + liq);
            pos.principal0 = pos.principal0 - _toUint128(start0);
            pos.principal1 = pos.principal1 - _toUint128(start1);
            position = pos;
        }
        (uint256 target0 , uint256 target1) = _getTargetToken(start0, start1, stop0, stop1, priceX96, false); // Use if always for withdraw
        int256 amt;
        bool zeroForOne;
        if(withdrawZero) {
            amt = int256(stop1) - int256(target1);
            if (amt < 0) zeroForOne = true;
            amtSelfDiff = int256(stop0) - int256(target0) ;
        }else{
            amt = int256(stop0) - int256(target0);
            if (amt > 0) zeroForOne = true;
            amtSelfDiff = int256(stop1) - int(target1) ;
        }
        if(amt != 0){
            uint160 sqrtPriceLimitX96 = (zeroForOne ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1);
            (int256 amount0, int256 amount1) = IUniswapV3Pool(swapPool).swap(address(this), zeroForOne, amt, sqrtPriceLimitX96, '');
            amtSelfDiff = amtSelfDiff - (withdrawZero ? amount0 : amount1);
        }
    }

    /// @dev Profit Distribution Based on Param | Return target Amount after distribution
    function _getTargetToken(
        uint256 start0,
        uint256 start1,
        uint256 end0,
        uint256 end1,
        uint256 priceX96,
        bool forDeposit
    ) internal view returns (uint256 target0, uint256 target1){
        uint256 start_nv = netValueToken1(start0, start1, priceX96);
        uint256 end_nv = netValueToken1(end0, end1, priceX96);
        uint256 rate = end_nv.mul(1e5).div(start_nv);
        // For safe when deposit
        if (forDeposit && rate < safetyParam) {
            rate = safetyParam;
        }
        // profit distribution
        if (rate > 1e5 && profitScale != 100) {
            rate = rate.sub(1e5).mul(profitScale).div(1e2).add(1e5);
            target0 = FullMath.mulDiv(start0, rate, 1e5);
            target1 = end_nv.sub(FullMath.mulDiv(target0, priceX96, FixedPoint96.Q96));
        } else {
            target0 = FullMath.mulDiv(start0, rate, 1e5);
            target1 = FullMath.mulDiv(start1, rate, 1e5);
        }
    }

    function _collectPerformanceFee(
        uint256 feesFromPool0,
        uint256 feesFromPool1
    ) internal returns (uint256 feesToProtocol0, uint256 feesToProtocol1){
        uint256 rate = performanceFee;
        if (rate != 0) {
            ProtocolFees memory pf = protocolFees;
            if (feesFromPool0 > 0) {
                feesToProtocol0 = feesFromPool0.div(rate);
                pf.fee0 = pf.fee0.add128(_toUint128(feesToProtocol0));
            }
            if (feesFromPool1 > 0) {
                feesToProtocol1 = feesFromPool1.div(rate);
                pf.fee1 = pf.fee1.add128(_toUint128(feesToProtocol1));
            }
            protocolFees = pf;
            emit CollectFees(feesFromPool0, feesFromPool1);
        }
    }

    function _priceX96(address poolAddress) internal view returns(uint256 priceX96){
        (uint160 sqrtRatioX96, , , , , , ) = IUniswapV3Pool(poolAddress).slot0();
        priceX96 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, FixedPoint96.Q96);
    }

    /// @dev Money From Msg.sender, Share to 'to'
    function _deposit(
        uint256 amount0Desired,
        uint256 amount1Desired,
        address to
    ) internal returns(uint256 share0, uint256 share1) {
        // Check Params
        require(amount0Desired > 0 || amount1Desired > 0, "Deposit Zero!");
        // Read Control Param
        MaxShares memory _maxShares = maxShares;
        require(amount0Desired <= _maxShares.maxSingeDepositAmt0 && amount1Desired <= _maxShares.maxSingeDepositAmt1, "Too Much Deposit!");
        uint256 total0;
        uint256 total1;
        // Cal Share
        (share0, share1, total0, total1) = _calcShare(amount0Desired, amount1Desired);
        // check max share
        require(total0.add(amount0Desired) <= _maxShares.maxToken0Amt
                && total1.add(amount1Desired) <= _maxShares.maxToken1Amt, "exceed total limit");
        // transfer
        if (amount0Desired > 0) token0.safeTransferFrom(msg.sender, address(this), amount0Desired);
        if (amount1Desired > 0) token1.safeTransferFrom(msg.sender, address(this), amount1Desired);
        // add share
        if (share0 > 0) {
            uToken0.mint(to, share0);
        }
        if (share1 > 0) {
            uToken1.mint(to, share1);
        }
        // Invest All
        if (position.status) {
            _addAll(position);
        }
        // EVENT
        emit Deposit(to, share0, share1, amount0Desired, amount1Desired);
    }

    /* ========== EXTERNAL ========== */

    /// @inheritdoc IUniverseVaultV3
    /// @dev For EOA and Contract User
    function deposit(
        uint256 amount0Desired,
        uint256 amount1Desired
    ) external override returns(uint256, uint256) {
        require(tx.origin == msg.sender || contractWhiteLists[msg.sender], "only for verified contract!");
        return _deposit(amount0Desired, amount1Desired, msg.sender);
    }

    /// @inheritdoc IUniverseVaultV3
    /// @dev For Router
    function deposit(
        uint256 amount0Desired,
        uint256 amount1Desired,
        address to
    ) external override returns(uint256, uint256) {
        require(contractWhiteLists[msg.sender], "only for verified contract!");
        return _deposit(amount0Desired, amount1Desired, to);
    }

    /// @inheritdoc IUniverseVaultV3
    function withdraw(uint256 share0, uint256 share1) external override returns(uint256, uint256){
        require(share0 !=0 || share1 !=0, "Withdraw Zero Share!");
        if (share0 > 0) {
            share0 = _min(share0, uToken0.balanceOf(msg.sender));
        }
        if (share1 > 0) {
            share1 = _min(share1, uToken1.balanceOf(msg.sender));
        }
        (uint256 withdraw0, uint256 withdraw1, , , uint256 rate, bool withdrawZero) = _calcBal(share0, share1);
        // Burn
        if (share0 > 0) {uToken0.burn(msg.sender, share0);}
        if (share1 > 0) {uToken1.burn(msg.sender, share1);}
        // swap
        if (rate > 0 && position.status) {
            (uint128 liq, , , , ) = position._positionInfo();
            if (rate < 1e5) {liq = (liq * _toUint128(rate) / 1e5);}
            // all fees related to transaction
            (int256 amtSelfDiff) = _stopPart(liq, withdrawZero);
            if(amtSelfDiff < 0){
                if(withdrawZero){
                    withdraw0 = withdraw0.sub(uint(-amtSelfDiff));
                }else{
                    withdraw1 = withdraw1.sub(uint(-amtSelfDiff));
                }
            }
        }
        if (withdraw0 > 0) {
            withdraw0 = _min(withdraw0, _balance0());
            token0.safeTransfer(msg.sender, withdraw0);
        }
        if (withdraw1 > 0) {
            withdraw1 = _min(withdraw1, _balance1());
            token1.safeTransfer(msg.sender, withdraw1);
        }

        emit Withdraw(msg.sender, share0, share1, withdraw0, withdraw1);

        return (withdraw0, withdraw1);
    }

    /* ========== ONLY MANAGER ========== */

    /// @inheritdoc IVaultOperatorActionsV3
    function initPosition(
        address _poolAddress,
        int24 _lowerTick,
        int24 _upperTick
    ) external override onlyManager {
        require(poolMap[_poolAddress], 'add Pool First');
        require(!position.status, 'position is working, cannot init!');
        IUniswapV3Pool pool = IUniswapV3Pool(_poolAddress);
        int24 tickSpacing = pool.tickSpacing();
        (_lowerTick, _upperTick) = tickRegulate(_lowerTick, _upperTick, tickSpacing);
        position = PositionHelperV3.Position({
            principal0 : 0,
            principal1 : 0,
            poolAddress : _poolAddress,
            tickSpacing : tickSpacing,
            lowerTick : _lowerTick,
            upperTick : _upperTick,
            status: true
        });
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function addPool(uint24 _poolFee) external override onlyManager {
        require(_poolFee == 3000 || _poolFee == 500 || _poolFee == 10000, "Wrong poolFee!");
        address poolAddress = _computeAddress(_poolFee);
        poolMap[poolAddress] = true;
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function changeConfig(
        address _swapPool,
        uint8 _performanceFee,
        uint24 _diffTick,
        uint32 _safetyParam
    ) external override onlyManager {
        require(_performanceFee == 0 || _performanceFee > 4, "20Percent MAX!");
        require(_safetyParam <= 1e5, 'Wrong safety param!');
        if (_swapPool != address(0) && poolMap[_swapPool]) {swapPool = _swapPool;}
        if (performanceFee != _performanceFee) {performanceFee = _performanceFee;}
        if (diffTick != _diffTick) {diffTick = _diffTick;}
        if (safetyParam != _safetyParam) {safetyParam = _safetyParam;}
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function changeMaxShare(
        uint256 _maxShare0,
        uint256 _maxShare1,
        uint256 _maxSingeDepositAmt0,
        uint256 _maxSingeDepositAmt1
    ) external override onlyManager {
        MaxShares memory _maxShares = maxShares;
        if (_maxShare0 != _maxShares.maxToken0Amt) {_maxShares.maxToken0Amt = _maxShare0;}
        if (_maxShare1 != _maxShares.maxToken1Amt) {_maxShares.maxToken1Amt = _maxShare1;}
        if (_maxSingeDepositAmt0 != _maxShares.maxSingeDepositAmt0) {_maxShares.maxSingeDepositAmt0 = _maxSingeDepositAmt0;}
        if (_maxSingeDepositAmt1 != _maxShares.maxSingeDepositAmt1) {_maxShares.maxSingeDepositAmt1 = _maxSingeDepositAmt1;}
        maxShares = _maxShares;
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function avoidRisk(uint8 _profitScale) external override onlyManager {
        if (position.status) {
            _stopAll();
            position.status = false;
        }
        _changeProfitScale(_profitScale);
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function changePool(
        address newPoolAddress,
        int24 _lowerTick,
        int24 _upperTick,
        int24 _spotTick, // the tick when decide to send the transaction
        uint8 _profitScale
    ) external override onlyManager {
        // Check
        require(poolMap[newPoolAddress], 'Add Pool First!');
        // read in memory
        PositionHelperV3.Position memory pos = position;
        // check attack
        pos.checkDiffTick(_spotTick, diffTick);
        require(pos.status && pos.poolAddress != newPoolAddress, "CAN NOT CHANGE POOL!");
        // stop current pool & change profit config
        _stopAll();
        pos.status = false;
        _changeProfitScale(_profitScale);
        // new pool info
        int24 tickSpacing = IUniswapV3Pool(newPoolAddress).tickSpacing();
        (_lowerTick, _upperTick) = tickRegulate(_lowerTick, _upperTick, tickSpacing);
        pos.principal0 = 0;
        pos.principal1 = 0;
        pos.poolAddress = newPoolAddress;
        pos.tickSpacing = tickSpacing;
        pos.upperTick = _upperTick;
        pos.lowerTick = _lowerTick;
        // add liquidity
        _addAll(pos);
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function forceReBalance(
        int24 _lowerTick,
        int24 _upperTick,
        int24 _spotTick,
        uint8 _profitScale
    ) public override onlyManager{
        // read in memory
        PositionHelperV3.Position memory pos = position;
        // Check Status
        (_lowerTick, _upperTick) = tickRegulate(_lowerTick, _upperTick, pos.tickSpacing);
        if (pos.lowerTick == _lowerTick && pos.upperTick == _upperTick) {
            return;
        }
        pos.checkDiffTick(_spotTick, diffTick);
        // stopAll & change profit config
        if (pos.status) {
            _stopAll();
            pos.status = false;
        }
        _changeProfitScale(_profitScale);
        // new pool info
        pos.principal0 = 0;
        pos.principal1 = 0;
        pos.upperTick = _upperTick;
        pos.lowerTick = _lowerTick;
        // add liquidity
        _addAll(pos);
    }

    /// @inheritdoc IVaultOperatorActionsV3
    function reBalance(
        int24 reBalanceThreshold,
        int24 band,
        int24 _spotTick,
        uint8 _profitScale
    ) external override onlyManager {
        require(band > 0 && reBalanceThreshold > 0, "Bad params!");
        (bool status, int24 lowerTick, int24 upperTick) = position._getReBalanceTicks(reBalanceThreshold, band);
        if (status) {
            forceReBalance(lowerTick, upperTick, _spotTick, _profitScale);
        }
    }

    /* ========== CALL BACK ========== */

    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata
    ) external override {
        require(amount0Delta > 0 || amount1Delta > 0, 'Zero');
        require(swapPool == msg.sender, "wrong address");
        if (amount0Delta > 0) {
            token0.transfer(msg.sender, uint256(amount0Delta));
        }
        if (amount1Delta > 0) {
            token1.transfer(msg.sender, uint256(amount1Delta));
        }
    }

    function uniswapV3MintCallback(
        uint256 amount0,
        uint256 amount1,
        bytes calldata
    ) external override {
        require(poolMap[msg.sender], "wrong address");
        // transfer
        if (amount0 > 0) {token0.safeTransfer(msg.sender, amount0);}
        if (amount1 > 0) {token1.safeTransfer(msg.sender, amount1);}
    }

}

// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

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

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

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

import "./Context.sol";
import "./IERC20.sol";
import "../libraries/SafeMath.sol";

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

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_, uint8 decimals_) {
        _name = name_;
        _symbol = symbol_;
        _decimals = decimals_;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

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

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

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

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

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

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

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

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

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

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

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {

    function decimals() external view returns (uint8);

    function symbol() external view returns (string memory);

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

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


/// @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 {
    /// @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);

    /// @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, uint128);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

import "./IVaultOwnerActions.sol";
import "./IVaultOperatorActionsV3.sol";
import "./IVaultEventsV3.sol";
import "./IUniswapV3Pool.sol";
import "./IERC20.sol";
import "../libraries/PositionHelper.sol";

/// @title The interface for a Universe Vault
/// @notice A UniswapV3 optimizer with smart rebalance strategy
interface IUniverseVaultV3 is IVaultOwnerActions, IVaultOperatorActionsV3, IVaultEventsV3{

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

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

    /// @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 fee0, uint128 fee1);

    /// @notice The max share of token0 and token1 that are allowed to deposit
    /// Returns maxShare0 The max share of token0
    /// Returns maxShare1 The max share of token1
    /// Returns maxPersonShare0 The max person share of token0
    /// Returns maxPersonShare1 The max person share of token1
    function maxShares() external view returns (uint256 maxShare0, uint256 maxShare1, uint256 maxPersonShare0, uint256 maxPersonShare1);

    /// @notice Returns data about a specific position index
    /// @return principal0 The principal of token0,
    /// Returns principal1 The principal of token1,
    /// Returns poolAddress The uniV3 pool address of the position,
    /// Returns lowerTick The lower tick of the position,
    /// Returns upperTick The upper tick of the position,
    /// Returns tickSpacing The uniV3 pool tickSpacing,
    /// Returns status The status of the position
    function position() external view returns (
        uint128 principal0,
        uint128 principal1,
        address poolAddress,
        int24 lowerTick,
        int24 upperTick,
        int24 tickSpacing,
        bool status
    );

    /// @notice The shares of token0 and token1 that are owed to address
    /// @return share0 The share amount of token0,
    /// Returns share1 The share amount of token1,
    function getUserShares(address user) external view returns (uint256 share0, uint256 share1);

    /// @notice The Token Amount that are owed to address
    /// @return amount0 The amount of token0,
    /// Returns amount1 The amount of token1,
    function getUserBals(address user) external view returns (uint256 amount0, uint256 amount1);

    /// @notice The total Share Amount of token0
    /// @return Share Amount
    function totalShare0() external view returns (uint256);

    /// @notice The total Share Amount of token1
    /// @return Share Amount
    function totalShare1() external view returns (uint256);

    /// @notice Get the vault's total balance of token0 and token1
    /// @return The amount of token0 and token1
    function getTotalAmounts() external view returns (uint256, uint256, uint256, uint256, uint256, uint256);

    /// @notice Get Current Pnl of position in uniswapV3
    /// @return rate PNL
    /// @return param safety Param prevent arbitrage
    function getPNL() external view returns (uint256 rate, uint256 param);

    /// @notice Get the share\amount0\amount1 info based of quantity of deposit amounts
    /// @param amount0Desired The amount of token0 want to deposit
    /// @param amount1Desired The amount of token1 want to deposit
    /// @return The share0\share1 corresponding to the investment amount
    function getShares(
        uint256 amount0Desired,
        uint256 amount1Desired
    ) external view returns (uint256, uint256);

    /// @notice Get the amount of token0 and token1 corresponding to specific share amount
    /// @param share0 The share amount
    /// @param share1 The share amount
    /// @return The amount of token0 and token1 corresponding to specific share amount
    function getBals(uint256 share0, uint256 share1) external view returns (uint256, uint256);

    /// @notice Deposit token into this contract
    /// @param amount0Desired The amount of token0 want to deposit
    /// @param amount1Desired The amount of token1 want to deposit
    /// @return The share corresponding to the investment amount
    function deposit(
        uint256 amount0Desired,
        uint256 amount1Desired
    ) external returns(uint256, uint256) ;

    /// @notice Deposit token into this contract
    /// @param amount0Desired The amount of token0 want to deposit
    /// @param amount1Desired The amount of token1 want to deposit
    /// @param to who will get The share
    /// @return The share corresponding to the investment amount
    function deposit(
        uint256 amount0Desired,
        uint256 amount1Desired,
        address to
    ) external returns(uint256, uint256) ;

    /// @notice Withdraw token by user
    /// @param share0 The share amount of token0
    /// @param share1 The share amount of token1
    function withdraw(uint256 share0, uint256 share1) external returns(uint256, uint256);

    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @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;

    /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.
    /// @param amount0 The amount of token0 due to the pool for the minted liquidity
    /// @param amount1 The amount of token1 due to the pool for the minted liquidity
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call
    function uniswapV3MintCallback(
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

}

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

/// @title Events emitted by a vault
/// @notice Contains all events emitted by the vault
interface IVaultEventsV3 {

    /// @notice Emitted when user deposit token in vault
    /// @param user The address that deposited token in vault
    /// @param share0 The share token amount corresponding to the deposit
    /// @param share1 The share token amount corresponding to the deposit
    /// @param amount0 The amount of token0 want to deposit
    /// @param amount1 The amount of token1 want to deposit
    event Deposit(
        address indexed user,
        uint256 share0,
        uint256 share1,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when user withdraw their share in vault
    /// @param user The address that withdraw share in vault
    /// @param share0 The amount share to withdraw
    /// @param share1 The amount share to withdraw
    /// @param amount0 How much token0 was taken out by user
    /// @param amount1 How much token1 was taken out by user
    event Withdraw(
        address indexed user,
        uint256 share0,
        uint256 share1,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees collected from uniV3
    /// @param feesFromPool0 How much token0 was collected
    /// @param feesFromPool1 How much token1 was collected
    event CollectFees(
        uint256 feesFromPool0,
        uint256 feesFromPool1
    );

    /// @notice Emitted when add or delete contract white list
    /// @param _address The contact address
    /// @param status true is add false is  delete
    event UpdateWhiteList(
        address indexed _address,
        bool status
    );

    /// @notice Emitted when change manager address
    /// @param _operator The manager address
    event ChangeManger(
        address indexed _operator
    );

}

// 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 vault operator
interface IVaultOperatorActionsV3 {

    function initPosition(address, int24, int24) external;

    /// @notice Set the available uniV3 pool address
    /// @param _poolFee The uniV3 pool fee
    function addPool(uint24 _poolFee) external;

    /// @notice Set the core params of the vault
    /// @param _swapPool Set the uniV3 pool address for trading
    /// @param _performanceFee Set new protocol fee
    /// @param _diffTick Set max rebalance tick bias
    /// @param _safetyParam The safety param
    function changeConfig(
        address _swapPool,
        uint8 _performanceFee,
        uint24 _diffTick,
        uint32 _safetyParam
    ) external;

    /// @notice Set the max share params of the vault
    /// @param _maxShare0 Set max token0 share
    /// @param _maxShare1 Set max token1 share
    /// @param _maxPersonShare0 Set one person max token0 share
    /// @param _maxPersonShare1 Set one person max token1 share
    function changeMaxShare(
        uint256 _maxShare0,
        uint256 _maxShare1,
        uint256 _maxPersonShare0,
        uint256 _maxPersonShare1
    ) external;

    /// @notice Stop mining of specified positions
    /// @param _profitScale The profit distribution param
    function avoidRisk(uint8 _profitScale) external;

//    /// @notice Reinvest the main position
//    /// @param minSwapToken1 The minimum swap amount of token1
//    function reInvest() external;

    /// @notice Change a position's uniV3 pool address
    /// @param newPoolAddress The the new uniV3 pool address
    /// @param _lowerTick The lower tick for the position
    /// @param _upperTick The upper tick for the position
    /// @param _spotTick The desire middle tick in the new pool
    /// @param _profitScale The profit distribution param
    function changePool(
        address newPoolAddress,
        int24 _lowerTick,
        int24 _upperTick,
        int24 _spotTick,
        uint8 _profitScale
    ) external;

    /// @notice Do rebalance of one position
    /// @param _lowerTick The lower tick for the position after rebalance
    /// @param _upperTick The upper tick for the position after rebalance
    /// @param _spotTick The current tick for ready rebalance
    /// @param _profitScale The profit distribution param
    function forceReBalance(
        int24 _lowerTick,
        int24 _upperTick,
        int24 _spotTick,
        uint8 _profitScale
    ) external;

    /// @notice Do rebalance of one position
    /// @param reBalanceThreshold The minimum tick bias to do rebalance
    /// @param band The new price range band param
    /// @param _spotTick The current tick for ready rebalance
    /// @param _profitScale The profit distribution param
    function reBalance(
        int24 reBalanceThreshold,
        int24 band,
        int24 _spotTick,
        uint8 _profitScale
    ) external;

}

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

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the vault owner
interface IVaultOwnerActions {

    /// @notice Set new operator address
    /// @param _operator Operator address
    function changeManager(address _operator) external;

    /// @notice Update address in the whitelist
    /// @param _address Address add to whitelist
    /// @param status Add or Remove from whitelist
    function updateWhiteList(address _address, bool status) external;

    /// @notice Collect the protocol fee to a address
    /// @param to The address where the fee collected to
    function withdrawPerformanceFee(address to) external;

}

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

import "./Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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 12 of 23 : FixedPoint128.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.4.0;

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

File 13 of 23 : 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;
}

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

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

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

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

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

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

        // Factor powers of two out of denominator
        // Compute largest power of two divisor of denominator.
        // Always >= 1.
        uint256 twos = -denominator & denominator;
        // Divide denominator by power of two
        assembly {
            denominator := div(denominator, twos)
        }

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

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

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

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

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
import './FullMath.sol';
import './FixedPoint96.sol';

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

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

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

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

/// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
library PoolAddress {
    bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;

import "./LiquidityAmounts.sol";
import "./TickMath.sol";
import "./FullMath.sol";
import "./FixedPoint128.sol";
import "./SafeMath.sol";

import "../interfaces/IUniswapV3Pool.sol";


library PositionHelper {

    using SafeMath for uint256;

    struct Position {
        address poolAddress;
        int24 lowerTick;
        int24 upperTick;
        int24 tickSpacing;
        bool status; // True - InvestIn   False - NotInvest
    }

    /* ========== VIEW ========== */

    function _positionInfo(
        Position memory position
    ) internal view returns(uint128, uint256, uint256, uint256, uint256){
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // Get Position Key
        bytes32 positionKey = keccak256(abi.encodePacked(address(this), position.lowerTick, position.upperTick));
        // Get Position Detail
        return pool.positions(positionKey);
    }

    function _tickInfo(
        IUniswapV3Pool pool,
        int24 tick
    ) internal view returns (uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128) {
        // liquidityGross\liquidityNet\0\1\tickCumulativeOutside\secondsPerLiquidityOutsideX128\secondsOutside\initialized
        ( , , feeGrowthOutside0X128, feeGrowthOutside1X128, , , , ) = pool.ticks(tick);
    }

    function _getFeeGrowthInside(
        Position memory position
    ) internal view returns (uint256, uint256) {
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        (int24 tickCurrent, uint256 feeGrowthGlobal0X128, uint256 feeGrowthGlobal1X128) = _poolInfo(pool);
        // calculate fee growth below
        (uint256 feeGrowthBelow0X128, uint256 feeGrowthBelow1X128) = _tickInfo(pool, position.lowerTick);
        if (tickCurrent < position.lowerTick) {
            feeGrowthBelow0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128;
            feeGrowthBelow1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128;
        }
        // calculate fee growth above
        (uint256 feeGrowthAbove0X128, uint256 feeGrowthAbove1X128) = _tickInfo(pool, position.upperTick);
        if (tickCurrent >= position.upperTick) {
            feeGrowthAbove0X128 = feeGrowthGlobal0X128 - feeGrowthAbove0X128;
            feeGrowthAbove1X128 = feeGrowthGlobal1X128 - feeGrowthAbove1X128;
        }
        // calculate inside
        uint256 feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;
        uint256 feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;
        return(feeGrowthInside0X128, feeGrowthInside1X128);
    }

    function _getPendingAmounts(
        Position memory position,
        uint128 liquidity,
        uint256 feeGrowthInside0LastX128,
        uint256 feeGrowthInside1LastX128
    ) internal view returns(uint256 tokensPending0, uint256 tokensPending1) {

        // feeInside
        (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) = _getFeeGrowthInside(position);

        // pending calculate
        tokensPending0 = FullMath.mulDiv(
            feeGrowthInside0X128 - feeGrowthInside0LastX128,
            liquidity,
            FixedPoint128.Q128
        );
        tokensPending1 = FullMath.mulDiv(
            feeGrowthInside1X128 - feeGrowthInside1LastX128,
            liquidity,
            FixedPoint128.Q128
        );
    }

    function _getTotalAmounts(Position memory position) internal view returns (uint256 total0, uint256 total1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // position info
        (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) = _positionInfo(position);
        // liquidity Amount
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
        (total0, total1) = LiquidityAmounts.getAmountsForLiquidity(
            sqrtRatioX96,
            TickMath.getSqrtRatioAtTick(position.lowerTick),
            TickMath.getSqrtRatioAtTick(position.upperTick),
            liquidity
        );
        // get Pending
        (uint256 pending0, uint256 pending1) = _getPendingAmounts(position, liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128);
        total0 = total0 + pending0;
        total1 = total1 + pending1;
    }

    function _getTotalAmounts(Position memory position, uint8 _performanceFee) internal view returns (uint256 total0, uint256 total1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // position info
        (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) = _positionInfo(position);
        // liquidity Amount
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
        (total0, total1) = LiquidityAmounts.getAmountsForLiquidity(
            sqrtRatioX96,
            TickMath.getSqrtRatioAtTick(position.lowerTick),
            TickMath.getSqrtRatioAtTick(position.upperTick),
            liquidity
        );
        // get Pending
        (uint256 pending0, uint256 pending1) = _getPendingAmounts(position, liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128);
        total0 = total0 + pending0;
        total1 = total1 + pending1;
        if(_performanceFee > 0){
            total0 = total0.sub(pending0.div(_performanceFee));
            total1 = total1.sub(pending1.div(_performanceFee));
        }
    }

    function _poolInfo(IUniswapV3Pool pool) internal view returns (int24, uint256, uint256) {
        ( , int24 tick, , , , , ) = pool.slot0();
        uint256 feeGrowthGlobal0X128 = pool.feeGrowthGlobal0X128();
        uint256 feeGrowthGlobal1X128 = pool.feeGrowthGlobal1X128();
        // return
        return (tick, feeGrowthGlobal0X128, feeGrowthGlobal1X128);
    }

    /* ========== BASE FUNCTION ========== */

    function _addLiquidity(
        Position memory position,
        uint128 liquidity
    ) internal returns (uint256 amount0, uint256 amount1){
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // add Liquidity on Uniswap
        (amount0, amount1) = pool.mint(
            address(this),
            position.lowerTick,
            position.upperTick,
            liquidity,
            ""
        );
    }

    function _burnLiquidity(
        Position memory position,
        uint128 liquidity
    ) internal returns (uint256 amount0, uint256 amount1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        (amount0, amount1) = pool.burn(position.lowerTick, position.upperTick, liquidity);
    }

    function _collect(
        Position memory position,
        address to,
        uint128 amount0,
        uint128 amount1
    ) internal returns (uint256 collect0, uint256 collect1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // collect ALL to Vault
        (collect0, collect1) = pool.collect(
            to,
            position.lowerTick,
            position.upperTick,
            amount0,
            amount1
        );
    }

    /* ========== SENIOR FUNCTION ========== */

    function _addAll(
        Position memory position,
        uint256 balance0,
        uint256 balance1
    ) internal returns(uint256 amount0, uint256 amount1){
         // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // Calculate Liquidity
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
        uint128 liquidity = LiquidityAmounts.getLiquidityForAmounts(
            sqrtRatioX96,
            TickMath.getSqrtRatioAtTick(position.lowerTick),
            TickMath.getSqrtRatioAtTick(position.upperTick),
            balance0,
            balance1
        );
        // Add to Pool
        (amount0, amount1) = _addLiquidity(position, liquidity);
    }

    function _burnSpecific(
        Position memory position,
        uint128 liquidity,
        address to
    ) internal returns(uint256 amount0, uint256 amount1, uint fee0, uint fee1){
        // Burn
        (amount0, amount1) = _burnLiquidity(position, liquidity);
        // Collect to user
        _collect(position, to, uint128(amount0), uint128(amount1));
        // Collect to Vault
        (fee0, fee1) = _collect(position, address(this), type(uint128).max, type(uint128).max);
    }

    function _burnAll(Position memory position) internal returns(uint, uint) {
        // Read Liq
        (uint128 liquidity, , , , ) = _positionInfo(position);
        return _burn(position, liquidity);
    }

    function _burn(Position memory position, uint128 liquidity) internal returns(uint256 fee0, uint256 fee1) {
        // Burn
        (uint amt0, uint amt1) = _burnLiquidity(position, liquidity);
        // Collect
        (fee0, fee1) = _collect(position, address(this), type(uint128).max, type(uint128).max);
        fee0 = fee0 - amt0;
        fee1 = fee1 - amt1;
    }

    function _getReBalanceTicks(
        PositionHelper.Position memory position,
        int24 reBalanceThreshold,
        int24 band
    ) internal view returns (bool status, int24 lowerTick, int24 upperTick) {
        // get Current Tick
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        ( , int24 tick, , , , , ) = pool.slot0();
        bool lowerRebalance;
        // Check status
        if (position.status) {
            int24 middleTick = (position.lowerTick + position.upperTick) / 2;
            if (middleTick - tick >= reBalanceThreshold) {
                status = true;
                lowerRebalance = true;
            }else if(tick - middleTick >= reBalanceThreshold){
                status = true;
            }
        } else {
            status = true;
        }
        // get new ticks
        if (status) {
            if(lowerRebalance && (tick % position.tickSpacing != 0)){
                tick = _floor(tick, position.tickSpacing) + position.tickSpacing ;
            }else{
                tick = _floor(tick, position.tickSpacing);
            }
            band = _floor(band, position.tickSpacing);
            lowerTick = tick - band;
            upperTick = tick + band;
        }
    }

    function checkDiffTick(PositionHelper.Position memory position, int24 _tick, uint24 _diffTick) internal view {
        // get Current Tick
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        ( , int24 tick, , , , , ) = pool.slot0();
        require(tick - _tick < int24(_diffTick) && _tick - tick < int24(_diffTick), "DIFF TICK");
    }

    function _floor(int24 tick, int24 _tickSpacing) internal pure returns (int24) {
        int24 compressed = tick / _tickSpacing;
        if (tick < 0 && tick % _tickSpacing != 0) compressed--;
        return compressed * _tickSpacing;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma abicoder v2;

import "./LiquidityAmounts.sol";
import "./TickMath.sol";
import "./FullMath.sol";
import "./FixedPoint128.sol";
import "./SafeMath.sol";

import "../interfaces/IUniswapV3Pool.sol";


library PositionHelperV3 {

    using SafeMath for uint256;

    struct Position {
        uint128 principal0;
        uint128 principal1;
        address poolAddress;
        int24 lowerTick;
        int24 upperTick;
        int24 tickSpacing;
        bool status; // True - InvestIn   False - NotInvest
    }

    /* ========== VIEW ========== */

    function _positionInfo(
        Position memory position
    ) internal view returns(uint128, uint256, uint256, uint256, uint256){
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // Get Position Key
        bytes32 positionKey = keccak256(abi.encodePacked(address(this), position.lowerTick, position.upperTick));
        // Get Position Detail
        return pool.positions(positionKey);
    }

    function _tickInfo(
        IUniswapV3Pool pool,
        int24 tick
    ) internal view returns (uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128) {
        // liquidityGross\liquidityNet\0\1\tickCumulativeOutside\secondsPerLiquidityOutsideX128\secondsOutside\initialized
        ( , , feeGrowthOutside0X128, feeGrowthOutside1X128, , , , ) = pool.ticks(tick);
    }

    function _getFeeGrowthInside(
        Position memory position
    ) internal view returns (uint256, uint256) {
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        (int24 tickCurrent, uint256 feeGrowthGlobal0X128, uint256 feeGrowthGlobal1X128) = _poolInfo(pool);
        // calculate fee growth below
        (uint256 feeGrowthBelow0X128, uint256 feeGrowthBelow1X128) = _tickInfo(pool, position.lowerTick);
        if (tickCurrent < position.lowerTick) {
            feeGrowthBelow0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128;
            feeGrowthBelow1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128;
        }
        // calculate fee growth above
        (uint256 feeGrowthAbove0X128, uint256 feeGrowthAbove1X128) = _tickInfo(pool, position.upperTick);
        if (tickCurrent >= position.upperTick) {
            feeGrowthAbove0X128 = feeGrowthGlobal0X128 - feeGrowthAbove0X128;
            feeGrowthAbove1X128 = feeGrowthGlobal1X128 - feeGrowthAbove1X128;
        }
        // calculate inside
        uint256 feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;
        uint256 feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;
        return(feeGrowthInside0X128, feeGrowthInside1X128);
    }

    function _getPendingAmounts(
        Position memory position,
        uint128 liquidity,
        uint256 feeGrowthInside0LastX128,
        uint256 feeGrowthInside1LastX128
    ) internal view returns(uint256 tokensPending0, uint256 tokensPending1) {

        // feeInside
        (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) = _getFeeGrowthInside(position);

        // pending calculate
        tokensPending0 = FullMath.mulDiv(
            feeGrowthInside0X128 - feeGrowthInside0LastX128,
            liquidity,
            FixedPoint128.Q128
        );
        tokensPending1 = FullMath.mulDiv(
            feeGrowthInside1X128 - feeGrowthInside1LastX128,
            liquidity,
            FixedPoint128.Q128
        );
    }

    function _getTotalAmounts(Position memory position, uint8 _performanceFee) internal view returns (uint256 total0, uint256 total1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // position info
        (uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) = _positionInfo(position);
        // liquidity Amount
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
        (total0, total1) = LiquidityAmounts.getAmountsForLiquidity(
            sqrtRatioX96,
            TickMath.getSqrtRatioAtTick(position.lowerTick),
            TickMath.getSqrtRatioAtTick(position.upperTick),
            liquidity
        );
        // get Pending
        (uint256 pending0, uint256 pending1) = _getPendingAmounts(position, liquidity, feeGrowthInside0LastX128, feeGrowthInside1LastX128);
        total0 = total0 + pending0;
        total1 = total1 + pending1;
        if (_performanceFee > 0) {
            total0 = total0.sub(pending0.div(_performanceFee));
            total1 = total1.sub(pending1.div(_performanceFee));
        }
    }

    function _poolInfo(IUniswapV3Pool pool) internal view returns (int24, uint256, uint256) {
        ( , int24 tick, , , , , ) = pool.slot0();
        uint256 feeGrowthGlobal0X128 = pool.feeGrowthGlobal0X128();
        uint256 feeGrowthGlobal1X128 = pool.feeGrowthGlobal1X128();
        // return
        return (tick, feeGrowthGlobal0X128, feeGrowthGlobal1X128);
    }

    /* ========== BASE FUNCTION ========== */

    function _addLiquidity(
        Position memory position,
        uint128 liquidity
    ) internal returns (uint256 amount0, uint256 amount1){
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // add Liquidity on Uniswap
        (amount0, amount1) = pool.mint(
            address(this),
            position.lowerTick,
            position.upperTick,
            liquidity,
            ""
        );
    }

    function _burnLiquidity(
        Position memory position,
        uint128 liquidity
    ) internal returns (uint256 amount0, uint256 amount1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        (amount0, amount1) = pool.burn(position.lowerTick, position.upperTick, liquidity);
    }

    function _collect(
        Position memory position,
        address to,
        uint128 amount0,
        uint128 amount1
    ) internal returns (uint256 collect0, uint256 collect1) {
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // collect ALL to Vault
        (collect0, collect1) = pool.collect(
            to,
            position.lowerTick,
            position.upperTick,
            amount0,
            amount1
        );
    }

    /* ========== SENIOR FUNCTION ========== */

    function _addAll(
        Position memory position,
        uint256 balance0,
        uint256 balance1
    ) internal returns(uint256 amount0, uint256 amount1){
        // Pool OBJ
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        // Calculate Liquidity
        (uint160 sqrtRatioX96, , , , , , ) = pool.slot0();
        uint128 liquidity = LiquidityAmounts.getLiquidityForAmounts(
            sqrtRatioX96,
            TickMath.getSqrtRatioAtTick(position.lowerTick),
            TickMath.getSqrtRatioAtTick(position.upperTick),
            balance0,
            balance1
        );
        // Add to Pool
        (amount0, amount1) = _addLiquidity(position, liquidity);
    }

    function _burnAll(
        Position memory position
    ) internal returns(uint256, uint256, uint256, uint256) {
        // Read Liq
        (uint128 liquidity, , , , ) = _positionInfo(position);
        if(liquidity == 0) return (0, 0, 0, 0);
        return _burn(position, liquidity);
    }

    function _burn(
        Position memory position,
        uint128 liquidity
    ) internal returns(uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1) {
        // Burn
        (fee0, fee1) = _burnLiquidity(position, liquidity);
        // Collect
        (amount0, amount1) = _collect(position, address(this), type(uint128).max, type(uint128).max);
        fee0 = amount0 - fee0;
        fee1 = amount1 - fee1;
    }

    function _getReBalanceTicks(
        Position memory position,
        int24 reBalanceThreshold,
        int24 band
    ) internal view returns (bool status, int24 lowerTick, int24 upperTick) {
        // get Current Tick
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        ( , int24 tick, , , , , ) = pool.slot0();
        bool lowerRebalance;
        // Check status
        if (position.status) {
            int24 middleTick = (position.lowerTick + position.upperTick) / 2;
            if (middleTick - tick >= reBalanceThreshold) {
                status = true;
                lowerRebalance = true;
            }else if(tick - middleTick >= reBalanceThreshold){
                status = true;
            }
        } else {
            status = true;
        }
        // get new ticks
        if (status) {
            if(lowerRebalance && (tick % position.tickSpacing != 0)){
                tick = _floor(tick, position.tickSpacing) + position.tickSpacing ;
            }else{
                tick = _floor(tick, position.tickSpacing);
            }
            band = _floor(band, position.tickSpacing);
            lowerTick = tick - band;
            upperTick = tick + band;
        }
    }

    function checkDiffTick(Position memory position, int24 _tick, uint24 _diffTick) internal view {
        // get Current Tick
        IUniswapV3Pool pool = IUniswapV3Pool(position.poolAddress);
        ( , int24 tick, , , , , ) = pool.slot0();
        require(tick - _tick < int24(_diffTick) && _tick - tick < int24(_diffTick), "DIFF TICK");
    }

    function _floor(int24 tick, int24 _tickSpacing) internal pure returns (int24) {
        int24 compressed = tick / _tickSpacing;
        if (tick < 0 && tick % _tickSpacing != 0) compressed--;
        return compressed * _tickSpacing;
    }

}

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

import "../interfaces/IERC20.sol";
import "./SafeMath.sol";
import "./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 SafeMath for uint256;
    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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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");
        }
    }
}

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

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    function add128(uint128 a, uint128 b) internal pure returns (uint128) {
        uint128 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

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

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
    /// @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));
        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;
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;

import '../interfaces/ERC20.sol';

contract UToken is ERC20 {

    address private _owner;

    constructor(string memory _symbol, uint8 _decimals) ERC20(_symbol, _symbol, _decimals) {
        _owner = msg.sender;
    }

    modifier onlyOwner {
        require(msg.sender == _owner, 'Only Owner!');
        _;
    }

    function mint(address account, uint256 amount) external onlyOwner {
        _mint(account, amount);
        emit Mint(msg.sender, account, amount);
    }

    function burn(address account, uint256 value) external onlyOwner {
        _burn(account, value);
        emit Burn(msg.sender, account, value);
    }

    event Mint(address sender, address account, uint amount);
    event Burn(address sender, address account, uint amount);

}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_uniFactory","type":"address"},{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_swapPool","type":"address"},{"internalType":"uint8","name":"_performanceFee","type":"uint8"},{"internalType":"uint24","name":"_diffTick","type":"uint24"},{"internalType":"uint256","name":"_maxToken0","type":"uint256"},{"internalType":"uint256","name":"_maxToken1","type":"uint256"},{"internalType":"uint256","name":"_maxSingeDepositAmt0","type":"uint256"},{"internalType":"uint256","name":"_maxSingeDepositAmt1","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_operator","type":"address"}],"name":"ChangeManger","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feesFromPool0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feesFromPool1","type":"uint256"}],"name":"CollectFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"share0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_address","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"UpdateWhiteList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"share0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"share1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"uint24","name":"_poolFee","type":"uint24"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_profitScale","type":"uint8"}],"name":"avoidRisk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_swapPool","type":"address"},{"internalType":"uint8","name":"_performanceFee","type":"uint8"},{"internalType":"uint24","name":"_diffTick","type":"uint24"},{"internalType":"uint32","name":"_safetyParam","type":"uint32"}],"name":"changeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"changeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxShare0","type":"uint256"},{"internalType":"uint256","name":"_maxShare1","type":"uint256"},{"internalType":"uint256","name":"_maxSingeDepositAmt0","type":"uint256"},{"internalType":"uint256","name":"_maxSingeDepositAmt1","type":"uint256"}],"name":"changeMaxShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newPoolAddress","type":"address"},{"internalType":"int24","name":"_lowerTick","type":"int24"},{"internalType":"int24","name":"_upperTick","type":"int24"},{"internalType":"int24","name":"_spotTick","type":"int24"},{"internalType":"uint8","name":"_profitScale","type":"uint8"}],"name":"changePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"_lowerTick","type":"int24"},{"internalType":"int24","name":"_upperTick","type":"int24"},{"internalType":"int24","name":"_spotTick","type":"int24"},{"internalType":"uint8","name":"_profitScale","type":"uint8"}],"name":"forceReBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"share0","type":"uint256"},{"internalType":"uint256","name":"share1","type":"uint256"}],"name":"getBals","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPNL","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"param","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"}],"name":"getShares","outputs":[{"internalType":"uint256","name":"share0","type":"uint256"},{"internalType":"uint256","name":"share1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalAmounts","outputs":[{"internalType":"uint256","name":"total0","type":"uint256"},{"internalType":"uint256","name":"total1","type":"uint256"},{"internalType":"uint256","name":"free0","type":"uint256"},{"internalType":"uint256","name":"free1","type":"uint256"},{"internalType":"uint256","name":"utilizationRate0","type":"uint256"},{"internalType":"uint256","name":"utilizationRate1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserBals","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserShares","outputs":[{"internalType":"uint256","name":"share0","type":"uint256"},{"internalType":"uint256","name":"share1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"int24","name":"_lowerTick","type":"int24"},{"internalType":"int24","name":"_upperTick","type":"int24"}],"name":"initPosition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxShares","outputs":[{"internalType":"uint256","name":"maxToken0Amt","type":"uint256"},{"internalType":"uint256","name":"maxToken1Amt","type":"uint256"},{"internalType":"uint256","name":"maxSingeDepositAmt0","type":"uint256"},{"internalType":"uint256","name":"maxSingeDepositAmt1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"position","outputs":[{"internalType":"uint128","name":"principal0","type":"uint128"},{"internalType":"uint128","name":"principal1","type":"uint128"},{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"int24","name":"lowerTick","type":"int24"},{"internalType":"int24","name":"upperTick","type":"int24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"bool","name":"status","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFees","outputs":[{"internalType":"uint128","name":"fee0","type":"uint128"},{"internalType":"uint128","name":"fee1","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"reBalanceThreshold","type":"int24"},{"internalType":"int24","name":"band","type":"int24"},{"internalType":"int24","name":"_spotTick","type":"int24"},{"internalType":"uint8","name":"_profitScale","type":"uint8"}],"name":"reBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShare0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShare1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3MintCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"updateWhiteList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"share0","type":"uint256"},{"internalType":"uint256","name":"share1","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101206040526003805460ff60c01b1916601960c21b1763ffffffff60c81b191661615d60ca1b1790553480156200003657600080fd5b50604051620076163803806200761683398101604081905262000059916200068f565b6000620000656200062a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b038a16620000e15760405162461bcd60e51b8152600401620000d890620008aa565b60405180910390fd5b6001600160a01b0389166200010a5760405162461bcd60e51b8152600401620000d8906200092e565b6001600160a01b038816620001335760405162461bcd60e51b8152600401620000d89062000869565b6001600160a01b0387166200015c5760405162461bcd60e51b8152600401620000d890620008ed565b896001600160a01b03166080816001600160a01b031660601b8152505060008990506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015620001ba57600080fd5b505afa158015620001cf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001f591906200066b565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156200023357600080fd5b505afa15801562000248573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200026e91906200066b565b6001600160a01b03808e166000818152600260205260409020805460ff1916600190811790915580548f84166001600160a01b03199182161790915560038054938f16939091168317905591925014620002e6576001600160a01b038a166000908152600260205260409020805460ff191660011790555b6003805460ff60a01b1916600160a01b60ff8c16021762ffffff60a81b1916600160a81b62ffffff8b1602179055604080516395d89b4160e01b815290516001600160a01b038416916395d89b41916004808301926000929190829003018186803b1580156200035557600080fd5b505afa1580156200036a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000394919081019062000743565b604051602001620003a69190620007fe565b604051602081830303815290604052826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015620003ef57600080fd5b505afa15801562000404573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200042a9190620007e1565b60405162000438906200062e565b6200044592919062000829565b604051809103906000f08015801562000462573d6000803e3d6000fd5b506001600160a01b031660e0816001600160a01b031660601b81525050806001600160a01b03166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b158015620004b957600080fd5b505afa158015620004ce573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620004f8919081019062000743565b6040516020016200050a9190620007fe565b604051602081830303815290604052816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200055357600080fd5b505afa15801562000568573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200058e9190620007e1565b6040516200059c906200062e565b620005a992919062000829565b604051809103906000f080158015620005c6573d6000803e3d6000fd5b506001600160601b0319606091821b81166101005292811b831660a05290811b90911660c0526040805160808101825287815260208101879052908101859052018290525060049390935560059190915560065560075550620009a5945050505050565b3390565b61106f80620065a783390190565b80516001600160a01b03811681146200065457600080fd5b919050565b805160ff811681146200065457600080fd5b6000602082840312156200067d578081fd5b62000688826200063c565b9392505050565b6000806000806000806000806000806101408b8d031215620006af578586fd5b620006ba8b6200063c565b9950620006ca60208c016200063c565b9850620006da60408c016200063c565b9750620006ea60608c016200063c565b9650620006fa60808c0162000659565b955060a08b015162ffffff8116811462000712578586fd5b8095505060c08b0151935060e08b015192506101008b015191506101208b015190509295989b9194979a5092959850565b60006020828403121562000755578081fd5b81516001600160401b03808211156200076c578283fd5b818401915084601f83011262000780578283fd5b8151818111156200078d57fe5b604051601f8201601f191681016020018381118282101715620007ac57fe5b604052818152838201602001871015620007c4578485fd5b620007d782602083016020870162000972565b9695505050505050565b600060208284031215620007f3578081fd5b620006888262000659565b6000605560f81b825282516200081c81600185016020870162000972565b9190910160010192915050565b60006040825283518060408401526200084a81606085016020880162000972565b60ff93909316602083015250601f91909101601f191601606001919050565b60208082526021908201527f736574205f6f70657261746f7220746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526023908201527f736574205f756e69466163746f727920746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526021908201527f736574205f73776170506f6f6c20746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526024908201527f736574205f706f6f6c4164647265737320746f20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60005b838110156200098f57818101518382015260200162000975565b838111156200099f576000848401525b50505050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160601c615b2762000a80600039806106905280610a6e5280610b7c52806111355280611842528061244d5280612ebe528061337f5250806105f052806109c05280610af5528061178e5280611d9152806123b05280612e3752806132ea525080610d7a528061104152806119a05280611a3e52806120f05280612c835280612df252806135c75250806105c75280610d325280610f955280611a0452806120455280612b665280612db752806135a65250806135855250615b276000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c8063982010881161010f578063d3487997116100a2578063f7e8a53911610071578063f7e8a53914610411578063f95949be14610419578063fa461e331461042c578063fd3271411461043f576101f0565b8063d3487997146103c5578063e2bbb158146103d8578063ed064889146103eb578063f2fde38b146103fe576101f0565b8063bd7fa818116100de578063bd7fa81814610378578063c4a7761e1461038b578063c65b61ca146103a5578063d21220a7146103bd576101f0565b8063982010881461032c578063a3fbbaae1461033f578063ac1d060914610352578063ba0cb22b14610365576101f0565b8063554d2a84116101875780638dbdbe6d116101565780638dbdbe6d146102eb5780639270d81b146102fe57806393a98e6c14610311578063947f4ba614610319576101f0565b8063554d2a84146102b357806360d4c2a7146102c6578063715018a6146102db5780638da5cb5b146102e3576101f0565b80631ad8b03b116101c35780631ad8b03b146102645780633e7381521461027a578063441a3e701461028d578063551dcc82146102a0576101f0565b8063025196a6146101f557806309218e911461020a5780630dfe16811461022e57806311c0996514610243575b600080fd5b610208610203366004614f94565b610452565b005b610212610571565b604051610225979695949392919061596a565b60405180910390f35b6102366105c5565b6040516102259190615366565b610256610251366004614df5565b6105e9565b6040516102259291906159b6565b61026c610747565b604051610225929190615950565b610208610288366004614e93565b610761565b61025661029b366004615246565b610988565b6102086102ae366004615294565b610df7565b6102086102c1366004614df5565b610eb1565b6102ce611131565b60405161022591906154a1565b6102086111c9565b610236611287565b6102566102f9366004615267565b611296565b61025661030c366004615246565b6112df565b6102566112fc565b610256610327366004615246565b61142b565b61020861033a366004614f94565b611445565b61020861034d366004614df5565b6115ab565b610208610360366004614e11565b61168f565b610256610373366004614df5565b611789565b6102086103863660046152c5565b6118ce565b61039361192c565b604051610225969594939291906159df565b6103ad61198f565b60405161022594939291906159c4565b61023661199e565b6102086103d3366004615007565b6119c2565b6102566103e6366004615246565b611a65565b6102086103f9366004614f03565b611ab7565b61020861040c366004614df5565b611c79565b6102ce611d8d565b610208610427366004614e49565b611de8565b61020861043a366004615007565b611fd0565b61020861044d366004615214565b612179565b6001546001600160a01b031632146104855760405162461bcd60e51b815260040161047c90615583565b60405180910390fd5b60008360020b13801561049b575060008460020b135b6104b75760405162461bcd60e51b815260040161047c90615817565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819061055090888861221c565b92509250925082156105685761056882828787611445565b50505050505050565b600954600a546001600160801b0380831692600160801b900416906001600160a01b03811690600160a01b8104600290810b91600160b81b8104820b91600160d01b8204900b90600160e81b900460ff1687565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231856040518263ffffffff1660e01b815260040161063a9190615366565b60206040518083038186803b15801561065257600080fd5b505afa158015610666573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068a919061522e565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231866040518263ffffffff1660e01b81526004016106da9190615366565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a919061522e565b90506107368282612383565b509399929850919650505050505050565b6008546001600160801b0380821691600160801b90041682565b6001546001600160a01b0316321461078b5760405162461bcd60e51b815260040161047c90615583565b6001600160a01b03851660009081526002602052604090205460ff166107c35760405162461bcd60e51b815260040161047c9061573b565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526003546108669082908590600160a81b900462ffffff16612520565b8060c00151801561088d5750856001600160a01b031681604001516001600160a01b031614155b6108a95760405162461bcd60e51b815260040161047c906155f1565b6108b16125de565b600060c08201526108c1826126b1565b6000866001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fc57600080fd5b505afa158015610910573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109349190614f78565b9050610941868683612706565b600080855260208501526001600160a01b0389166040850152600283810b810b60a086015281810b810b608086015282810b900b6060850152909650945061056882612746565b6000808315158061099857508215155b6109b45760405162461bcd60e51b815260040161047c906154de565b8315610a6257610a5f847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610a0a9190615366565b60206040518083038186803b158015610a2257600080fd5b505afa158015610a36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5a919061522e565b6128cf565b93505b8215610abb57610ab8837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610a0a9190615366565b92505b600080600080610acb8888612383565b955095505050935093506000881115610b5f57604051632770a7eb60e21b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90610b2c9033908c9060040161537a565b600060405180830381600087803b158015610b4657600080fd5b505af1158015610b5a573d6000803e3d6000fd5b505050505b8615610be657604051632770a7eb60e21b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639dc29fac90610bb39033908b9060040161537a565b600060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050505b600082118015610bff5750600a54600160e81b900460ff165b15610d11576040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c0820152600090610c97906128e9565b505050509050620186a0831015610ccb57620186a0610cb5846129e6565b82026001600160801b031681610cc757fe5b0490505b6000610cd78284612a01565b90506000811215610d0e578215610cfd57610cf6866000839003612ae2565b9550610d0e565b610d0b856000839003612ae2565b94505b50505b8315610d5957610d2384610a5a612b3f565b9350610d596001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163386612bf1565b8215610da157610d6b83610a5a612c5d565b9250610da16001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163385612bf1565b336001600160a01b03167fe08737ac48a1dab4b1a46c7dc9398bd5bfc6d7ad6fabb7cd8caa254de14def3589898787604051610de094939291906159c4565b60405180910390a2509193509150505b9250929050565b6001546001600160a01b03163214610e215760405162461bcd60e51b815260040161047c90615583565b604080516080810182526004548082526005546020830152600654928201929092526007546060820152908514610e56578481525b80602001518414610e6957602081018490525b80604001518314610e7c57604081018390525b80606001518214610e8f57606081018290525b8051600455602081015160055560408101516006556060015160075550505050565b610eb9612cc0565b6001600160a01b0316610eca611287565b6001600160a01b031614610f25576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b815260040161047c906158e2565b604080518082019091526008546001600160801b03808216808452600160801b9092041660208301526001101561102957805160405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163a9059cbb91610fd191869160001990910190600401615474565b602060405180830381600087803b158015610feb57600080fd5b505af1158015610fff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110239190614f5c565b50600181525b600181602001516001600160801b031611156110ef577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb8360018460200151036040518363ffffffff1660e01b8152600401611094929190615474565b602060405180830381600087803b1580156110ae57600080fd5b505af11580156110c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e69190614f5c565b50600160208201525b8051600880546020909301516001600160801b03908116600160801b029281166fffffffffffffffffffffffffffffffff199094169390931790921617905550565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118c57600080fd5b505afa1580156111a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c4919061522e565b905090565b6111d1612cc0565b6001600160a01b03166111e2611287565b6001600160a01b03161461123d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b336000908152600b6020526040812054819060ff166112c75760405162461bcd60e51b815260040161047c906157e0565b6112d2858585612cc4565b915091505b935093915050565b6000806112ec8484612383565b5093989297509195505050505050565b6003546040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff1615801560c0830152600092600160c81b900463ffffffff1691906114265760035460009081906113ba908490600160a01b900460ff1661301c565b9150915060006113cd8460400151613144565b905060006113f685600001516001600160801b031686602001516001600160801b0316846131e8565b905060006114058585856131e8565b905061141e8261141883620186a061320b565b90613264565b975050505050505b509091565b60008061143884846132cb565b5091969095509350505050565b6001546001600160a01b0316321461146f5760405162461bcd60e51b815260040161047c90615583565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a08201819052600160e81b90920460ff16151560c0820152906115069086908690612706565b80955081965050508460020b816060015160020b14801561153057508360020b816080015160020b145b1561153b57506115a5565b6003546115579082908590600160a81b900462ffffff16612520565b8060c0015115611571576115696125de565b600060c08201525b61157a826126b1565b60008082526020820152600284810b810b608083015285810b900b60608201526115a381612746565b505b50505050565b6115b3612cc0565b6001600160a01b03166115c4611287565b6001600160a01b03161461161f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166116455760405162461bcd60e51b815260040161047c906157a9565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f0afcbf7c3742ee20488a08c0da12ca29b2e8bdd022bef6129efbf4e00f84a63090600090a250565b611697612cc0565b6001600160a01b03166116a8611287565b6001600160a01b031614611703576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0382166117295760405162461bcd60e51b815260040161047c906158e2565b6001600160a01b0382166000818152600b602052604090819020805460ff1916841515179055517fc551bbb22d0406dbfb8b6b7740cc521bcf44e1106029cf899c19b6a8e4c99d519061177d908490615496565b60405180910390a25050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231846040518263ffffffff1660e01b81526004016117d89190615366565b60206040518083038186803b1580156117f057600080fd5b505afa158015611804573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611828919061522e565b6040516370a0823160e01b81529092506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611877908690600401615366565b60206040518083038186803b15801561188f57600080fd5b505afa1580156118a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c7919061522e565b9050915091565b6001546001600160a01b031632146118f85760405162461bcd60e51b815260040161047c90615583565b600a54600160e81b900460ff1615611920576119126125de565b600a805460ff60e81b191690555b611929816126b1565b50565b60008060008060008061193f6000613435565b929850909650945092508515611968576119608661141886620186a061320b565b620186a00391505b84156119875761197f8561141885620186a061320b565b620186a00390505b909192939495565b60045460055460065460075484565b7f000000000000000000000000000000000000000000000000000000000000000081565b3360009081526002602052604090205460ff166119f15760405162461bcd60e51b815260040161047c90615515565b8315611a2b57611a2b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163386612bf1565b82156115a5576115a56001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163385612bf1565b60008032331480611a855750336000908152600b602052604090205460ff165b611aa15760405162461bcd60e51b815260040161047c906157e0565b611aac848433612cc4565b915091509250929050565b6001546001600160a01b03163214611ae15760405162461bcd60e51b815260040161047c90615583565b60ff83161580611af4575060048360ff16115b611b105760405162461bcd60e51b815260040161047c90615696565b620186a08163ffffffff161115611b395760405162461bcd60e51b815260040161047c906156cd565b6001600160a01b03841615801590611b6957506001600160a01b03841660009081526002602052604090205460ff165b15611b8a57600380546001600160a01b0319166001600160a01b0386161790555b60035460ff848116600160a01b9092041614611bd457600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b60ff8616021790555b60035462ffffff838116600160a81b9092041614611c2257600380547fffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff16600160a81b62ffffff8516021790555b60035463ffffffff828116600160c81b90920416146115a5576003805463ffffffff8316600160c81b027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff90911617905550505050565b611c81612cc0565b6001600160a01b0316611c92611287565b6001600160a01b031614611ced576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611d325760405162461bcd60e51b8152600401808060200182810382526026815260200180615a5b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118c57600080fd5b6001546001600160a01b03163214611e125760405162461bcd60e51b815260040161047c90615583565b6001600160a01b03831660009081526002602052604090205460ff16611e4a5760405162461bcd60e51b815260040161047c90615628565b600a54600160e81b900460ff1615611e745760405162461bcd60e51b815260040161047c9061584e565b60008390506000816001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611eb457600080fd5b505afa158015611ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eec9190614f78565b9050611ef9848483612706565b6040805160e0810182526000808252602082018190526001600160a01b0399909916918101829052600293840b6060820181905292840b6080820181905294840b60a08201819052600160c090920191909152600998909855600a8054600160e81b6001600160a01b031990911690921762ffffff60a01b1916600160a01b93850b62ffffff908116949094021762ffffff60b81b1916600160b81b95850b8416959095029490941762ffffff60d01b1916600160d01b9890930b91909116969096021760ff60e81b191694909417909355505050565b6000841380611fdf5750600083135b611ffb5760405162461bcd60e51b815260040161047c9061565f565b6003546001600160a01b031633146120255760405162461bcd60e51b815260040161047c90615515565b60008413156120d05760405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb9061207c903390889060040161537a565b602060405180830381600087803b15801561209657600080fd5b505af11580156120aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ce9190614f5c565b505b60008313156115a55760405163a9059cbb60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90612127903390879060040161537a565b602060405180830381600087803b15801561214157600080fd5b505af1158015612155573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a39190614f5c565b6001546001600160a01b031632146121a35760405162461bcd60e51b815260040161047c90615583565b8062ffffff16610bb814806121be57508062ffffff166101f4145b806121cf57508062ffffff16612710145b6121eb5760405162461bcd60e51b815260040161047c90615919565b60006121f682613581565b6001600160a01b03166000908152600260205260409020805460ff191660011790555050565b600080600080866040015190506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561226457600080fd5b505afa158015612278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229c9190615183565b505050505091505060008860c001511561230257600060028a608001518b606001510160020b816122c957fe5b0590508860020b83820360020b126122e85760019650600191506122fc565b8860020b81840360020b126122fc57600196505b50612307565b600195505b85156123775780801561232f57508860a0015160020b8260020b8161232857fe5b0760020b15155b1561234b5760a0890151612343838261365f565b01915061235c565b612359828a60a0015161365f565b91505b61236a878a60a0015161365f565b9650868203945086820193505b50505093509350939050565b6000806000806000806000806123996000613435565b809850819950829450839550505050506124448a837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561240757600080fd5b505afa15801561241b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243f919061522e565b6136ab565b97506124a489827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561240757600080fd5b9650600080878a11156124d4576124d16124be8b8a612ae2565b620186a06124cc878c612ae2565b6136c6565b91505b868911156124fa576124f76124e98a89612ae2565b620186a06124cc868b612ae2565b90505b80821061250657600194505b6125108282613775565b9550505050509295509295509295565b6000836040015190506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561256457600080fd5b505afa158015612578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259c9190615183565b50505050509150508260020b84820360020b1280156125c257508260020b81850360020b125b6115a35760405162461bcd60e51b815260040161047c90615704565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819081906126779061378c565b935093509350935060008061268c84846137e4565b909250905061056861269e8784612ae2565b6126a88784612ae2565b60006001613923565b60328160ff16101580156126c9575060968160ff1611155b15611929576003805460ff8316600160c01b027fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff90911617905550565b600080612713858461365f565b915061271f848461365f565b90508460020b8460020b136112d75760405162461bcd60e51b815260040161047c906158ab565b6000612750612b3f565b9050600061275c612c5d565b905060008211801561276e5750600081115b156127e15761277e838383613ca0565b90925090506127a061278f836129e6565b84516001600160801b031690613d69565b6001600160801b031683526127cb6127b7826129e6565b60208501516001600160801b031690613d69565b6001600160801b03166020840152600160c08401525b505080516009805460208401516001600160801b03908116600160801b029381166fffffffffffffffffffffffffffffffff1990921691909117169190911790556040810151600a80546060840151608085015160a086015160c0909601511515600160e81b0260ff60e81b19600297880b62ffffff908116600160d01b0262ffffff60d01b19948a0b8216600160b81b0262ffffff60b81b1996909a0b909116600160a01b0262ffffff60a01b196001600160a01b039099166001600160a01b03199097169690961797909716949094179290921695909517949094169290921791909116919091179055565b6000818311156128e05750806128e3565b50815b92915050565b6000806000806000808660400151905060003088606001518960800151604051602001612918939291906152e1565b60408051601f198184030181529082905280516020909101207f514ea4bf00000000000000000000000000000000000000000000000000000000825291506001600160a01b0383169063514ea4bf906129759084906004016154a1565b60a06040518083038186803b15801561298d57600080fd5b505afa1580156129a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c5919061512d565b939c929b509099506001600160801b03908116985090911695509350505050565b60006001600160801b038211156129f957fe5b50805b919050565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819081908190612a9d9088613dcf565b9350935093509350600080612ab284846137e4565b9092509050612ad5612ac48784612ae2565b612ace8784612ae2565b8b8b613923565b9998505050505050505050565b600082821115612b39576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6008546040516370a0823160e01b81526000916001600160801b0316906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190612b9b903090600401615366565b60206040518083038186803b158015612bb357600080fd5b505afa158015612bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612beb919061522e565b03905090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052612c58908490613e09565b505050565b6008546040516370a0823160e01b8152600091600160801b90046001600160801b0316907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190612b9b903090600401615366565b3390565b6000806000851180612cd65750600084115b612cf25760405162461bcd60e51b815260040161047c906155ba565b60408051608081018252600454815260055460208201526006549181018290526007546060820152908611801590612d2e575080606001518511155b612d4a5760405162461bcd60e51b815260040161047c9061554c565b600080612d5788886132cb565b865193985091965093509150612d6d838a613eba565b11158015612d8857506020830151612d858289613eba565b11155b612da45760405162461bcd60e51b815260040161047c90615772565b8715612ddf57612ddf6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308b613f14565b8615612e1a57612e1a6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308a613f14565b8415612ea1576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340c10f1990612e6e908990899060040161537a565b600060405180830381600087803b158015612e8857600080fd5b505af1158015612e9c573d6000803e3d6000fd5b505050505b8315612f28576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340c10f1990612ef5908990889060040161537a565b600060405180830381600087803b158015612f0f57600080fd5b505af1158015612f23573d6000803e3d6000fd5b505050505b600a54600160e81b900460ff1615612fca576040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c0820152612fca90612746565b856001600160a01b03167f7162984403f6c73c8639375d45a9187dfd04602231bd8e587c415718b5f7e5f986868b8b60405161300994939291906159c4565b60405180910390a2505050935093915050565b60408201516000908190818080613032886128e9565b50509250925092506000846001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561307557600080fd5b505afa158015613089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ad9190615183565b50505050505090506130d9816130c68b60600151613f9c565b6130d38c60800151613f9c565b876142ea565b90975095506000806130ed8b878787614386565b9981019998890198909250905060ff8a16156131365761311a6131138360ff8d16613264565b8a90612ae2565b985061313361312c8260ff8d16613264565b8990612ae2565b97505b505050505050509250929050565b600080826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561318057600080fd5b505afa158015613194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b89190615183565b50505050505090506131e1816001600160a01b0316826001600160a01b0316600160601b6136c6565b9392505050565b6000613203836131fd8685600160601b6136c6565b90613eba565b949350505050565b60008261321a575060006128e3565b8282028284828161322757fe5b04146131e15760405162461bcd60e51b8152600401808060200182810382526021815260200180615aa76021913960400191505060405180910390fd5b60008082116132ba576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816132c357fe5b049392505050565b6000806000806132db6001613435565b905050809250819350505060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561334157600080fd5b505afa158015613355573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613379919061522e565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156133d657600080fd5b505afa1580156133ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061340e919061522e565b905061341b8883866136ab565b95506134288782856136ab565b9450505092959194509250565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819081906134cd612b3f565b92506134d7612c5d565b91508294508193508060c0015115613579576003546000908190613506908490600160a01b900460ff1661301c565b9150915060008211806135195750600081115b1561357657600061352d8460400151613144565b905061355784600001516001600160801b031685602001516001600160801b03168585858e6143dc565b90935091506135668884613eba565b97506135728783613eba565b9650505b50505b509193509193565b60007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000846040516020016135f993929190615393565b60408051601f19818403018152908290528051602091820120613641939290917fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b549101615316565b60408051601f19818403018152919052805160209091012092915050565b6000808260020b8460020b8161367157fe5b05905060008460020b12801561369857508260020b8460020b8161369157fe5b0760020b15155b156136a257600019015b90910292915050565b600083156131e157826136bf5750826131e1565b6132038484845b60008080600019858709868602925082811090839003039050806136fc57600084116136f157600080fd5b5082900490506131e1565b80841161370857600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6000818311156137865750816128e3565b50919050565b600080600080600061379d866128e9565b505050509050806001600160801b0316600014156137c9576000806000809450945094509450506137dd565b6137d38682613dcf565b9450945094509450505b9193509193565b6003546000908190600160a01b900460ff16801561391b57604080518082019091526008546001600160801b038082168352600160801b909104166020820152851561385f576138348683613264565b9350613853613842856129e6565b82516001600160801b031690613d69565b6001600160801b031681525b84156138a05761386f8583613264565b925061389161387d846129e6565b60208301516001600160801b031690613d69565b6001600160801b031660208201525b80516008805460208401516001600160801b03908116600160801b029381166fffffffffffffffffffffffffffffffff1990921691909117169190911790556040517f5393ab6ef9bb40d91d1b04bbbeb707fbf3d1eb73f46744e2d179e4996026283f9061391190889088906159b6565b60405180910390a1505b509250929050565b600084158015613931575083155b1561393e57506000613203565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b038116928201839052600160a01b8104600290810b810b810b6060840152600160b81b8204810b810b810b6080840152600160d01b8204810b810b900b60a0830152600160e81b900460ff16151560c0820152906000906139d090613144565b825160208401519192506001600160801b0390811691811690871615613b505760006139fb856128e9565b505050509050613a2083896001600160801b03168a84016001600160801b03166136c6565b9250613a4182896001600160801b03168a84016001600160801b03166136c6565b9150613a4c836129e6565b8551036001600160801b03168552613a63826129e6565b6020860180516001600160801b03929003821690819052865160098054600160801b9093029184166fffffffffffffffffffffffffffffffff1990931692909217909216919091179055506040840151600a80546060870151608088015160a089015160c08a01511515600160e81b0260ff60e81b19600292830b62ffffff908116600160d01b0262ffffff60d01b1995850b8216600160b81b0262ffffff60b81b199790950b909116600160a01b0262ffffff60a01b196001600160a01b03909a166001600160a01b031990981697909717989098169590951793909316171693909317169190911790555b600080613b6284848d8d8960006143dc565b915091506000808915613b8b57828c0391506000821215613b81575060015b838d039850613ba3565b838d0391506000821315613b9d575060015b828c0398505b8115613c9057600081613bca5773fffd8963efd1fc6a506488495d951d5263988d25613bd1565b6401000276a45b6003546040517f128acb0800000000000000000000000000000000000000000000000000000000815291925060009182916001600160a01b03169063128acb0890613c2690309088908a9089906004016153bb565b6040805180830381600087803b158015613c3f57600080fd5b505af1158015613c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c779190614fe4565b915091508c613c865780613c88565b815b8c039b505050505b5050505050505050949350505050565b6000806000856040015190506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015613ce757600080fd5b505afa158015613cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1f9190615183565b50505050505090506000613d4e82613d3a8a60600151613f9c565b613d478b60800151613f9c565b8a8a6144fa565b9050613d5a88826145be565b90999098509650505050505050565b60008282016001600160801b0380851690821610156131e1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600080600080613ddf8686614661565b9092509050613df786306001600160801b03806146bc565b90979096509187039450850392509050565b6000613e5e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661476e9092919063ffffffff16565b805190915015612c5857808060200190516020811015613e7d57600080fd5b5051612c585760405162461bcd60e51b815260040180806020018281038252602a815260200180615ac8602a913960400191505060405180910390fd5b6000828201838110156131e1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526115a5908590613e09565b60008060008360020b12613fb3578260020b613fbb565b8260020b6000035b9050620d89e8811115614015576040805162461bcd60e51b815260206004820152600160248201527f5400000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006001821661402957600160801b61403b565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561406f576ffff97272373d413259a46990580e213a0260801c5b600482161561408e576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156140ad576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156140cc576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156140eb576fff973b41fa98c081472e6896dfb254c00260801c5b604082161561410a576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615614129576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615614149576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615614169576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615614189576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156141a9576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156141c9576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156141e9576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615614209576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615614229576f31be135f97d08fd981231505542fcfa60260801c5b6201000082161561424a576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561426a576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615614289576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156142a6576b048a170391f7dc42444e8fa20260801c5b60008460020b13156142c15780600019816142bd57fe5b0490505b6401000000008106156142d55760016142d8565b60005b60ff16602082901c0192505050919050565b600080836001600160a01b0316856001600160a01b0316111561430b579293925b846001600160a01b0316866001600160a01b0316116143365761432f85858561477d565b915061437d565b836001600160a01b0316866001600160a01b0316101561436f5761435b86858561477d565b91506143688587856147e6565b905061437d565b61437a8585856147e6565b90505b94509492505050565b60008060008061439588614829565b915091506143b3868303886001600160801b0316600160801b6136c6565b93506143cf858203886001600160801b0316600160801b6136c6565b9250505094509492505050565b60008060006143ec8989876131e8565b905060006143fb8888886131e8565b905060006144108361141884620186a061320b565b905085801561442d5750600354600160c81b900463ffffffff1681105b156144445750600354600160c81b900463ffffffff165b620186a0811180156144635750600354600160c01b900460ff16606414155b156144cb5760035461449990620186a0906131fd9060649061141890600160c01b900460ff166144938786612ae2565b9061320b565b90506144a98b82620186a06136c6565b94506144c46144bd8689600160601b6136c6565b8390612ae2565b93506144ec565b6144d98b82620186a06136c6565b94506144e98a82620186a06136c6565b93505b505050965096945050505050565b6000836001600160a01b0316856001600160a01b0316111561451a579293925b846001600160a01b0316866001600160a01b0316116145455761453e8585856148b7565b90506145b5565b836001600160a01b0316866001600160a01b031610156145a757600061456c8786866148b7565b9050600061457b87898661491a565b9050806001600160801b0316826001600160801b03161061459c578061459e565b815b925050506145b5565b6145b285858461491a565b90505b95945050505050565b600080600084604001519050806001600160a01b0316633c8a7d8d3087606001518860800151886040518563ffffffff1660e01b815260040161460494939291906153f5565b6040805180830381600087803b15801561461d57600080fd5b505af1158015614631573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146559190614fe4565b90969095509350505050565b6040808301516060840151608085015192517fa34123a70000000000000000000000000000000000000000000000000000000081526000938493926001600160a01b0384169263a34123a792614604929189906004016154b8565b600080600086604001519050806001600160a01b0316634f1eb3d88789606001518a6080015189896040518663ffffffff1660e01b8152600401614704959493929190615437565b6040805180830381600087803b15801561471d57600080fd5b505af1158015614731573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061475591906150fb565b6001600160801b03918216999116975095505050505050565b60606132038484600085614957565b6000826001600160a01b0316846001600160a01b0316111561479d579192915b836001600160a01b03166147d6606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166136c6565b816147dd57fe5b04949350505050565b6000826001600160a01b0316846001600160a01b03161115614806579192915b613203826001600160801b03168585036001600160a01b0316600160601b6136c6565b6040810151600090819081808061483f84614ab2565b925092509250600080614856868a60600151614c27565b91509150886060015160020b8560020b1215614873579083039082035b600080614884888c60800151614c27565b915091508a6080015160020b8760020b126148a0579085039084035b929094039390930396509190030392505050915091565b6000826001600160a01b0316846001600160a01b031611156148d7579192915b60006148fa856001600160a01b0316856001600160a01b0316600160601b6136c6565b90506145b561491584838888036001600160a01b03166136c6565b614cb9565b6000826001600160a01b0316846001600160a01b0316111561493a579192915b61320361491583600160601b8787036001600160a01b03166136c6565b6060824710156149985760405162461bcd60e51b8152600401808060200182810382526026815260200180615a816026913960400191505060405180910390fd5b6149a185614ccf565b6149f2576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310614a305780518252601f199092019160209182019101614a11565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614a92576040519150601f19603f3d011682016040523d82523d6000602084013e614a97565b606091505b5091509150614aa7828286614cd5565b979650505050505050565b600080600080846001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015614af157600080fd5b505afa158015614b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b299190615183565b50505050509150506000856001600160a01b031663f30583996040518163ffffffff1660e01b815260040160206040518083038186803b158015614b6c57600080fd5b505afa158015614b80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ba4919061522e565b90506000866001600160a01b031663461413196040518163ffffffff1660e01b815260040160206040518083038186803b158015614be157600080fd5b505afa158015614bf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c19919061522e565b929791965091945092505050565b600080836001600160a01b031663f30dba93846040518263ffffffff1660e01b8152600401614c5691906154aa565b6101006040518083038186803b158015614c6f57600080fd5b505afa158015614c83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ca79190615058565b50939a92995091975050505050505050565b806001600160801b03811681146129fc57600080fd5b3b151590565b60608315614ce45750816131e1565b825115614cf45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614d3e578181015183820152602001614d26565b50505050905090810190601f168015614d6b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60008083601f840112614d8a578182fd5b50813567ffffffffffffffff811115614da1578182fd5b602083019150836020828501011115610df057600080fd5b80516001600160801b03811681146129fc57600080fd5b805161ffff811681146129fc57600080fd5b803562ffffff811681146129fc57600080fd5b600060208284031215614e06578081fd5b81356131e181615a07565b60008060408385031215614e23578081fd5b8235614e2e81615a07565b91506020830135614e3e81615a1c565b809150509250929050565b600080600060608486031215614e5d578081fd5b8335614e6881615a07565b92506020840135614e7881615a2a565b91506040840135614e8881615a2a565b809150509250925092565b600080600080600060a08688031215614eaa578081fd5b8535614eb581615a07565b94506020860135614ec581615a2a565b93506040860135614ed581615a2a565b92506060860135614ee581615a2a565b91506080860135614ef581615a4b565b809150509295509295909350565b60008060008060808587031215614f18578384fd5b8435614f2381615a07565b93506020850135614f3381615a4b565b9250614f4160408601614de2565b91506060850135614f5181615a39565b939692955090935050565b600060208284031215614f6d578081fd5b81516131e181615a1c565b600060208284031215614f89578081fd5b81516131e181615a2a565b60008060008060808587031215614fa9578182fd5b8435614fb481615a2a565b93506020850135614fc481615a2a565b92506040850135614fd481615a2a565b91506060850135614f5181615a4b565b60008060408385031215614ff6578182fd5b505080516020909101519092909150565b6000806000806060858703121561501c578182fd5b8435935060208501359250604085013567ffffffffffffffff811115615040578283fd5b61504c87828801614d79565b95989497509550505050565b600080600080600080600080610100898b031215615074578586fd5b61507d89614db9565b9750602089015180600f0b8114615092578687fd5b80975050604089015195506060890151945060808901518060060b81146150b7578384fd5b60a08a01519094506150c881615a07565b60c08a01519093506150d981615a39565b60e08a01519092506150ea81615a1c565b809150509295985092959890939650565b6000806040838503121561510d578182fd5b61511683614db9565b915061512460208401614db9565b90509250929050565b600080600080600060a08688031215615144578283fd5b61514d86614db9565b9450602086015193506040860151925061516960608701614db9565b915061517760808701614db9565b90509295509295909350565b600080600080600080600060e0888a03121561519d578081fd5b87516151a881615a07565b60208901519097506151b981615a2a565b95506151c760408901614dd0565b94506151d560608901614dd0565b93506151e360808901614dd0565b925060a08801516151f381615a4b565b60c089015190925061520481615a1c565b8091505092959891949750929550565b600060208284031215615225578081fd5b6131e182614de2565b60006020828403121561523f578081fd5b5051919050565b60008060408385031215615258578182fd5b50508035926020909101359150565b60008060006060848603121561527b578081fd5b83359250602084013591506040840135614e8881615a07565b600080600080608085870312156152a9578182fd5b5050823594602084013594506040840135936060013592509050565b6000602082840312156152d6578081fd5b81356131e181615a4b565b60609390931b6bffffffffffffffffffffffff19168352600291820b60e890811b6014850152910b901b6017820152601a0190565b7fff00000000000000000000000000000000000000000000000000000000000000815260609390931b6bffffffffffffffffffffffff191660018401526015830191909152603582015260550190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b6001600160a01b03948516815292151560208401526040830191909152909116606082015260a06080820181905260009082015260c00190565b6001600160a01b03949094168452600292830b6020850152910b60408301526001600160801b0316606082015260a06080820181905260009082015260c00190565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6001600160a01b039290921682526001600160801b0316602082015260400190565b901515815260200190565b90815260200190565b60029190910b815260200190565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b60208082526014908201527f5769746864726177205a65726f20536861726521000000000000000000000000604082015260600190565b6020808252600d908201527f77726f6e67206164647265737300000000000000000000000000000000000000604082015260600190565b60208082526011908201527f546f6f204d756368204465706f73697421000000000000000000000000000000604082015260600190565b60208082526002908201527f4f4d000000000000000000000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f4465706f736974205a65726f2100000000000000000000000000000000000000604082015260600190565b60208082526014908201527f43414e204e4f54204348414e474520504f4f4c21000000000000000000000000604082015260600190565b6020808252600e908201527f61646420506f6f6c204669727374000000000000000000000000000000000000604082015260600190565b60208082526004908201527f5a65726f00000000000000000000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f323050657263656e74204d415821000000000000000000000000000000000000604082015260600190565b60208082526013908201527f57726f6e672073616665747920706172616d2100000000000000000000000000604082015260600190565b60208082526009908201527f44494646205449434b0000000000000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f41646420506f6f6c204669727374210000000000000000000000000000000000604082015260600190565b60208082526012908201527f65786365656420746f74616c206c696d69740000000000000000000000000000604082015260600190565b6020808252600c908201527f5a45524f20414444524553530000000000000000000000000000000000000000604082015260600190565b6020808252601b908201527f6f6e6c7920666f7220766572696669656420636f6e7472616374210000000000604082015260600190565b6020808252600b908201527f42616420706172616d7321000000000000000000000000000000000000000000604082015260600190565b60208082526021908201527f706f736974696f6e20697320776f726b696e672c2063616e6e6f7420696e697460408201527f2100000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526009908201527f426164205469636b730000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f6172000000000000000000000000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f57726f6e6720706f6f6c46656521000000000000000000000000000000000000604082015260600190565b6001600160801b0392831681529116602082015260400190565b6001600160801b0397881681529590961660208601526001600160a01b03939093166040850152600291820b6060850152810b60808401520b60a082015290151560c082015260e00190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b6001600160a01b038116811461192957600080fd5b801515811461192957600080fd5b8060020b811461192957600080fd5b63ffffffff8116811461192957600080fd5b60ff8116811461192957600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220d38296fbc8c2294647e9fbd8575d0783fc7b657af3f3f41b75642766b5fe0b9064736f6c6343000706003360806040523480156200001157600080fd5b506040516200106f3803806200106f833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b506040526020908101518451909350849250829184916200010e916003919085019062000155565b5081516200012490600490602085019062000155565b506005805460ff191660ff9290921691909117610100600160a81b0319166101003302179055506200020192505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200018d5760008555620001d8565b82601f10620001a857805160ff1916838001178555620001d8565b82800160010185558215620001d8579182015b82811115620001d8578251825591602001919060010190620001bb565b50620001e6929150620001ea565b5090565b5b80821115620001e65760008155600101620001eb565b610e5e80620002116000396000f3fe608060405234801561001057600080fd5b50600436106100df5760003560e01c806340c10f191161008c5780639dc29fac116100665780639dc29fac14610297578063a457c2d7146102c3578063a9059cbb146102ef578063dd62ed3e1461031b576100df565b806340c10f191461023b57806370a082311461026957806395d89b411461028f576100df565b806323b872dd116100bd57806323b872dd146101bb578063313ce567146101f1578063395093511461020f576100df565b806306fdde03146100e4578063095ea7b31461016157806318160ddd146101a1575b600080fd5b6100ec610349565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012657818101518382015260200161010e565b50505050905090810190601f1680156101535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61018d6004803603604081101561017757600080fd5b506001600160a01b0381351690602001356103df565b604080519115158252519081900360200190f35b6101a96103fc565b60408051918252519081900360200190f35b61018d600480360360608110156101d157600080fd5b506001600160a01b03813581169160208101359091169060400135610402565b6101f9610489565b6040805160ff9092168252519081900360200190f35b61018d6004803603604081101561022557600080fd5b506001600160a01b038135169060200135610492565b6102676004803603604081101561025157600080fd5b506001600160a01b0381351690602001356104e0565b005b6101a96004803603602081101561027f57600080fd5b50356001600160a01b0316610588565b6100ec6105a3565b610267600480360360408110156102ad57600080fd5b506001600160a01b038135169060200135610604565b61018d600480360360408110156102d957600080fd5b506001600160a01b0381351690602001356106ac565b61018d6004803603604081101561030557600080fd5b506001600160a01b038135169060200135610714565b6101a96004803603604081101561033157600080fd5b506001600160a01b0381358116916020013516610728565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103d55780601f106103aa576101008083540402835291602001916103d5565b820191906000526020600020905b8154815290600101906020018083116103b857829003601f168201915b5050505050905090565b60006103f36103ec610753565b8484610757565b50600192915050565b60025490565b600061040f848484610843565b61047f8461041b610753565b61047a85604051806060016040528060288152602001610d72602891396001600160a01b038a16600090815260016020526040812090610459610753565b6001600160a01b03168152602081019190915260400160002054919061099e565b610757565b5060019392505050565b60055460ff1690565b60006103f361049f610753565b8461047a85600160006104b0610753565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610a35565b60055461010090046001600160a01b03163314610532576040805162461bcd60e51b815260206004820152600b60248201526a4f6e6c79204f776e65722160a81b604482015290519081900360640190fd5b61053c8282610a96565b604080513381526001600160a01b038416602082015280820183905290517fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f89181900360600190a15050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103d55780601f106103aa576101008083540402835291602001916103d5565b60055461010090046001600160a01b03163314610656576040805162461bcd60e51b815260206004820152600b60248201526a4f6e6c79204f776e65722160a81b604482015290519081900360640190fd5b6106608282610b86565b604080513381526001600160a01b038416602082015280820183905290517fbac40739b0d4ca32fa2d82fc91630465ba3eddd1598da6fca393b26fb63b94539181900360600190a15050565b60006103f36106b9610753565b8461047a85604051806060016040528060258152602001610e0460259139600160006106e3610753565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061099e565b60006103f3610721610753565b8484610843565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661079c5760405162461bcd60e51b8152600401808060200182810382526024815260200180610de06024913960400191505060405180910390fd5b6001600160a01b0382166107e15760405162461bcd60e51b8152600401808060200182810382526022815260200180610d2a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166108885760405162461bcd60e51b8152600401808060200182810382526025815260200180610dbb6025913960400191505060405180910390fd5b6001600160a01b0382166108cd5760405162461bcd60e51b8152600401808060200182810382526023815260200180610ce56023913960400191505060405180910390fd5b6108d8838383610c82565b61091581604051806060016040528060268152602001610d4c602691396001600160a01b038616600090815260208190526040902054919061099e565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546109449082610a35565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610a2d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156109f25781810151838201526020016109da565b50505050905090810190601f168015610a1f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610a8f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216610af1576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b610afd60008383610c82565b600254610b0a9082610a35565b6002556001600160a01b038216600090815260208190526040902054610b309082610a35565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b038216610bcb5760405162461bcd60e51b8152600401808060200182810382526021815260200180610d9a6021913960400191505060405180910390fd5b610bd782600083610c82565b610c1481604051806060016040528060228152602001610d08602291396001600160a01b038516600090815260208190526040902054919061099e565b6001600160a01b038316600090815260208190526040902055600254610c3a9082610c87565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b505050565b600082821115610cde576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b5090039056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d4f77cf9c5d5cccd2d2e9e4d153e09cd070cb78b171b81c60d8decb097c008d364736f6c634300070600330000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9840000000000000000000000008ad599c3a0ff1de082011efddc58f1908eb6e6d8000000000000000000000000b9db5a37663d2004ea251281753aae75b30431d700000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000000886c98b7600000000000000000000000000000000000000000000000065a4da25d3016c0000000000000000000000000000000000000000000000000000000000da475abf0000000000000000000000000000000000000000000000000a2a15d09519be00000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063982010881161010f578063d3487997116100a2578063f7e8a53911610071578063f7e8a53914610411578063f95949be14610419578063fa461e331461042c578063fd3271411461043f576101f0565b8063d3487997146103c5578063e2bbb158146103d8578063ed064889146103eb578063f2fde38b146103fe576101f0565b8063bd7fa818116100de578063bd7fa81814610378578063c4a7761e1461038b578063c65b61ca146103a5578063d21220a7146103bd576101f0565b8063982010881461032c578063a3fbbaae1461033f578063ac1d060914610352578063ba0cb22b14610365576101f0565b8063554d2a84116101875780638dbdbe6d116101565780638dbdbe6d146102eb5780639270d81b146102fe57806393a98e6c14610311578063947f4ba614610319576101f0565b8063554d2a84146102b357806360d4c2a7146102c6578063715018a6146102db5780638da5cb5b146102e3576101f0565b80631ad8b03b116101c35780631ad8b03b146102645780633e7381521461027a578063441a3e701461028d578063551dcc82146102a0576101f0565b8063025196a6146101f557806309218e911461020a5780630dfe16811461022e57806311c0996514610243575b600080fd5b610208610203366004614f94565b610452565b005b610212610571565b604051610225979695949392919061596a565b60405180910390f35b6102366105c5565b6040516102259190615366565b610256610251366004614df5565b6105e9565b6040516102259291906159b6565b61026c610747565b604051610225929190615950565b610208610288366004614e93565b610761565b61025661029b366004615246565b610988565b6102086102ae366004615294565b610df7565b6102086102c1366004614df5565b610eb1565b6102ce611131565b60405161022591906154a1565b6102086111c9565b610236611287565b6102566102f9366004615267565b611296565b61025661030c366004615246565b6112df565b6102566112fc565b610256610327366004615246565b61142b565b61020861033a366004614f94565b611445565b61020861034d366004614df5565b6115ab565b610208610360366004614e11565b61168f565b610256610373366004614df5565b611789565b6102086103863660046152c5565b6118ce565b61039361192c565b604051610225969594939291906159df565b6103ad61198f565b60405161022594939291906159c4565b61023661199e565b6102086103d3366004615007565b6119c2565b6102566103e6366004615246565b611a65565b6102086103f9366004614f03565b611ab7565b61020861040c366004614df5565b611c79565b6102ce611d8d565b610208610427366004614e49565b611de8565b61020861043a366004615007565b611fd0565b61020861044d366004615214565b612179565b6001546001600160a01b031632146104855760405162461bcd60e51b815260040161047c90615583565b60405180910390fd5b60008360020b13801561049b575060008460020b135b6104b75760405162461bcd60e51b815260040161047c90615817565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819061055090888861221c565b92509250925082156105685761056882828787611445565b50505050505050565b600954600a546001600160801b0380831692600160801b900416906001600160a01b03811690600160a01b8104600290810b91600160b81b8104820b91600160d01b8204900b90600160e81b900460ff1687565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b60008060007f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce6001600160a01b03166370a08231856040518263ffffffff1660e01b815260040161063a9190615366565b60206040518083038186803b15801561065257600080fd5b505afa158015610666573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068a919061522e565b905060007f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c776001600160a01b03166370a08231866040518263ffffffff1660e01b81526004016106da9190615366565b60206040518083038186803b1580156106f257600080fd5b505afa158015610706573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072a919061522e565b90506107368282612383565b509399929850919650505050505050565b6008546001600160801b0380821691600160801b90041682565b6001546001600160a01b0316321461078b5760405162461bcd60e51b815260040161047c90615583565b6001600160a01b03851660009081526002602052604090205460ff166107c35760405162461bcd60e51b815260040161047c9061573b565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526003546108669082908590600160a81b900462ffffff16612520565b8060c00151801561088d5750856001600160a01b031681604001516001600160a01b031614155b6108a95760405162461bcd60e51b815260040161047c906155f1565b6108b16125de565b600060c08201526108c1826126b1565b6000866001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fc57600080fd5b505afa158015610910573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109349190614f78565b9050610941868683612706565b600080855260208501526001600160a01b0389166040850152600283810b810b60a086015281810b810b608086015282810b900b6060850152909650945061056882612746565b6000808315158061099857508215155b6109b45760405162461bcd60e51b815260040161047c906154de565b8315610a6257610a5f847f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce6001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610a0a9190615366565b60206040518083038186803b158015610a2257600080fd5b505afa158015610a36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5a919061522e565b6128cf565b93505b8215610abb57610ab8837f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c776001600160a01b03166370a08231336040518263ffffffff1660e01b8152600401610a0a9190615366565b92505b600080600080610acb8888612383565b955095505050935093506000881115610b5f57604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce1690639dc29fac90610b2c9033908c9060040161537a565b600060405180830381600087803b158015610b4657600080fd5b505af1158015610b5a573d6000803e3d6000fd5b505050505b8615610be657604051632770a7eb60e21b81526001600160a01b037f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c771690639dc29fac90610bb39033908b9060040161537a565b600060405180830381600087803b158015610bcd57600080fd5b505af1158015610be1573d6000803e3d6000fd5b505050505b600082118015610bff5750600a54600160e81b900460ff165b15610d11576040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c0820152600090610c97906128e9565b505050509050620186a0831015610ccb57620186a0610cb5846129e6565b82026001600160801b031681610cc757fe5b0490505b6000610cd78284612a01565b90506000811215610d0e578215610cfd57610cf6866000839003612ae2565b9550610d0e565b610d0b856000839003612ae2565b94505b50505b8315610d5957610d2384610a5a612b3f565b9350610d596001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48163386612bf1565b8215610da157610d6b83610a5a612c5d565b9250610da16001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2163385612bf1565b336001600160a01b03167fe08737ac48a1dab4b1a46c7dc9398bd5bfc6d7ad6fabb7cd8caa254de14def3589898787604051610de094939291906159c4565b60405180910390a2509193509150505b9250929050565b6001546001600160a01b03163214610e215760405162461bcd60e51b815260040161047c90615583565b604080516080810182526004548082526005546020830152600654928201929092526007546060820152908514610e56578481525b80602001518414610e6957602081018490525b80604001518314610e7c57604081018390525b80606001518214610e8f57606081018290525b8051600455602081015160055560408101516006556060015160075550505050565b610eb9612cc0565b6001600160a01b0316610eca611287565b6001600160a01b031614610f25576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b815260040161047c906158e2565b604080518082019091526008546001600160801b03808216808452600160801b9092041660208301526001101561102957805160405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48169163a9059cbb91610fd191869160001990910190600401615474565b602060405180830381600087803b158015610feb57600080fd5b505af1158015610fff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110239190614f5c565b50600181525b600181602001516001600160801b031611156110ef577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663a9059cbb8360018460200151036040518363ffffffff1660e01b8152600401611094929190615474565b602060405180830381600087803b1580156110ae57600080fd5b505af11580156110c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e69190614f5c565b50600160208201525b8051600880546020909301516001600160801b03908116600160801b029281166fffffffffffffffffffffffffffffffff199094169390931790921617905550565b60007f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c776001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118c57600080fd5b505afa1580156111a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c4919061522e565b905090565b6111d1612cc0565b6001600160a01b03166111e2611287565b6001600160a01b03161461123d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b336000908152600b6020526040812054819060ff166112c75760405162461bcd60e51b815260040161047c906157e0565b6112d2858585612cc4565b915091505b935093915050565b6000806112ec8484612383565b5093989297509195505050505050565b6003546040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff1615801560c0830152600092600160c81b900463ffffffff1691906114265760035460009081906113ba908490600160a01b900460ff1661301c565b9150915060006113cd8460400151613144565b905060006113f685600001516001600160801b031686602001516001600160801b0316846131e8565b905060006114058585856131e8565b905061141e8261141883620186a061320b565b90613264565b975050505050505b509091565b60008061143884846132cb565b5091969095509350505050565b6001546001600160a01b0316321461146f5760405162461bcd60e51b815260040161047c90615583565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a08201819052600160e81b90920460ff16151560c0820152906115069086908690612706565b80955081965050508460020b816060015160020b14801561153057508360020b816080015160020b145b1561153b57506115a5565b6003546115579082908590600160a81b900462ffffff16612520565b8060c0015115611571576115696125de565b600060c08201525b61157a826126b1565b60008082526020820152600284810b810b608083015285810b900b60608201526115a381612746565b505b50505050565b6115b3612cc0565b6001600160a01b03166115c4611287565b6001600160a01b03161461161f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166116455760405162461bcd60e51b815260040161047c906157a9565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f0afcbf7c3742ee20488a08c0da12ca29b2e8bdd022bef6129efbf4e00f84a63090600090a250565b611697612cc0565b6001600160a01b03166116a8611287565b6001600160a01b031614611703576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0382166117295760405162461bcd60e51b815260040161047c906158e2565b6001600160a01b0382166000818152600b602052604090819020805460ff1916841515179055517fc551bbb22d0406dbfb8b6b7740cc521bcf44e1106029cf899c19b6a8e4c99d519061177d908490615496565b60405180910390a25050565b6000807f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce6001600160a01b03166370a08231846040518263ffffffff1660e01b81526004016117d89190615366565b60206040518083038186803b1580156117f057600080fd5b505afa158015611804573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611828919061522e565b6040516370a0823160e01b81529092506001600160a01b037f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c7716906370a0823190611877908690600401615366565b60206040518083038186803b15801561188f57600080fd5b505afa1580156118a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c7919061522e565b9050915091565b6001546001600160a01b031632146118f85760405162461bcd60e51b815260040161047c90615583565b600a54600160e81b900460ff1615611920576119126125de565b600a805460ff60e81b191690555b611929816126b1565b50565b60008060008060008061193f6000613435565b929850909650945092508515611968576119608661141886620186a061320b565b620186a00391505b84156119875761197f8561141885620186a061320b565b620186a00390505b909192939495565b60045460055460065460075484565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3360009081526002602052604090205460ff166119f15760405162461bcd60e51b815260040161047c90615515565b8315611a2b57611a2b6001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48163386612bf1565b82156115a5576115a56001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2163385612bf1565b60008032331480611a855750336000908152600b602052604090205460ff165b611aa15760405162461bcd60e51b815260040161047c906157e0565b611aac848433612cc4565b915091509250929050565b6001546001600160a01b03163214611ae15760405162461bcd60e51b815260040161047c90615583565b60ff83161580611af4575060048360ff16115b611b105760405162461bcd60e51b815260040161047c90615696565b620186a08163ffffffff161115611b395760405162461bcd60e51b815260040161047c906156cd565b6001600160a01b03841615801590611b6957506001600160a01b03841660009081526002602052604090205460ff165b15611b8a57600380546001600160a01b0319166001600160a01b0386161790555b60035460ff848116600160a01b9092041614611bd457600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b60ff8616021790555b60035462ffffff838116600160a81b9092041614611c2257600380547fffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffff16600160a81b62ffffff8516021790555b60035463ffffffff828116600160c81b90920416146115a5576003805463ffffffff8316600160c81b027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff90911617905550505050565b611c81612cc0565b6001600160a01b0316611c92611287565b6001600160a01b031614611ced576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611d325760405162461bcd60e51b8152600401808060200182810382526026815260200180615a5b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60007f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561118c57600080fd5b6001546001600160a01b03163214611e125760405162461bcd60e51b815260040161047c90615583565b6001600160a01b03831660009081526002602052604090205460ff16611e4a5760405162461bcd60e51b815260040161047c90615628565b600a54600160e81b900460ff1615611e745760405162461bcd60e51b815260040161047c9061584e565b60008390506000816001600160a01b031663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b158015611eb457600080fd5b505afa158015611ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eec9190614f78565b9050611ef9848483612706565b6040805160e0810182526000808252602082018190526001600160a01b0399909916918101829052600293840b6060820181905292840b6080820181905294840b60a08201819052600160c090920191909152600998909855600a8054600160e81b6001600160a01b031990911690921762ffffff60a01b1916600160a01b93850b62ffffff908116949094021762ffffff60b81b1916600160b81b95850b8416959095029490941762ffffff60d01b1916600160d01b9890930b91909116969096021760ff60e81b191694909417909355505050565b6000841380611fdf5750600083135b611ffb5760405162461bcd60e51b815260040161047c9061565f565b6003546001600160a01b031633146120255760405162461bcd60e51b815260040161047c90615515565b60008413156120d05760405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48169063a9059cbb9061207c903390889060040161537a565b602060405180830381600087803b15801561209657600080fd5b505af11580156120aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ce9190614f5c565b505b60008313156115a55760405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2169063a9059cbb90612127903390879060040161537a565b602060405180830381600087803b15801561214157600080fd5b505af1158015612155573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a39190614f5c565b6001546001600160a01b031632146121a35760405162461bcd60e51b815260040161047c90615583565b8062ffffff16610bb814806121be57508062ffffff166101f4145b806121cf57508062ffffff16612710145b6121eb5760405162461bcd60e51b815260040161047c90615919565b60006121f682613581565b6001600160a01b03166000908152600260205260409020805460ff191660011790555050565b600080600080866040015190506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561226457600080fd5b505afa158015612278573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229c9190615183565b505050505091505060008860c001511561230257600060028a608001518b606001510160020b816122c957fe5b0590508860020b83820360020b126122e85760019650600191506122fc565b8860020b81840360020b126122fc57600196505b50612307565b600195505b85156123775780801561232f57508860a0015160020b8260020b8161232857fe5b0760020b15155b1561234b5760a0890151612343838261365f565b01915061235c565b612359828a60a0015161365f565b91505b61236a878a60a0015161365f565b9650868203945086820193505b50505093509350939050565b6000806000806000806000806123996000613435565b809850819950829450839550505050506124448a837f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561240757600080fd5b505afa15801561241b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243f919061522e565b6136ab565b97506124a489827f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c776001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561240757600080fd5b9650600080878a11156124d4576124d16124be8b8a612ae2565b620186a06124cc878c612ae2565b6136c6565b91505b868911156124fa576124f76124e98a89612ae2565b620186a06124cc868b612ae2565b90505b80821061250657600194505b6125108282613775565b9550505050509295509295509295565b6000836040015190506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561256457600080fd5b505afa158015612578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259c9190615183565b50505050509150508260020b84820360020b1280156125c257508260020b81850360020b125b6115a35760405162461bcd60e51b815260040161047c90615704565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819081906126779061378c565b935093509350935060008061268c84846137e4565b909250905061056861269e8784612ae2565b6126a88784612ae2565b60006001613923565b60328160ff16101580156126c9575060968160ff1611155b15611929576003805460ff8316600160c01b027fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff90911617905550565b600080612713858461365f565b915061271f848461365f565b90508460020b8460020b136112d75760405162461bcd60e51b815260040161047c906158ab565b6000612750612b3f565b9050600061275c612c5d565b905060008211801561276e5750600081115b156127e15761277e838383613ca0565b90925090506127a061278f836129e6565b84516001600160801b031690613d69565b6001600160801b031683526127cb6127b7826129e6565b60208501516001600160801b031690613d69565b6001600160801b03166020840152600160c08401525b505080516009805460208401516001600160801b03908116600160801b029381166fffffffffffffffffffffffffffffffff1990921691909117169190911790556040810151600a80546060840151608085015160a086015160c0909601511515600160e81b0260ff60e81b19600297880b62ffffff908116600160d01b0262ffffff60d01b19948a0b8216600160b81b0262ffffff60b81b1996909a0b909116600160a01b0262ffffff60a01b196001600160a01b039099166001600160a01b03199097169690961797909716949094179290921695909517949094169290921791909116919091179055565b6000818311156128e05750806128e3565b50815b92915050565b6000806000806000808660400151905060003088606001518960800151604051602001612918939291906152e1565b60408051601f198184030181529082905280516020909101207f514ea4bf00000000000000000000000000000000000000000000000000000000825291506001600160a01b0383169063514ea4bf906129759084906004016154a1565b60a06040518083038186803b15801561298d57600080fd5b505afa1580156129a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c5919061512d565b939c929b509099506001600160801b03908116985090911695509350505050565b60006001600160801b038211156129f957fe5b50805b919050565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819081908190612a9d9088613dcf565b9350935093509350600080612ab284846137e4565b9092509050612ad5612ac48784612ae2565b612ace8784612ae2565b8b8b613923565b9998505050505050505050565b600082821115612b39576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6008546040516370a0823160e01b81526000916001600160801b0316906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816906370a0823190612b9b903090600401615366565b60206040518083038186803b158015612bb357600080fd5b505afa158015612bc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612beb919061522e565b03905090565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052612c58908490613e09565b505050565b6008546040516370a0823160e01b8152600091600160801b90046001600160801b0316907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906370a0823190612b9b903090600401615366565b3390565b6000806000851180612cd65750600084115b612cf25760405162461bcd60e51b815260040161047c906155ba565b60408051608081018252600454815260055460208201526006549181018290526007546060820152908611801590612d2e575080606001518511155b612d4a5760405162461bcd60e51b815260040161047c9061554c565b600080612d5788886132cb565b865193985091965093509150612d6d838a613eba565b11158015612d8857506020830151612d858289613eba565b11155b612da45760405162461bcd60e51b815260040161047c90615772565b8715612ddf57612ddf6001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481633308b613f14565b8615612e1a57612e1a6001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21633308a613f14565b8415612ea1576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce16906340c10f1990612e6e908990899060040161537a565b600060405180830381600087803b158015612e8857600080fd5b505af1158015612e9c573d6000803e3d6000fd5b505050505b8315612f28576040516340c10f1960e01b81526001600160a01b037f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c7716906340c10f1990612ef5908990889060040161537a565b600060405180830381600087803b158015612f0f57600080fd5b505af1158015612f23573d6000803e3d6000fd5b505050505b600a54600160e81b900460ff1615612fca576040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c0820152612fca90612746565b856001600160a01b03167f7162984403f6c73c8639375d45a9187dfd04602231bd8e587c415718b5f7e5f986868b8b60405161300994939291906159c4565b60405180910390a2505050935093915050565b60408201516000908190818080613032886128e9565b50509250925092506000846001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561307557600080fd5b505afa158015613089573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ad9190615183565b50505050505090506130d9816130c68b60600151613f9c565b6130d38c60800151613f9c565b876142ea565b90975095506000806130ed8b878787614386565b9981019998890198909250905060ff8a16156131365761311a6131138360ff8d16613264565b8a90612ae2565b985061313361312c8260ff8d16613264565b8990612ae2565b97505b505050505050509250929050565b600080826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561318057600080fd5b505afa158015613194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b89190615183565b50505050505090506131e1816001600160a01b0316826001600160a01b0316600160601b6136c6565b9392505050565b6000613203836131fd8685600160601b6136c6565b90613eba565b949350505050565b60008261321a575060006128e3565b8282028284828161322757fe5b04146131e15760405162461bcd60e51b8152600401808060200182810382526021815260200180615aa76021913960400191505060405180910390fd5b60008082116132ba576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816132c357fe5b049392505050565b6000806000806132db6001613435565b905050809250819350505060007f000000000000000000000000fa87309a4ce6321ed385ace4b5052b546a2c83ce6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561334157600080fd5b505afa158015613355573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613379919061522e565b905060007f000000000000000000000000c184999124f15d6463ab3467811159e2bc095c776001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156133d657600080fd5b505afa1580156133ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061340e919061522e565b905061341b8883866136ab565b95506134288782856136ab565b9450505092959194509250565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b03811692820192909252600160a01b8204600290810b810b810b6060830152600160b81b8304810b810b810b6080830152600160d01b8304810b810b900b60a0820152600160e81b90910460ff16151560c08201526000908190819081906134cd612b3f565b92506134d7612c5d565b91508294508193508060c0015115613579576003546000908190613506908490600160a01b900460ff1661301c565b9150915060008211806135195750600081115b1561357657600061352d8460400151613144565b905061355784600001516001600160801b031685602001516001600160801b03168585858e6143dc565b90935091506135668884613eba565b97506135728783613eba565b9650505b50505b509193509193565b60007f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9847f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb487f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2846040516020016135f993929190615393565b60408051601f19818403018152908290528051602091820120613641939290917fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b549101615316565b60408051601f19818403018152919052805160209091012092915050565b6000808260020b8460020b8161367157fe5b05905060008460020b12801561369857508260020b8460020b8161369157fe5b0760020b15155b156136a257600019015b90910292915050565b600083156131e157826136bf5750826131e1565b6132038484845b60008080600019858709868602925082811090839003039050806136fc57600084116136f157600080fd5b5082900490506131e1565b80841161370857600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6000818311156137865750816128e3565b50919050565b600080600080600061379d866128e9565b505050509050806001600160801b0316600014156137c9576000806000809450945094509450506137dd565b6137d38682613dcf565b9450945094509450505b9193509193565b6003546000908190600160a01b900460ff16801561391b57604080518082019091526008546001600160801b038082168352600160801b909104166020820152851561385f576138348683613264565b9350613853613842856129e6565b82516001600160801b031690613d69565b6001600160801b031681525b84156138a05761386f8583613264565b925061389161387d846129e6565b60208301516001600160801b031690613d69565b6001600160801b031660208201525b80516008805460208401516001600160801b03908116600160801b029381166fffffffffffffffffffffffffffffffff1990921691909117169190911790556040517f5393ab6ef9bb40d91d1b04bbbeb707fbf3d1eb73f46744e2d179e4996026283f9061391190889088906159b6565b60405180910390a1505b509250929050565b600084158015613931575083155b1561393e57506000613203565b6040805160e0810182526009546001600160801b038082168352600160801b909104166020820152600a546001600160a01b038116928201839052600160a01b8104600290810b810b810b6060840152600160b81b8204810b810b810b6080840152600160d01b8204810b810b900b60a0830152600160e81b900460ff16151560c0820152906000906139d090613144565b825160208401519192506001600160801b0390811691811690871615613b505760006139fb856128e9565b505050509050613a2083896001600160801b03168a84016001600160801b03166136c6565b9250613a4182896001600160801b03168a84016001600160801b03166136c6565b9150613a4c836129e6565b8551036001600160801b03168552613a63826129e6565b6020860180516001600160801b03929003821690819052865160098054600160801b9093029184166fffffffffffffffffffffffffffffffff1990931692909217909216919091179055506040840151600a80546060870151608088015160a089015160c08a01511515600160e81b0260ff60e81b19600292830b62ffffff908116600160d01b0262ffffff60d01b1995850b8216600160b81b0262ffffff60b81b199790950b909116600160a01b0262ffffff60a01b196001600160a01b03909a166001600160a01b031990981697909717989098169590951793909316171693909317169190911790555b600080613b6284848d8d8960006143dc565b915091506000808915613b8b57828c0391506000821215613b81575060015b838d039850613ba3565b838d0391506000821315613b9d575060015b828c0398505b8115613c9057600081613bca5773fffd8963efd1fc6a506488495d951d5263988d25613bd1565b6401000276a45b6003546040517f128acb0800000000000000000000000000000000000000000000000000000000815291925060009182916001600160a01b03169063128acb0890613c2690309088908a9089906004016153bb565b6040805180830381600087803b158015613c3f57600080fd5b505af1158015613c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c779190614fe4565b915091508c613c865780613c88565b815b8c039b505050505b5050505050505050949350505050565b6000806000856040015190506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015613ce757600080fd5b505afa158015613cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1f9190615183565b50505050505090506000613d4e82613d3a8a60600151613f9c565b613d478b60800151613f9c565b8a8a6144fa565b9050613d5a88826145be565b90999098509650505050505050565b60008282016001600160801b0380851690821610156131e1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600080600080613ddf8686614661565b9092509050613df786306001600160801b03806146bc565b90979096509187039450850392509050565b6000613e5e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661476e9092919063ffffffff16565b805190915015612c5857808060200190516020811015613e7d57600080fd5b5051612c585760405162461bcd60e51b815260040180806020018281038252602a815260200180615ac8602a913960400191505060405180910390fd5b6000828201838110156131e1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526115a5908590613e09565b60008060008360020b12613fb3578260020b613fbb565b8260020b6000035b9050620d89e8811115614015576040805162461bcd60e51b815260206004820152600160248201527f5400000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006001821661402957600160801b61403b565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561406f576ffff97272373d413259a46990580e213a0260801c5b600482161561408e576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b60088216156140ad576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156140cc576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156140eb576fff973b41fa98c081472e6896dfb254c00260801c5b604082161561410a576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615614129576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615614149576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615614169576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615614189576ff3392b0822b70005940c7a398e4b70f30260801c5b6108008216156141a9576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156141c9576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156141e9576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615614209576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615614229576f31be135f97d08fd981231505542fcfa60260801c5b6201000082161561424a576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561426a576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615614289576d2216e584f5fa1ea926041bedfe980260801c5b620800008216156142a6576b048a170391f7dc42444e8fa20260801c5b60008460020b13156142c15780600019816142bd57fe5b0490505b6401000000008106156142d55760016142d8565b60005b60ff16602082901c0192505050919050565b600080836001600160a01b0316856001600160a01b0316111561430b579293925b846001600160a01b0316866001600160a01b0316116143365761432f85858561477d565b915061437d565b836001600160a01b0316866001600160a01b0316101561436f5761435b86858561477d565b91506143688587856147e6565b905061437d565b61437a8585856147e6565b90505b94509492505050565b60008060008061439588614829565b915091506143b3868303886001600160801b0316600160801b6136c6565b93506143cf858203886001600160801b0316600160801b6136c6565b9250505094509492505050565b60008060006143ec8989876131e8565b905060006143fb8888886131e8565b905060006144108361141884620186a061320b565b905085801561442d5750600354600160c81b900463ffffffff1681105b156144445750600354600160c81b900463ffffffff165b620186a0811180156144635750600354600160c01b900460ff16606414155b156144cb5760035461449990620186a0906131fd9060649061141890600160c01b900460ff166144938786612ae2565b9061320b565b90506144a98b82620186a06136c6565b94506144c46144bd8689600160601b6136c6565b8390612ae2565b93506144ec565b6144d98b82620186a06136c6565b94506144e98a82620186a06136c6565b93505b505050965096945050505050565b6000836001600160a01b0316856001600160a01b0316111561451a579293925b846001600160a01b0316866001600160a01b0316116145455761453e8585856148b7565b90506145b5565b836001600160a01b0316866001600160a01b031610156145a757600061456c8786866148b7565b9050600061457b87898661491a565b9050806001600160801b0316826001600160801b03161061459c578061459e565b815b925050506145b5565b6145b285858461491a565b90505b95945050505050565b600080600084604001519050806001600160a01b0316633c8a7d8d3087606001518860800151886040518563ffffffff1660e01b815260040161460494939291906153f5565b6040805180830381600087803b15801561461d57600080fd5b505af1158015614631573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146559190614fe4565b90969095509350505050565b6040808301516060840151608085015192517fa34123a70000000000000000000000000000000000000000000000000000000081526000938493926001600160a01b0384169263a34123a792614604929189906004016154b8565b600080600086604001519050806001600160a01b0316634f1eb3d88789606001518a6080015189896040518663ffffffff1660e01b8152600401614704959493929190615437565b6040805180830381600087803b15801561471d57600080fd5b505af1158015614731573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061475591906150fb565b6001600160801b03918216999116975095505050505050565b60606132038484600085614957565b6000826001600160a01b0316846001600160a01b0316111561479d579192915b836001600160a01b03166147d6606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166136c6565b816147dd57fe5b04949350505050565b6000826001600160a01b0316846001600160a01b03161115614806579192915b613203826001600160801b03168585036001600160a01b0316600160601b6136c6565b6040810151600090819081808061483f84614ab2565b925092509250600080614856868a60600151614c27565b91509150886060015160020b8560020b1215614873579083039082035b600080614884888c60800151614c27565b915091508a6080015160020b8760020b126148a0579085039084035b929094039390930396509190030392505050915091565b6000826001600160a01b0316846001600160a01b031611156148d7579192915b60006148fa856001600160a01b0316856001600160a01b0316600160601b6136c6565b90506145b561491584838888036001600160a01b03166136c6565b614cb9565b6000826001600160a01b0316846001600160a01b0316111561493a579192915b61320361491583600160601b8787036001600160a01b03166136c6565b6060824710156149985760405162461bcd60e51b8152600401808060200182810382526026815260200180615a816026913960400191505060405180910390fd5b6149a185614ccf565b6149f2576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310614a305780518252601f199092019160209182019101614a11565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614a92576040519150601f19603f3d011682016040523d82523d6000602084013e614a97565b606091505b5091509150614aa7828286614cd5565b979650505050505050565b600080600080846001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015614af157600080fd5b505afa158015614b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b299190615183565b50505050509150506000856001600160a01b031663f30583996040518163ffffffff1660e01b815260040160206040518083038186803b158015614b6c57600080fd5b505afa158015614b80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ba4919061522e565b90506000866001600160a01b031663461413196040518163ffffffff1660e01b815260040160206040518083038186803b158015614be157600080fd5b505afa158015614bf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614c19919061522e565b929791965091945092505050565b600080836001600160a01b031663f30dba93846040518263ffffffff1660e01b8152600401614c5691906154aa565b6101006040518083038186803b158015614c6f57600080fd5b505afa158015614c83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ca79190615058565b50939a92995091975050505050505050565b806001600160801b03811681146129fc57600080fd5b3b151590565b60608315614ce45750816131e1565b825115614cf45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614d3e578181015183820152602001614d26565b50505050905090810190601f168015614d6b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60008083601f840112614d8a578182fd5b50813567ffffffffffffffff811115614da1578182fd5b602083019150836020828501011115610df057600080fd5b80516001600160801b03811681146129fc57600080fd5b805161ffff811681146129fc57600080fd5b803562ffffff811681146129fc57600080fd5b600060208284031215614e06578081fd5b81356131e181615a07565b60008060408385031215614e23578081fd5b8235614e2e81615a07565b91506020830135614e3e81615a1c565b809150509250929050565b600080600060608486031215614e5d578081fd5b8335614e6881615a07565b92506020840135614e7881615a2a565b91506040840135614e8881615a2a565b809150509250925092565b600080600080600060a08688031215614eaa578081fd5b8535614eb581615a07565b94506020860135614ec581615a2a565b93506040860135614ed581615a2a565b92506060860135614ee581615a2a565b91506080860135614ef581615a4b565b809150509295509295909350565b60008060008060808587031215614f18578384fd5b8435614f2381615a07565b93506020850135614f3381615a4b565b9250614f4160408601614de2565b91506060850135614f5181615a39565b939692955090935050565b600060208284031215614f6d578081fd5b81516131e181615a1c565b600060208284031215614f89578081fd5b81516131e181615a2a565b60008060008060808587031215614fa9578182fd5b8435614fb481615a2a565b93506020850135614fc481615a2a565b92506040850135614fd481615a2a565b91506060850135614f5181615a4b565b60008060408385031215614ff6578182fd5b505080516020909101519092909150565b6000806000806060858703121561501c578182fd5b8435935060208501359250604085013567ffffffffffffffff811115615040578283fd5b61504c87828801614d79565b95989497509550505050565b600080600080600080600080610100898b031215615074578586fd5b61507d89614db9565b9750602089015180600f0b8114615092578687fd5b80975050604089015195506060890151945060808901518060060b81146150b7578384fd5b60a08a01519094506150c881615a07565b60c08a01519093506150d981615a39565b60e08a01519092506150ea81615a1c565b809150509295985092959890939650565b6000806040838503121561510d578182fd5b61511683614db9565b915061512460208401614db9565b90509250929050565b600080600080600060a08688031215615144578283fd5b61514d86614db9565b9450602086015193506040860151925061516960608701614db9565b915061517760808701614db9565b90509295509295909350565b600080600080600080600060e0888a03121561519d578081fd5b87516151a881615a07565b60208901519097506151b981615a2a565b95506151c760408901614dd0565b94506151d560608901614dd0565b93506151e360808901614dd0565b925060a08801516151f381615a4b565b60c089015190925061520481615a1c565b8091505092959891949750929550565b600060208284031215615225578081fd5b6131e182614de2565b60006020828403121561523f578081fd5b5051919050565b60008060408385031215615258578182fd5b50508035926020909101359150565b60008060006060848603121561527b578081fd5b83359250602084013591506040840135614e8881615a07565b600080600080608085870312156152a9578182fd5b5050823594602084013594506040840135936060013592509050565b6000602082840312156152d6578081fd5b81356131e181615a4b565b60609390931b6bffffffffffffffffffffffff19168352600291820b60e890811b6014850152910b901b6017820152601a0190565b7fff00000000000000000000000000000000000000000000000000000000000000815260609390931b6bffffffffffffffffffffffff191660018401526015830191909152603582015260550190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b03938416815291909216602082015262ffffff909116604082015260600190565b6001600160a01b03948516815292151560208401526040830191909152909116606082015260a06080820181905260009082015260c00190565b6001600160a01b03949094168452600292830b6020850152910b60408301526001600160801b0316606082015260a06080820181905260009082015260c00190565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6001600160a01b039290921682526001600160801b0316602082015260400190565b901515815260200190565b90815260200190565b60029190910b815260200190565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b60208082526014908201527f5769746864726177205a65726f20536861726521000000000000000000000000604082015260600190565b6020808252600d908201527f77726f6e67206164647265737300000000000000000000000000000000000000604082015260600190565b60208082526011908201527f546f6f204d756368204465706f73697421000000000000000000000000000000604082015260600190565b60208082526002908201527f4f4d000000000000000000000000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f4465706f736974205a65726f2100000000000000000000000000000000000000604082015260600190565b60208082526014908201527f43414e204e4f54204348414e474520504f4f4c21000000000000000000000000604082015260600190565b6020808252600e908201527f61646420506f6f6c204669727374000000000000000000000000000000000000604082015260600190565b60208082526004908201527f5a65726f00000000000000000000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f323050657263656e74204d415821000000000000000000000000000000000000604082015260600190565b60208082526013908201527f57726f6e672073616665747920706172616d2100000000000000000000000000604082015260600190565b60208082526009908201527f44494646205449434b0000000000000000000000000000000000000000000000604082015260600190565b6020808252600f908201527f41646420506f6f6c204669727374210000000000000000000000000000000000604082015260600190565b60208082526012908201527f65786365656420746f74616c206c696d69740000000000000000000000000000604082015260600190565b6020808252600c908201527f5a45524f20414444524553530000000000000000000000000000000000000000604082015260600190565b6020808252601b908201527f6f6e6c7920666f7220766572696669656420636f6e7472616374210000000000604082015260600190565b6020808252600b908201527f42616420706172616d7321000000000000000000000000000000000000000000604082015260600190565b60208082526021908201527f706f736974696f6e20697320776f726b696e672c2063616e6e6f7420696e697460408201527f2100000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526009908201527f426164205469636b730000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f6172000000000000000000000000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f57726f6e6720706f6f6c46656521000000000000000000000000000000000000604082015260600190565b6001600160801b0392831681529116602082015260400190565b6001600160801b0397881681529590961660208601526001600160a01b03939093166040850152600291820b6060850152810b60808401520b60a082015290151560c082015260e00190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b6001600160a01b038116811461192957600080fd5b801515811461192957600080fd5b8060020b811461192957600080fd5b63ffffffff8116811461192957600080fd5b60ff8116811461192957600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220d38296fbc8c2294647e9fbd8575d0783fc7b657af3f3f41b75642766b5fe0b9064736f6c63430007060033

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

0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9840000000000000000000000008ad599c3a0ff1de082011efddc58f1908eb6e6d8000000000000000000000000b9db5a37663d2004ea251281753aae75b30431d700000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000012c0000000000000000000000000000000000000000000000000000886c98b7600000000000000000000000000000000000000000000000065a4da25d3016c0000000000000000000000000000000000000000000000000000000000da475abf0000000000000000000000000000000000000000000000000a2a15d09519be00000

-----Decoded View---------------
Arg [0] : _uniFactory (address): 0x1F98431c8aD98523631AE4a59f267346ea31F984
Arg [1] : _poolAddress (address): 0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8
Arg [2] : _operator (address): 0xB9db5a37663d2004ea251281753aAe75b30431D7
Arg [3] : _swapPool (address): 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640
Arg [4] : _performanceFee (uint8): 10
Arg [5] : _diffTick (uint24): 300
Arg [6] : _maxToken0 (uint256): 150000000000000
Arg [7] : _maxToken1 (uint256): 30000000000000000000000
Arg [8] : _maxSingeDepositAmt0 (uint256): 15000000000000
Arg [9] : _maxSingeDepositAmt1 (uint256): 3000000000000000000000

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984
Arg [1] : 0000000000000000000000008ad599c3a0ff1de082011efddc58f1908eb6e6d8
Arg [2] : 000000000000000000000000b9db5a37663d2004ea251281753aae75b30431d7
Arg [3] : 00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [5] : 000000000000000000000000000000000000000000000000000000000000012c
Arg [6] : 0000000000000000000000000000000000000000000000000000886c98b76000
Arg [7] : 00000000000000000000000000000000000000000000065a4da25d3016c00000
Arg [8] : 00000000000000000000000000000000000000000000000000000da475abf000
Arg [9] : 0000000000000000000000000000000000000000000000a2a15d09519be00000


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
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.