ETH Price: $3,390.96 (+4.07%)

Contract

0x7f5C649856F900d15C83741f45AE46f5C6858234
 
Transaction Hash
Method
Block
From
To
Collect214667992024-12-23 17:53:357 hrs ago1734976415IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0037316514.35874151
Collect214548732024-12-22 1:52:2347 hrs ago1734832343IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.001423915.78722406
Collect214291192024-12-18 11:28:115 days ago1734521291IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0042444320.0533635
Collect214272222024-12-18 5:06:355 days ago1734498395IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0025747911.48647737
Collect213879202024-12-12 17:28:2311 days ago1734024503IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0059498223.93783428
Collect213747452024-12-10 21:19:2313 days ago1733865563IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0053809623.72718556
Collect213747432024-12-10 21:18:5913 days ago1733865539IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0055127223.01907121
Collect213451812024-12-06 18:14:5917 days ago1733508899IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0066035628.86715152
Withdraw213441432024-12-06 14:46:3517 days ago1733496395IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.006152525.31333863
Collect213441372024-12-06 14:45:2317 days ago1733496323IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0069702726.54039124
Collect213199632024-12-03 5:43:2320 days ago1733204603IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0033590714.68402002
Collect212883022024-11-28 19:31:5925 days ago1732822319IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0025984312.27665475
Withdraw212831992024-11-28 2:15:4725 days ago1732760147IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0039956410.45964337
Collect212763852024-11-27 3:24:4726 days ago1732677887IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.001847318.35520119
Collect212721032024-11-26 13:04:4727 days ago1732626287IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0032973513.26621357
Collect212713222024-11-26 10:27:2327 days ago1732616843IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.002105778.75710717
Collect212713192024-11-26 10:26:4727 days ago1732616807IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.002193969.16116387
Collect212352412024-11-21 9:34:3532 days ago1732181675IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.002986212.14610026
Collect212188922024-11-19 2:48:5934 days ago1731984539IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.002317029.41712023
Withdraw212157332024-11-18 16:15:3535 days ago1731946535IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0095104826.20754848
Withdraw211815532024-11-13 21:47:3540 days ago1731534455IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0178585849.51874299
Collect211801742024-11-13 17:10:3540 days ago1731517835IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.018974274.9479963
Collect211642222024-11-11 11:43:5942 days ago1731325439IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0039415416.73622693
Relock211581302024-11-10 15:20:5943 days ago1731252059IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.0014135727.09135581
Collect211554362024-11-10 6:20:4743 days ago1731219647IN
UNCX Network Lockers: V3 Proof of Reserves 2
0 ETH0.003801915.46389883
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UNCX_ProofOfReservesV2_UniV3

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 25 : UNCX_ProofOfReservesV2_UniV3.sol
// SPDX-License-Identifier: UNLICENSED
// ALL RIGHTS RESERVED
// UNCX by SDDTech reserves all rights on this code. You may not copy these contracts.

pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";

import './uniswap-updated/TickMath.sol';
import './uniswap-updated/LiquidityAmounts.sol';
import "./uniswap-updated/INonfungiblePositionManager.sol";
import "./ICountryList.sol";
import "./IMigrateV3NFT.sol";
import "./IUNCX_ProofOfReservesV2_UniV3.sol";

/*
    Version 2.0
    
    The UNCX Proof of Reserves V3 Contract locks any exact fork of Uniswap V3's liquidity NFT's in this contract.
    Proof of reserves means a user is aware that a pools liquidity cannot be removed until the time lock expires.
    Proof of reserves prevents hacks of founders wallets from comprimising this important aspect of their tokens ecosystem.

    Since liquidity means so much to all ecosystem participants, this contract converts a UniV3 position to full range, from the absolute 
    minimum lowerTick to the absolute maximum upperTick, creating a reliable pool where tokens will be tradeable at any price.

    Lock owners are still free to collect fees as they please, and add liquidity to their position, while the liquidity remains locked.

    You can also still view your NFT and its metrics on uniswap while it is locked. e.g. https://app.uniswap.org/#/pools/69
*/

interface IFeeResolver {
    function useFee(bytes[] memory r, address sender) external returns (IUNCX_ProofOfReservesV2_UniV3.FeeStruct memory fee);
}

contract UNCX_ProofOfReservesV2_UniV3 is IUNCX_ProofOfReservesV2_UniV3, Ownable2Step, IERC721Receiver, ReentrancyGuard {
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableSet for EnumerableSet.Bytes32Set;

    mapping(bytes32 => FeeStruct) private FEES; // map keccak(fee_name) to fee struct e.g. keccak256("DEFAULT") => FeeStruct
    EnumerableSet.Bytes32Set private FEE_LOOKUP; // contains keccak(feeName)

    IFeeResolver public FEE_RESOLVER; // Resolve R fees

    address public AUTO_COLLECT_ACCOUNT; // account controlled by UNCX to auto collect fees if a fee option involving collection fees was accepted
    address payable public FEE_ADDR_LP; // LP fee destination
    address payable public FEE_ADDR_COLLECT; // collect fee destination
    uint256 public constant FEE_DENOMINATOR = 10000; // denominator for all fees

    ICountryList public COUNTRY_LIST;
    IMigrateV3NFT public MIGRATOR; // migrate to future amm versions while liquidity remains locked
    address public MIGRATE_IN; // address of the migration in contract
    uint256 public NONCE = 0; // incremental lock nonce counter, this is the unique ID for the next lock

    // If a locks unlock date is set to ETERNAL_LOCK the lock is eternal and not ever withdrawable.
    // It can however be migrated by the owner to future AMMS and is therefore preferrable to burning liquidity, or sending liquidity NFT's to the dead address.
    uint256 public ETERNAL_LOCK = type(uint256).max;

    // a mapping of lock_id => Lock
    mapping(uint256 => Lock) public LOCKS;

    mapping(address => EnumerableSet.UintSet) USER_LOCKS; // a set of all lock_ids owned by a user, useful for on chain enumeration.

    constructor(ICountryList _countryList, address payable _autoCollectAddress, address payable _lpFeeReceiver, address payable _collectFeeReceiver) {
        COUNTRY_LIST = _countryList;
        AUTO_COLLECT_ACCOUNT = _autoCollectAddress;
        FEE_ADDR_LP = _lpFeeReceiver;
        FEE_ADDR_COLLECT = _collectFeeReceiver;
        addOrEditFee("DEFAULT", 50, 200, 0, address(0));
        addOrEditFee("LVP", 80, 100, 0, address(0));
        addOrEditFee("LLP", 30, 350, 0, address(0));
    }

    function setFeeResolver (IFeeResolver _resolver) external onlyOwner {
        FEE_RESOLVER = _resolver;
    }

    function setFeeParams (address _autoCollectAccount, address payable _lpFeeReceiver, address payable _collectFeeReceiver) external onlyOwner {
        AUTO_COLLECT_ACCOUNT = _autoCollectAccount;
        FEE_ADDR_LP = _lpFeeReceiver;
        FEE_ADDR_COLLECT = _collectFeeReceiver;
    }

    function addOrEditFee(string memory _name, uint256 _lpFee, uint256 _collectFee, uint256 _flatFee, address _flatFeeToken) public onlyOwner {
        bytes32 nameHash = keccak256(abi.encodePacked(_name));

        FeeStruct memory newFee = FeeStruct(_name, _lpFee, _collectFee, _flatFee, _flatFeeToken);
        FEES[nameHash] = newFee;

        if (!FEE_LOOKUP.contains(nameHash)) {
            FEE_LOOKUP.add(nameHash);
            emit onAddFee(nameHash, newFee.name, newFee.lpFee, newFee.collectFee, newFee.flatFee, newFee.flatFeeToken);
        } else {
            emit onEditFee(nameHash, newFee.name, newFee.lpFee, newFee.collectFee, newFee.flatFee, newFee.flatFeeToken);
        }
    }

    function removeFee (string memory _name) external onlyOwner {
        bytes32 nameHash = keccak256(abi.encodePacked(_name));
        require(nameHash != keccak256(abi.encodePacked("DEFAULT")), "DEFAULT");
        require(FEE_LOOKUP.contains(nameHash));
        FEE_LOOKUP.remove(nameHash);
        emit onRemoveFee(nameHash);
    }

    function getFee (string memory _name) public override view returns (FeeStruct memory) {
        bytes32 feeHash = keccak256(abi.encodePacked(_name));
        require(FEE_LOOKUP.contains(feeHash), "NOT FOUND");
        return FEES[feeHash];
    }

    function getFeeOptionAtIndex (uint256 _index) external view returns (FeeStruct memory) {
        return FEES[FEE_LOOKUP.at(_index)];
    }

    function getFeeOptionLength () external view returns (uint256) {
        return FEE_LOOKUP.length();
    }

    function deductFlatFee (FeeStruct memory fee) private {
        if (fee.flatFeeToken == address(0)) { // fee in gas token
            require(msg.value == fee.flatFee, 'FLAT FEE');
            FEE_ADDR_LP.transfer(fee.flatFee);
        } else { // fee in another token
            TransferHelper.safeTransferFrom(fee.flatFeeToken, msg.sender, FEE_ADDR_LP, fee.flatFee);
        }
    }

    /**
    @dev converts nft to full range and collects fees and sends them back to collector
    @param params The locking params as seen in IUNCX_ProofOfReservesV3.sol
    *
    * This function will fail if a liquidity position is out of range (100% token0, 0% token1) as it will not be able to create a full range position with counter liquidity.
    * This will also fail with rebasing tokens (liquidity nfts already stuck on univ3).
    */
    function lock (LockParams calldata params) external payable override nonReentrant returns (uint256) {
        require(params.owner != address(0));
        require(params.collectAddress != address(0), 'COLLECT_ADDR');
        require(params.unlockDate < 1e10 || params.unlockDate == ETERNAL_LOCK, 'MILLISECONDS'); // prevents errors when timestamp entered in milliseconds
        require(params.unlockDate > block.timestamp, 'DATE PASSED');
        require(COUNTRY_LIST.countryIsValid(params.countryCode), 'COUNTRY');
        FeeStruct memory fee;

        if (msg.sender == MIGRATE_IN) {
            fee.collectFee = abi.decode(params.r[0], (uint256));
        } else {
            if (params.r.length > 0) {
                fee = FEE_RESOLVER.useFee(params.r, msg.sender);
            } else {
                fee = getFee(params.feeName);
            }

            if (fee.flatFee > 0) {
                deductFlatFee(fee);
            }
        }

        params.nftPositionManager.safeTransferFrom(msg.sender, address(this), params.nft_id);

        INonfungiblePositionManager.Position memory position;
        (,,position.token0,position.token1,position.fee,position.tickLower,position.tickUpper,position.liquidity,,,,) = params.nftPositionManager.positions(params.nft_id);
        IUniswapV3Factory factory = IUniswapV3Factory(params.nftPositionManager.factory());
        address pool = factory.getPool(position.token0, position.token1, position.fee);
        int24 maxTick = tickSpacingToMaxTick(factory.feeAmountTickSpacing(position.fee));

        uint256 nftId;
        if (position.tickLower != -maxTick && position.tickUpper != maxTick) {
            // convert the position to full range by minting a new full range NFT
            nftId = _convertPositionToFullRange(params.nftPositionManager, params.nft_id, position, maxTick, params.dustRecipient);
        } else {
            nftId = params.nft_id;
            // collect fees for user to prevent being charged a fee on existing fees
            params.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(nftId, params.dustRecipient, type(uint128).max, type(uint128).max));
        }

        // Take lp fee
        if (fee.lpFee > 0) {
            uint128 liquidity = _getLiquidity(params.nftPositionManager, nftId);
            params.nftPositionManager.decreaseLiquidity(INonfungiblePositionManager.DecreaseLiquidityParams(nftId, uint128(liquidity * fee.lpFee / FEE_DENOMINATOR), 0, 0, block.timestamp));
            params.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(nftId, FEE_ADDR_LP, type(uint128).max, type(uint128).max));
        }

        Lock memory newLock;
        newLock.lock_id = NONCE;
        newLock.nftPositionManager = params.nftPositionManager;
        newLock.pool = pool;
        newLock.nft_id = nftId;
        newLock.owner = params.owner;
        newLock.additionalCollector = params.additionalCollector;
        newLock.collectAddress = params.collectAddress;
        newLock.unlockDate = params.unlockDate;
        newLock.countryCode = params.countryCode;
        newLock.ucf = fee.collectFee;
        LOCKS[NONCE] = newLock;
        USER_LOCKS[params.owner].add(NONCE);
        NONCE++;

        emitLockEvent(newLock.lock_id);

        return newLock.lock_id;
    }

    function emitLockEvent (uint256 _lockId) private {
        Lock memory newLock = LOCKS[_lockId];
        INonfungiblePositionManager.Position memory position;
        (,,position.token0,position.token1,position.fee,position.tickLower,position.tickUpper,position.liquidity,,,,) = newLock.nftPositionManager.positions(newLock.nft_id);
        emit onLock(
            newLock.lock_id, 
            address(newLock.nftPositionManager), 
            newLock.nft_id,
            newLock.owner,
            newLock.additionalCollector,
            newLock.collectAddress,
            newLock.unlockDate,
            newLock.countryCode,
            newLock.ucf,
            newLock.pool,
            position
        );
    }

    function _convertPositionToFullRange (INonfungiblePositionManager _nftPositionManager, uint256 _tokenId, INonfungiblePositionManager.Position memory _position, int24 _maxTick, address _dustRecipient) private returns (uint256) {
        _nftPositionManager.decreaseLiquidity(INonfungiblePositionManager.DecreaseLiquidityParams(_tokenId, _position.liquidity, 0, 0, block.timestamp));
        _nftPositionManager.collect(INonfungiblePositionManager.CollectParams(_tokenId, address(this), type(uint128).max, type(uint128).max));

        INonfungiblePositionManager.MintParams memory mintParams = _setPartialMintParamsFromPosition(_nftPositionManager, _tokenId);

        mintParams.deadline = block.timestamp;
        mintParams.recipient = address(this);
        mintParams.tickLower = -_maxTick;
        mintParams.tickUpper = _maxTick;
        mintParams.amount0Desired = IERC20(mintParams.token0).balanceOf(address(this));
        mintParams.amount1Desired = IERC20(mintParams.token1).balanceOf(address(this));
        mintParams.amount0Min = 0;
        mintParams.amount1Min = 0;

        TransferHelper.safeApprove(mintParams.token0, address(_nftPositionManager), mintParams.amount0Desired);
        TransferHelper.safeApprove(mintParams.token1, address(_nftPositionManager), mintParams.amount1Desired);

        (uint256 newNftId,,,) = _nftPositionManager.mint(mintParams);

        _nftPositionManager.burn(_tokenId);

        // Refund the tokens which dont fit into full range liquidity
        uint256 balance0 = IERC20(mintParams.token0).balanceOf(address(this));
        uint256 balance1 = IERC20(mintParams.token1).balanceOf(address(this));
        if (balance0 > 0) {
            TransferHelper.safeTransfer(mintParams.token0, _dustRecipient, balance0);
        }
        if (balance1 > 0) {
            TransferHelper.safeTransfer(mintParams.token1, _dustRecipient, balance1);
        }
        return newNftId;
    }

    /**
    * @dev Collect fees to _recipient if msg.sender is the owner of _lockId
    */
    function collect (uint256 _lockId, address _recipient, uint128 _amount0Max, uint128 _amount1Max) external override nonReentrant returns (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1) {
        (amount0, amount1, fee0, fee1) = _collect(_lockId, _recipient, _amount0Max, _amount1Max);
    }

    /**
    * @dev Private collect function, wrap this in re-entrancy guard calls
    */
    function _collect (uint256 _lockId, address _recipient, uint128 _amount0Max, uint128 _amount1Max) private returns(uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1) {
        Lock memory userLock = LOCKS[_lockId];
        bool collectorIsBot = AUTO_COLLECT_ACCOUNT == msg.sender;
        require(userLock.owner == msg.sender || userLock.additionalCollector == msg.sender || collectorIsBot, "OWNER");
        if (userLock.ucf == 0) { // No Protocol fee
            (amount0, amount1) = userLock.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(userLock.nft_id, _recipient, _amount0Max, _amount1Max));
        } else { // Protocol fees
            (,,address _token0,address _token1,,,,,,,,) = userLock.nftPositionManager.positions(userLock.nft_id);
            userLock.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(userLock.nft_id, address(this), _amount0Max, _amount1Max));

            uint256 balance0 = IERC20(_token0).balanceOf(address(this));
            uint256 balance1 = IERC20(_token1).balanceOf(address(this));
            address feeTo = collectorIsBot ? _recipient : FEE_ADDR_COLLECT;
            address remainderTo = collectorIsBot ? userLock.collectAddress : _recipient;

            if (balance0 > 0) {
                fee0 = balance0 * userLock.ucf / FEE_DENOMINATOR;
                TransferHelper.safeTransfer(_token0, feeTo, fee0);
                amount0 = balance0 - fee0;
                TransferHelper.safeTransfer(_token0, remainderTo, amount0);
            }
            if (balance1 > 0) {
                fee1 = balance1 * userLock.ucf / FEE_DENOMINATOR;
                TransferHelper.safeTransfer(_token1, feeTo, fee1);
                amount1 = balance1 - fee1;
                TransferHelper.safeTransfer(_token1, remainderTo, amount1);
            }
        }
    }

    /**
    * @dev increases liquidity. Can be called by anyone. 
    * You should ideally call increaseLiquidity from the NftPositionManager directly for gas efficiency. 
    * This method is here just for convenience for some contracts which solely interact with the UNCX lockers / lockIds
    */
    function increaseLiquidity(uint256 _lockId, INonfungiblePositionManager.IncreaseLiquidityParams calldata params) external payable override nonReentrant returns (uint128 liquidity, uint256 amount0, uint256 amount1) {
        Lock memory userLock = LOCKS[_lockId];
        require(userLock.nft_id == params.tokenId, "NFT ID");

        (,,address token0,address token1,,,,,,,,) = userLock.nftPositionManager.positions(userLock.nft_id);
        TransferHelper.safeTransferFrom(token0, msg.sender, address(this), params.amount0Desired);
        TransferHelper.safeTransferFrom(token1, msg.sender, address(this), params.amount1Desired);
        TransferHelper.safeApprove(token0, address(userLock.nftPositionManager), params.amount0Desired);
        TransferHelper.safeApprove(token1, address(userLock.nftPositionManager), params.amount1Desired);

        (liquidity, amount0, amount1) = userLock.nftPositionManager.increaseLiquidity(params);
        emit onIncreaseLiquidity(_lockId); // This can be called directly from the NFT position manager in which case this event won't fire
    }

    /**
    * @dev decrease liquidity if a lock has expired (useful before relocking)
    */
    function decreaseLiquidity(uint256 _lockId, INonfungiblePositionManager.DecreaseLiquidityParams calldata params) external payable override nonReentrant returns (uint256 amount0, uint256 amount1) {
        isLockAdmin(_lockId);
        Lock memory userLock = LOCKS[_lockId];
        require(userLock.nft_id == params.tokenId, 'NFT ID');
        if (userLock.unlockDate == ETERNAL_LOCK) {
            revert('ETERNAL_LOCK');
        } else {
            require(userLock.unlockDate < block.timestamp, 'NOT YET');
        }
        (amount0, amount1) = userLock.nftPositionManager.decreaseLiquidity(params);
        userLock.nftPositionManager.collect(INonfungiblePositionManager.CollectParams(userLock.nft_id, msg.sender, type(uint128).max, type(uint128).max));
        emit onDecreaseLiquidity(_lockId);
    }

    /**
    * @dev set the unlock date further in the future
    */
    function relock(uint256 _lockId, uint256 _unlockDate) external override nonReentrant {
        isLockAdmin(_lockId);
        Lock storage userLock = LOCKS[_lockId];
        require(_unlockDate > userLock.unlockDate, 'DATE');
        require(_unlockDate > block.timestamp, 'DATE PASSED');
        require(_unlockDate < 1e10 || _unlockDate == ETERNAL_LOCK, 'MILLISECONDS'); // prevents errors when timestamp entered in milliseconds
        userLock.unlockDate = _unlockDate;
        emit onRelock(_lockId, userLock.unlockDate);
    }

    /**
    * @dev withdraw a UniV3 liquidity NFT and send it to _receiver
    * Only callable once unlockDate has expired
    */
    function withdraw (uint256 _lockId, address _receiver) external override nonReentrant {
        isLockAdmin(_lockId);
        Lock memory userLock = LOCKS[_lockId];
        if (userLock.unlockDate == ETERNAL_LOCK) {
            revert('ETERNAL_LOCK');
        } else {
            require(userLock.unlockDate < block.timestamp, 'NOT YET');
        }

        if (userLock.ucf > 0) {
            _collect(_lockId, _receiver, type(uint128).max, type(uint128).max);
        }

        userLock.nftPositionManager.safeTransferFrom(address(this), _receiver, userLock.nft_id);
        USER_LOCKS[userLock.owner].remove(_lockId);

        emit onWithdraw(_lockId, userLock.owner, _receiver);

        delete LOCKS[_lockId]; // clear the state for this lock (reset all values to zero)
    }

    /**
    * @dev set migrate in contract address
    */
    function setMigrateInContract (address _migrateIn) external override onlyOwner {
        MIGRATE_IN = _migrateIn;
    }

    /**
    * @dev migrate a lock to a new amm version (Uniswap V4)
    */
    function migrate (uint256 _lockId) external override nonReentrant {
        require(address(MIGRATOR) != address(0), "NOT SET");
        isLockAdmin(_lockId);
        Lock memory userLock = LOCKS[_lockId];
        userLock.nftPositionManager.approve(address(MIGRATOR), userLock.nft_id);
        MIGRATOR.migrate(_lockId, userLock.nftPositionManager, userLock.nft_id);
        USER_LOCKS[userLock.owner].remove(_lockId);

        delete LOCKS[_lockId]; // clear the state for this lock (reset all values to zero)

        emit onMigrate(_lockId);
    }

    /**
    * @dev allow a lock owner to add an additional address, usually a contract, to collect fees. Useful for bots
    */
    function setAdditionalCollector (uint256 _lockId, address _additionalCollector) external override nonReentrant {
        isLockAdmin(_lockId);
        Lock storage userLock = LOCKS[_lockId];
        userLock.additionalCollector = _additionalCollector;

        emit onSetAdditionalCollector(_lockId, _additionalCollector);
    }

    /**
    * @dev set the adress to which fees are automatically collected
    */
    function setCollectAddress (uint256 _lockId, address _collectAddress) external override nonReentrant {
        isLockAdmin(_lockId);
        require(_collectAddress != address(0), 'COLLECT_ADDR');
        Lock storage userLock = LOCKS[_lockId];
        userLock.collectAddress = _collectAddress;

        emit onSetCollectAddress(_lockId, _collectAddress);
    }

    /**
    * @dev transfer ownership of a lock to _newOwner 
    */
    function transferLockOwnership (uint256 _lockId, address _newOwner) external override nonReentrant {
        isLockAdmin(_lockId);
        require(msg.sender != _newOwner, "SAME OWNER");
        Lock storage userLock = LOCKS[_lockId];
        userLock.pendingOwner = _newOwner;

        emit onLockOwnershipTransferStarted(_lockId, msg.sender, _newOwner);
    }

    /**
    * @dev accept lock ownership transfer
    */
    function acceptLockOwnership (uint256 _lockId) external override nonReentrant {
        Lock storage userLock = LOCKS[_lockId];
        require(userLock.pendingOwner == msg.sender, "OWNER");

        address oldOwner = userLock.owner;
        USER_LOCKS[userLock.owner].remove(_lockId);
        userLock.owner = msg.sender;
        userLock.pendingOwner = address(0);
        USER_LOCKS[msg.sender].add(_lockId);

        emit onTransferLockOwnership(_lockId, oldOwner, msg.sender);
    }

    /**
    * @dev set the migrator contract which allows locked LP NFT's to be migrated to future AMM versions
    */
    function setMigrator(address _migrator) external override onlyOwner {
        MIGRATOR = IMigrateV3NFT(_migrator);

        emit onSetMigrator(_migrator);
    }

    /**
    * @dev set ucf
    */
    function setUCF(uint256 _lockId, uint256 _ucf) external override onlyOwner {
        Lock storage l = LOCKS[_lockId];
        require(_ucf < l.ucf, "L");
        l.ucf = _ucf;
        emit onSetUCF(_lockId, _ucf);
    }

    /**
    * @dev check if msg.sender is the owner of lock with _lockId
    */
    function isLockAdmin (uint256 _lockId) private view {
        Lock memory userLock = LOCKS[_lockId];
        require(userLock.owner == msg.sender, "OWNER");
    }

    /**
    * @dev returns a Lock struct for _lockId
    */
    function getLock(uint256 _lockId) external view override returns (Lock memory _lock) {
        _lock = LOCKS[_lockId];
    }

    /**
    * @dev gets the number of unique locks in this contract, used to page through the lock array (includes expired and withdrawn locks)
    */
    function getLocksLength() external view override returns (uint256) {
        return NONCE;
    }

    /**
    * @dev gets the number of locks for a user
    */
    function getNumUserLocks(address _user) external view override returns (uint256) {
        return USER_LOCKS[_user].length();
    }

    /**
    * @dev gets the lock at a specific index for a user
    */
    function getUserLockAtIndex(address _user, uint256 _index) external view override returns (Lock memory) {
        return LOCKS[USER_LOCKS[_user].at(_index)];
    }

    /**
    * @dev gets the maximum tick for a tickSpacing
    * source: https://github.com/Uniswap/v3-core/blob/main/contracts/libraries/Tick.sol
    */
    function tickSpacingToMaxTick(int24 tickSpacing) public pure returns (int24 maxTick) {
        maxTick = (887272 / tickSpacing) * tickSpacing;
    }

    function _setPartialMintParamsFromPosition (INonfungiblePositionManager _nftPositionManager, uint256 _tokenId) private view returns (INonfungiblePositionManager.MintParams memory) {
        INonfungiblePositionManager.MintParams memory m;
        (,,m.token0,m.token1,m.fee,,,,,,,) = _nftPositionManager.positions(_tokenId);
        return m;
    }

    /**
    * @dev get a locks liquidity in amounts of token0 and token1 for a generic position (not from state)
    */
    function getAmountsForLiquidity (int24 currentTick, int24 tickLower, int24 tickHigher, uint128 liquidity) public pure override returns (uint256 amount0, uint256 amount1) {
        return LiquidityAmounts.getAmountsForLiquidity(
            TickMath.getSqrtRatioAtTick(currentTick),
            TickMath.getSqrtRatioAtTick(tickLower),
            TickMath.getSqrtRatioAtTick(tickHigher),
            liquidity
        );
    }

    /**
    * @dev returns just the liquidity value from a position
    */
    function _getLiquidity (INonfungiblePositionManager _nftPositionManager, uint256 _tokenId) private view returns (uint128) {
        (,,,,,,,uint128 liquidity,,,,) = _nftPositionManager.positions(_tokenId);
        return liquidity;
    }

    /**
    * @dev Allows admin to remove any eth mistakenly sent to the contract
    */
    function adminRefundEth (uint256 _amount, address payable _receiver) external onlyOwner nonReentrant {
        _receiver.transfer(_amount);
    }

    /**
    * @dev Allows admin to remove any ERC20's mistakenly sent to the contract
    * Since this contract is only for locking NFT liquidity, this allows removal of ERC20 tokens and cannot remove locked NFT liquidity.
    */
    function adminRefundERC20 (address _token, address _receiver, uint256 _amount) external onlyOwner nonReentrant {
        // TransferHelper.safeTransfer = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        // Attempting to transfer nfts with this function (substituting a nft_id for _amount) wil fail with 'ST' as NFTS do not have the same interface
        TransferHelper.safeTransfer(_token, _receiver, _amount);
    }

    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) public pure override returns (bytes4) {
        return IERC721Receiver.onERC721Received.selector;
    }

}

File 2 of 25 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * 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() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

File 3 of 25 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides 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} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() external {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 4 of 25 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 5 of 25 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the 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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 6 of 25 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^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 meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

File 8 of 25 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 18 of 25 : TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.6.0;

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

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) =
            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approves the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfers ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }
}

File 19 of 25 : ICountryList.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.19;

/**
 * @dev Interface of the CountryList contract
 */
interface ICountryList {
  function countryIsValid (uint16 _countryCode) external view returns (bool);
}

File 20 of 25 : IMigrateV3NFT.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.19;

import "./uniswap-updated/INonfungiblePositionManager.sol";

/**
 * @dev Interface of the MigrateV3NFT contract
 */
interface IMigrateV3NFT {
  function migrate (uint256 lockId, INonfungiblePositionManager nftPositionManager, uint256 tokenId) external returns (bool);
}

File 21 of 25 : IUNCX_ProofOfReservesV2_UniV3.sol
// SPDX-License-Identifier: UNLICENSED
// ALL RIGHTS RESERVED
// UNCX by SDDTech reserves all rights on this code. You may not copy these contracts.

pragma solidity 0.8.19;

import "./uniswap-updated/INonfungiblePositionManager.sol";

/**
 * @dev Interface of the UNCX UniswapV3 Liquidity Locker
 */
interface IUNCX_ProofOfReservesV2_UniV3 {
    struct FeeStruct {
        string name; // name by which the fee is accessed
        uint256 lpFee; // 100 = 1%, 10,000 = 100%
        uint256 collectFee; // 100 = 1%, 10,000 = 100%
        uint256 flatFee; // in amount tokens
        address flatFeeToken; // address(0) = ETH otherwise ERC20 address expected
    }

    struct Lock {
        uint256 lock_id; // unique nonce per lock
        INonfungiblePositionManager nftPositionManager; // the nft position manager of the uniswap fork
        address pool; // the pool address
        uint256 nft_id; // the nft token id of the nft belonging to the nftPositionManager (there could be two nfts with id = 1, belonging to different amm forks and position managers)
        address owner; // the owner who can collect and withdraw
        address pendingOwner; //  two step process ownership transfer, the pending owner must accept ownership to own the lock
        address additionalCollector; // an additional address allowed to call collect (ideal for contracts to auto collect without having to use owner)
        address collectAddress; // The address to which automatic collections are sent
        uint256 unlockDate; // unlock date of the lock in seconds
        uint16 countryCode; // the country code of the locker / business
        uint256 ucf; // collect fee
    }

    struct LockParams {
        INonfungiblePositionManager nftPositionManager; // the NFT Position manager of the Uniswap V3 fork
        uint256 nft_id; // the nft token_id
        address dustRecipient; // receiver of dust tokens which do not fit into liquidity and initial collection fees
        address owner; // owner of the lock
        address additionalCollector; // an additional address allowed to call collect (ideal for contracts to auto collect without having to use owner)
        address collectAddress; // The address to which automatic collections are sent
        uint256 unlockDate; // unlock date of the lock in seconds
        uint16 countryCode; // the country code of the locker / business
        string feeName; // The fee name key you wish to accept, use "DEFAULT" if in doubt
        bytes[] r; // use an empty array => []
    }

    // User functions
    function lock (LockParams calldata params) external payable returns (uint256 lockId);
    function collect (uint256 lockId, address recipient, uint128 amount0Max, uint128 amount1Max) external returns (uint256 amount0, uint256 amount1, uint256 fee0, uint256 fee1);
    function withdraw (uint256 lockId, address receiver) external;
    function migrate (uint256 lockId) external;
    function relock(uint256 lockId, uint256 unlockDate) external;
    function setAdditionalCollector (uint256 lockId, address additionalCollector) external;
    function setCollectAddress (uint256 lockId, address collectAddress) external;
    function transferLockOwnership (uint256 lockId, address newOwner) external;
    function acceptLockOwnership (uint256 lockId) external;
    function decreaseLiquidity(uint256 lockId, INonfungiblePositionManager.DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
    function increaseLiquidity(uint256 lockId, INonfungiblePositionManager.IncreaseLiquidityParams calldata params) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1);

    // Admin functions
    function setMigrator(address migrator) external;
    function setUCF(uint256 lockId, uint256 ucf) external;
    function setMigrateInContract (address migrateInContract) external;

    // Getters
    function getLocksLength() external view returns (uint256);
    function getLock(uint256 lockId) external view returns (Lock memory lock);

    function getNumUserLocks(address user) external view returns (uint256 numLocks);
    function getUserLockAtIndex(address user, uint256 index) external view returns (Lock memory lock);

    function getFee (string memory name) external view returns (FeeStruct memory);
    function getAmountsForLiquidity (int24 currentTick, int24 tickLower, int24 tickHigher, uint128 liquidity) external pure returns (uint256 amount0, uint256 amount1);

    // Events
    event onLock(
        uint256 lock_id,
        address nftPositionManager,
        uint256 nft_id,
        address owner,
        address additionalCollector,
        address collectAddress,
        uint256 unlockDate,
        uint16 countryCode,
        uint256 collectFee,
        address poolAddress,
        INonfungiblePositionManager.Position position
    );

    event onWithdraw(uint256 lock_id, address owner, address receiver);

    event onLockOwnershipTransferStarted(uint256 lockId, address currentOwner, address pendingOwner);

    event onTransferLockOwnership(uint256 lockId, address oldOwner, address newOwner);

    event onMigrate(uint256 lockId);

    event onSetAdditionalCollector(uint256 lockId, address additionalCollector);

    event onSetCollectAddress(uint256 lockId, address collectAddress);

    event onSetMigrator(address migrator);

    event onRelock(uint256 lockId, uint256 unlockDate);

    event onIncreaseLiquidity(uint256 lockId);

    event onDecreaseLiquidity(uint256 lockId);

    event onRemoveFee(bytes32 nameHash);

    event onAddFee(bytes32 nameHash, string name, uint256 lpFee, uint256 collectFee, uint256 flatFee, address flatFeeToken);

    event onEditFee(bytes32 nameHash, string name, uint256 lpFee, uint256 collectFee, uint256 flatFee, address flatFeeToken);

    event onSetUCF(uint256 lockId, uint256 ucf);
    
}

File 22 of 25 : FullMath.sol
// SPDX-License-Identifier: MIT
// Sourced from OpenZepplin but edited to remove un-needed functions
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/Math.sol

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library FullMath {
    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

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

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

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

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

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

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

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

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

File 23 of 25 : INonfungiblePositionManager.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

// Importing from @uniswap doesnt work with @openzepplins latest release so this is refactored
// Source: https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/INonfungiblePositionManager.sol

interface INonfungiblePositionManager {

    function approve(address to, uint256 tokenId) external;
    
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

    function mint(
        MintParams calldata params
    )
        external
        payable
        returns (
            uint256 tokenId,
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct Position {
        uint96 nonce;
        address operator;
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
        uint256 feeGrowthInside0LastX128;
        uint256 feeGrowthInside1LastX128;
        uint128 tokensOwed0;
        uint128 tokensOwed1;
    }

    function positions(
        uint256 tokenId
    )
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`
    /// @param params tokenId The ID of the token for which liquidity is being increased,
    /// amount0Desired The desired amount of token0 to be spent,
    /// amount1Desired The desired amount of token1 to be spent,
    /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,
    /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return liquidity The new liquidity amount as a result of the increase
    /// @return amount0 The amount of token0 to acheive resulting liquidity
    /// @return amount1 The amount of token1 to acheive resulting liquidity
    function increaseLiquidity(IncreaseLiquidityParams calldata params)
        external
        payable
        returns (
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Decreases the amount of liquidity in a position and accounts it to the position
    /// @param params tokenId The ID of the token for which liquidity is being decreased,
    /// amount The amount by which liquidity will be decreased,
    /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,
    /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return amount0 The amount of token0 accounted to the position's tokens owed
    /// @return amount1 The amount of token1 accounted to the position's tokens owed
    function decreaseLiquidity(DecreaseLiquidityParams calldata params)
        external
        payable
        returns (uint256 amount0, uint256 amount1);

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    function collect(
        CollectParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    function factory() external view returns (address);

    function burn(uint256 tokenId) external payable;
}

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

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

/// @title Liquidity amount functions
/// @notice Provides functions for computing liquidity amounts from token amounts and prices
library LiquidityAmounts {
    /// @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);
        }
    }
}

File 25 of 25 : TickMath.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.9;

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

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

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

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

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

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

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

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

        uint256 r = ratio;
        uint256 msb = 0;

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

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

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

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

        int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract ICountryList","name":"_countryList","type":"address"},{"internalType":"address payable","name":"_autoCollectAddress","type":"address"},{"internalType":"address payable","name":"_lpFeeReceiver","type":"address"},{"internalType":"address payable","name":"_collectFeeReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"nameHash","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"lpFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flatFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"flatFeeToken","type":"address"}],"name":"onAddFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"onDecreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"nameHash","type":"bytes32"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"lpFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"collectFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"flatFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"flatFeeToken","type":"address"}],"name":"onEditFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"onIncreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lock_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"nftPositionManager","type":"address"},{"indexed":false,"internalType":"uint256","name":"nft_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"additionalCollector","type":"address"},{"indexed":false,"internalType":"address","name":"collectAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"unlockDate","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"countryCode","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"collectFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"poolAddress","type":"address"},{"components":[{"internalType":"uint96","name":"nonce","type":"uint96"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"indexed":false,"internalType":"struct INonfungiblePositionManager.Position","name":"position","type":"tuple"}],"name":"onLock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"currentOwner","type":"address"},{"indexed":false,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"onLockOwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"}],"name":"onMigrate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unlockDate","type":"uint256"}],"name":"onRelock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"nameHash","type":"bytes32"}],"name":"onRemoveFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"additionalCollector","type":"address"}],"name":"onSetAdditionalCollector","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"collectAddress","type":"address"}],"name":"onSetCollectAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"migrator","type":"address"}],"name":"onSetMigrator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ucf","type":"uint256"}],"name":"onSetUCF","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lockId","type":"uint256"},{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"onTransferLockOwnership","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lock_id","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"onWithdraw","type":"event"},{"inputs":[],"name":"AUTO_COLLECT_ACCOUNT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COUNTRY_LIST","outputs":[{"internalType":"contract ICountryList","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETERNAL_LOCK","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_ADDR_COLLECT","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_ADDR_LP","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RESOLVER","outputs":[{"internalType":"contract IFeeResolver","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"LOCKS","outputs":[{"internalType":"uint256","name":"lock_id","type":"uint256"},{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"uint256","name":"ucf","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIGRATE_IN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIGRATOR","outputs":[{"internalType":"contract IMigrateV3NFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NONCE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"acceptLockOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_lpFee","type":"uint256"},{"internalType":"uint256","name":"_collectFee","type":"uint256"},{"internalType":"uint256","name":"_flatFee","type":"uint256"},{"internalType":"address","name":"_flatFeeToken","type":"address"}],"name":"addOrEditFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"adminRefundERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"adminRefundEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint128","name":"_amount0Max","type":"uint128"},{"internalType":"uint128","name":"_amount1Max","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"},{"internalType":"uint256","name":"fee0","type":"uint256"},{"internalType":"uint256","name":"fee1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.DecreaseLiquidityParams","name":"params","type":"tuple"}],"name":"decreaseLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int24","name":"currentTick","type":"int24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickHigher","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"getAmountsForLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"getFee","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"collectFee","type":"uint256"},{"internalType":"uint256","name":"flatFee","type":"uint256"},{"internalType":"address","name":"flatFeeToken","type":"address"}],"internalType":"struct IUNCX_ProofOfReservesV2_UniV3.FeeStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getFeeOptionAtIndex","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"lpFee","type":"uint256"},{"internalType":"uint256","name":"collectFee","type":"uint256"},{"internalType":"uint256","name":"flatFee","type":"uint256"},{"internalType":"address","name":"flatFeeToken","type":"address"}],"internalType":"struct IUNCX_ProofOfReservesV2_UniV3.FeeStruct","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeOptionLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"getLock","outputs":[{"components":[{"internalType":"uint256","name":"lock_id","type":"uint256"},{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"uint256","name":"ucf","type":"uint256"}],"internalType":"struct IUNCX_ProofOfReservesV2_UniV3.Lock","name":"_lock","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLocksLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getNumUserLocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getUserLockAtIndex","outputs":[{"components":[{"internalType":"uint256","name":"lock_id","type":"uint256"},{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"pendingOwner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"uint256","name":"ucf","type":"uint256"}],"internalType":"struct IUNCX_ProofOfReservesV2_UniV3.Lock","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct INonfungiblePositionManager.IncreaseLiquidityParams","name":"params","type":"tuple"}],"name":"increaseLiquidity","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"contract INonfungiblePositionManager","name":"nftPositionManager","type":"address"},{"internalType":"uint256","name":"nft_id","type":"uint256"},{"internalType":"address","name":"dustRecipient","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"additionalCollector","type":"address"},{"internalType":"address","name":"collectAddress","type":"address"},{"internalType":"uint256","name":"unlockDate","type":"uint256"},{"internalType":"uint16","name":"countryCode","type":"uint16"},{"internalType":"string","name":"feeName","type":"string"},{"internalType":"bytes[]","name":"r","type":"bytes[]"}],"internalType":"struct IUNCX_ProofOfReservesV2_UniV3.LockParams","name":"params","type":"tuple"}],"name":"lock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"uint256","name":"_unlockDate","type":"uint256"}],"name":"relock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"}],"name":"removeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_additionalCollector","type":"address"}],"name":"setAdditionalCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_collectAddress","type":"address"}],"name":"setCollectAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_autoCollectAccount","type":"address"},{"internalType":"address payable","name":"_lpFeeReceiver","type":"address"},{"internalType":"address payable","name":"_collectFeeReceiver","type":"address"}],"name":"setFeeParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFeeResolver","name":"_resolver","type":"address"}],"name":"setFeeResolver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_migrateIn","type":"address"}],"name":"setMigrateInContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_migrator","type":"address"}],"name":"setMigrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"uint256","name":"_ucf","type":"uint256"}],"name":"setUCF","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int24","name":"tickSpacing","type":"int24"}],"name":"tickSpacingToMaxTick","outputs":[{"internalType":"int24","name":"maxTick","type":"int24"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferLockOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockId","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526000600d55600019600e553480156200001c57600080fd5b506040516200668c3803806200668c8339810160408190526200003f916200042f565b6200004a336200012b565b6001600255600a80546001600160a01b038087166001600160a01b0319928316179092556007805486841690831617815560088054868516908416179055600980549385169390921692909217905560408051808201909152908152661111519055531560ca1b6020820152620000c890603260c860008062000149565b60408051808201909152600381526204c56560ec1b6020820152620000f4906050606460008062000149565b60408051808201909152600381526204c4c560ec1b60208201526200012190601e61015e60008062000149565b50505050620006ad565b600180546001600160a01b03191690556200014681620002f1565b50565b6200015362000341565b600085604051602001620001689190620004bd565b60408051601f19818403018152828252805160209182012060a084018352898452838201899052838301889052606084018790526001600160a01b038616608085015260008181526003909252919020825191935082918190620001cd908262000580565b50602082015160018201556040820151600282015560608201516003820155608090910151600491820180546001600160a01b0319166001600160a01b03909216919091179055620002209083620003a2565b620002905762000232600483620003bf565b507f335d96fad821252e8298f51336937e44332b3731a3c3f249b2cdb77652b33e4f828260000151836020015184604001518560600151866080015160405162000282969594939291906200064c565b60405180910390a1620002e8565b7fdd151e7029525c623e7c09af0f71271bd7642edd1bf2f64d97bc552faba7c86d8282600001518360200151846040015185606001518660800151604051620002df969594939291906200064c565b60405180910390a15b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314620003a05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b600081815260018301602052604081205415155b90505b92915050565b6000620003b6838360008181526001830160205260408120546200041057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620003b9565b506000620003b9565b6001600160a01b03811681146200014657600080fd5b600080600080608085870312156200044657600080fd5b8451620004538162000419565b6020860151909450620004668162000419565b6040860151909350620004798162000419565b60608601519092506200048c8162000419565b939692955090935050565b60005b83811015620004b45781810151838201526020016200049a565b50506000910152565b60008251620004d181846020870162000497565b9190910192915050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200050657607f821691505b6020821081036200052757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200057b57600081815260208120601f850160051c81016020861015620005565750805b601f850160051c820191505b81811015620005775782815560010162000562565b5050505b505050565b81516001600160401b038111156200059c576200059c620004db565b620005b481620005ad8454620004f1565b846200052d565b602080601f831160018114620005ec5760008415620005d35750858301515b600019600386901b1c1916600185901b17855562000577565b600085815260208120601f198616915b828110156200061d57888601518255948401946001909101908401620005fc565b50858210156200063c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b86815260c06020820152600086518060c0840152620006738160e0850160208b0162000497565b604083019690965250606081019390935260808301919091526001600160a01b031660a082015260e0601f909201601f1916010192915050565b615fcf80620006bd6000396000f3fe6080604052600436106102fc5760003560e01c80639f185a0b1161018f578063d68f4dd1116100e1578063ed1eee681161008a578063f2fde38b11610064578063f2fde38b14610ac9578063fae2e64814610ae9578063fe0ab56114610b0957600080fd5b8063ed1eee6814610a76578063ef24894414610a96578063f11478f814610ab657600080fd5b8063e30c3978116100bb578063e30c397814610a05578063e526dd4814610a23578063e7a7bdfe14610a5657600080fd5b8063d68f4dd1146108be578063d73792a9146109d9578063e091dd1a146109ef57600080fd5b8063b2fb30cb11610143578063cf0d5af31161011d578063cf0d5af314610786578063d1f55d451461087e578063d5fdb7321461089e57600080fd5b8063b2fb30cb14610726578063b707a28814610746578063c7a85b401461076657600080fd5b8063a35a96b811610174578063a35a96b8146106d3578063ab9ae180146106e6578063ac4521c61461070657600080fd5b80639f185a0b14610671578063a339df121461069e57600080fd5b8063454b06081161025357806375eb8e69116101fc5780638b52a6ee116101d65780638b52a6ee146106135780638da5cb5b146106335780639ecd74721461065157600080fd5b806375eb8e69146105bb57806379ba5097146105d157806383fb69ad146105e657600080fd5b80635a04fb691161022d5780635a04fb6914610566578063611f6fe614610586578063715018a6146105a657600080fd5b8063454b06081461051157806345908a4714610531578063489c18b01461055157600080fd5b8063150b7a02116102b557806323cf31181161028f57806323cf311814610491578063260e12b0146104b1578063280f3867146104f157600080fd5b8063150b7a02146103c357806318694155146104395780631f113fc31461047157600080fd5b8063066b58c7116102e6578063066b58c71461034b57806309564ab0146103835780630ae300bf146103a357600080fd5b8062f714ce14610301578063038975a114610323575b600080fd5b34801561030d57600080fd5b5061032161031c366004614f26565b610b29565b005b34801561032f57600080fd5b50610338610df6565b6040519081526020015b60405180910390f35b34801561035757600080fd5b5060075461036b906001600160a01b031681565b6040516001600160a01b039091168152602001610342565b34801561038f57600080fd5b5061032161039e366004614f56565b610e07565b3480156103af57600080fd5b5060085461036b906001600160a01b031681565b3480156103cf57600080fd5b506104086103de366004614fa1565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610342565b61044c610447366004615040565b610e4e565b604080516001600160801b039094168452602084019290925290820152606001610342565b34801561047d57600080fd5b5060095461036b906001600160a01b031681565b34801561049d57600080fd5b506103216104ac366004615078565b61110f565b3480156104bd57600080fd5b506104d16104cc3660046150aa565b61116b565b604080519485526020850193909352918301526060820152608001610342565b3480156104fd57600080fd5b5061032161050c3660046150fd565b6111a4565b34801561051d57600080fd5b5061032161052c36600461513e565b6111ce565b34801561053d57600080fd5b5061032161054c36600461513e565b6114c3565b34801561055d57600080fd5b50600d54610338565b34801561057257600080fd5b50610321610581366004614f26565b6115d3565b34801561059257600080fd5b506103386105a1366004615078565b6116bb565b3480156105b257600080fd5b506103216116e2565b3480156105c757600080fd5b50610338600e5481565b3480156105dd57600080fd5b506103216116f6565b3480156105f257600080fd5b5061060661060136600461513e565b611781565b60405161034291906151a7565b34801561061f57600080fd5b5061032161062e366004615078565b6118ae565b34801561063f57600080fd5b506000546001600160a01b031661036b565b34801561065d57600080fd5b50600b5461036b906001600160a01b031681565b34801561067d57600080fd5b5061069161068c366004615200565b6118d8565b604051610342919061522c565b3480156106aa57600080fd5b506106be6106b936600461531e565b611a00565b60408051928352602083019190915201610342565b6103386106e136600461535f565b611a35565b3480156106f257600080fd5b50610321610701366004614f26565b612707565b34801561071257600080fd5b50610321610721366004614f26565b612758565b34801561073257600080fd5b5061032161074136600461539b565b6127cd565b34801561075257600080fd5b50610321610761366004614f26565b61290a565b34801561077257600080fd5b50600c5461036b906001600160a01b031681565b34801561079257600080fd5b506108126107a136600461513e565b600f60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600a909a015498996001600160a01b039889169997891698969795871696948516959385169490921692909161ffff16908b565b604080519b8c526001600160a01b039a8b1660208d0152988a16988b019890985260608a0196909652938716608089015291861660a0880152851660c087015290931660e085015261010084019290925261ffff90911661012083015261014082015261016001610342565b34801561088a57600080fd5b5060065461036b906001600160a01b031681565b3480156108aa57600080fd5b506103216108b93660046154ab565b6129c4565b3480156108ca57600080fd5b506106916108d936600461513e565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152506000908152600f60209081526040918290208251610160810184528154815260018201546001600160a01b03908116938201939093526002820154831693810193909352600381015460608401526004810154821660808401526005810154821660a08401526006810154821660c0840152600781015490911660e08301526008810154610100830152600981015461ffff16610120830152600a015461014082015290565b3480156109e557600080fd5b5061033861271081565b3480156109fb57600080fd5b50610338600d5481565b348015610a1157600080fd5b506001546001600160a01b031661036b565b348015610a2f57600080fd5b50610a43610a3e3660046154e0565b612ab9565b60405160029190910b8152602001610342565b348015610a6257600080fd5b50610321610a713660046154fd565b612ad3565b348015610a8257600080fd5b50610606610a913660046154ab565b612c6b565b348015610aa257600080fd5b50610321610ab136600461539b565b612e0d565b6106be610ac436600461556c565b612ebc565b348015610ad557600080fd5b50610321610ae4366004615078565b6131a8565b348015610af557600080fd5b50610321610b04366004615078565b613219565b348015610b1557600080fd5b50600a5461036b906001600160a01b031681565b610b31613243565b610b3a8261329a565b6000828152600f60209081526040918290208251610160810184528154815260018201546001600160a01b03908116938201939093526002820154831693810193909352600381015460608401526004810154821660808401526005810154821660a08401526006810154821660c0840152600781015490911660e083015260088101546101008301819052600982015461ffff16610120840152600a90910154610140830152600e549003610c265760405162461bcd60e51b815260206004820152600c60248201526b455445524e414c5f4c4f434b60a01b60448201526064015b60405180910390fd5b4281610100015110610c645760405162461bcd60e51b81526020600482015260076024820152661393d50816515560ca1b6044820152606401610c1d565b61014081015115610c8757610c8283836001600160801b0380613375565b505050505b60208101516060820151604051632142170760e11b81523060048201526001600160a01b03858116602483015260448201929092529116906342842e0e90606401600060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b50505060808201516001600160a01b03166000908152601060205260409020610d2091508461387e565b506080810151604080518581526001600160a01b03928316602082015291841682820152517fcf3f38c6e10e7fa2c0a2d09ff592596efa8ea3865dd7aabb9bff9c5189c607a89181900360600190a1506000828152600f602052604081208181556001810180546001600160a01b0319908116909155600282018054821690556003820183905560048201805482169055600582018054821690556006820180548216905560078201805490911690556008810182905560098101805461ffff19169055600a0155610df26001600255565b5050565b6000610e026004613891565b905090565b610e0f61389b565b600780546001600160a01b039485166001600160a01b031991821617909155600880549385169382169390931790925560098054919093169116179055565b6000806000610e5b613243565b6000858152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382019390935260028201548316938101939093526003810154606084018190526004820154831660808501526005820154831660a08501526006820154831660c0850152600782015490921660e08401526008810154610100840152600981015461ffff16610120840152600a0154610140830152853514610f385760405162461bcd60e51b815260206004820152600660248201526513919508125160d21b6044820152606401610c1d565b60008082602001516001600160a01b03166399fbab8884606001516040518263ffffffff1660e01b8152600401610f7191815260200190565b61018060405180830381865afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb391906155ca565b5050505050505050935093505050610fd18233308a602001356138f5565b610fe18133308a604001356138f5565b610ff48284602001518960200135613a32565b6110078184602001518960400135613a32565b602080840151604080517f219f5d170000000000000000000000000000000000000000000000000000000081528a356004820152928a013560248401528901356044830152606089013560648301526080890135608483015260a089013560a48301526001600160a01b03169063219f5d179060c4016060604051808303816000875af115801561109c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c091906156ab565b6040518b815292985090965094507f38f5d789b3e0e71e68d20081e98d4b02ae7ecab7482b6634306b2261e90f806f9060200160405180910390a15050506111086001600255565b9250925092565b61111761389b565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f48af0f3916eee80364290b1aca1b04532ba7394a23ceeb066b5df1aa9c5b51c49060200160405180910390a150565b600080600080611179613243565b61118588888888613375565b929650909450925090506111996001600255565b945094509450949050565b6111ac61389b565b6111b4613243565b6111bf838383613b4d565b6111c96001600255565b505050565b6111d6613243565b600b546001600160a01b031661122e5760405162461bcd60e51b815260206004820152600760248201527f4e4f5420534554000000000000000000000000000000000000000000000000006044820152606401610c1d565b6112378161329a565b6000818152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382018490526002830154811682860152600383015460608301819052600480850154831660808501526005850154831660a08501526006850154831660c08501526007850154831660e08501526008850154610100850152600985015461ffff16610120850152600a90940154610140840152600b54955163095ea7b360e01b8152959091169285019290925260248401919091529163095ea7b390604401600060405180830381600087803b15801561132057600080fd5b505af1158015611334573d6000803e3d6000fd5b5050600b54602084015160608501516040517f4ef88bea000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039283166024820152604481019190915291169250634ef88bea91506064016020604051808303816000875af11580156113b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d991906156e2565b5060808101516001600160a01b03166000908152601060205260409020611400908361387e565b506000828152600f60205260408082208281556001810180546001600160a01b0319908116909155600282018054821690556003820184905560048201805482169055600582018054821690556006820180548216905560078201805490911690556008810183905560098101805461ffff19169055600a0191909155517f97923ecdf32419caa09669588eaa60fcc1c41069814b4f4f52ec31e9fdec1aea906114ad9084815260200190565b60405180910390a1506114c06001600255565b50565b6114cb613243565b6000818152600f6020526040902060058101546001600160a01b0316331461151d5760405162461bcd60e51b815260206004820152600560248201526427aba722a960d91b6044820152606401610c1d565b60048101546001600160a01b03166000818152601060205260409020611543908461387e565b50600482018054336001600160a01b031991821681179092556005840180549091169055600090815260106020526040902061157f9084613c7a565b50604080518481526001600160a01b0383166020820152338183015290517ff91adf142bcf2de4e78197d8153f97cc3bf959173f88d7e5091f50d40e1085fe9181900360600190a150506114c06001600255565b6115db613243565b6115e48261329a565b6001600160a01b038116330361163c5760405162461bcd60e51b815260206004820152600a60248201527f53414d45204f574e4552000000000000000000000000000000000000000000006044820152606401610c1d565b6000828152600f60209081526040918290206005810180546001600160a01b0319166001600160a01b03861690811790915583518681523393810193909352928201929092527f7336363d3c1722824dac3c93d1256b57d394f59da51548af7e779e47c13fff10906060015b60405180910390a150610df26001600255565b6001600160a01b03811660009081526010602052604081206116dc90613891565b92915050565b6116ea61389b565b6116f46000613c86565b565b60015433906001600160a01b031681146117785760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152608401610c1d565b6114c081613c86565b6117bc6040518060a001604052806060815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600360006117cb600485613c9f565b81526020019081526020016000206040518060a00160405290816000820180546117f490615704565b80601f016020809104026020016040519081016040528092919081815260200182805461182090615704565b801561186d5780601f106118425761010080835404028352916020019161186d565b820191906000526020600020905b81548152906001019060200180831161185057829003601f168201915b50505091835250506001820154602082015260028201546040820152600382015460608201526004909101546001600160a01b031660809091015292915050565b6118b661389b565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b604080516101608101825260008082526020808301829052828401829052606083018290526080830182905260a0830182905260c0830182905260e083018290526101008301829052610120830182905261014083018290526001600160a01b0386168252601090529182209091600f916119539085613c9f565b815260208082019290925260409081016000208151610160810183528154815260018201546001600160a01b03908116948201949094526002820154841692810192909252600381015460608301526004810154831660808301526005810154831660a08301526006810154831660c0830152600781015490921660e08201526008820154610100820152600982015461ffff16610120820152600a909101546101408201529392505050565b600080611a27611a0f87613cab565b611a1887613cab565b611a2187613cab565b866140f4565b915091505b94509492505050565b6000611a3f613243565b6000611a516080840160608501615078565b6001600160a01b031603611a6457600080fd5b6000611a7660c0840160a08501615078565b6001600160a01b031603611abb5760405162461bcd60e51b815260206004820152600c60248201526b21a7a62622a1aa2fa0a2222960a11b6044820152606401610c1d565b6402540be4008260c001351080611ad75750600e548260c00135145b611b125760405162461bcd60e51b815260206004820152600c60248201526b4d494c4c495345434f4e445360a01b6044820152606401610c1d565b428260c0013511611b535760405162461bcd60e51b815260206004820152600b60248201526a1110551148141054d4d15160aa1b6044820152606401610c1d565b600a546001600160a01b0316635cb49b55611b75610100850160e0860161573e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261ffff9091166004820152602401602060405180830381865afa158015611bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf091906156e2565b611c3c5760405162461bcd60e51b815260206004820152600760248201527f434f554e545259000000000000000000000000000000000000000000000000006044820152606401610c1d565b611c776040518060a001604052806060815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600c546001600160a01b03163303611cd157611c97610120840184615762565b6000818110611ca857611ca86157ac565b9050602002810190611cba91906157c2565b810190611cc7919061513e565b6040820152611dd6565b6000611ce1610120850185615762565b90501115611d75576006546001600160a01b03166332c07c9e611d08610120860186615762565b336040518463ffffffff1660e01b8152600401611d2793929190615832565b6000604051808303816000875af1158015611d46573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d6e91908101906158dc565b9050611dc3565b611dc0611d866101008501856157c2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612c6b92505050565b90505b606081015115611dd657611dd68161418f565b611de36020840184615078565b604051632142170760e11b8152336004820152306024820152602085013560448201526001600160a01b0391909116906342842e0e90606401600060405180830381600087803b158015611e3657600080fd5b505af1158015611e4a573d6000803e3d6000fd5b50506040805161018081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081018290526101608101919091529150611eb69050565b611ec36020850185615078565b60405163133f757160e31b8152602086013560048201526001600160a01b0391909116906399fbab889060240161018060405180830381865afa158015611f0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3291906155ca565b505050506001600160801b031660e0890152600290810b60c08901520b60a087015262ffffff1660808601526001600160a01b0390811660608601521660408401525060009050611f866020860186615078565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe791906159b2565b6040808401516060850151608086015192517f1698ee820000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152908216602482015262ffffff9092166044830152919250600091831690631698ee8290606401602060405180830381865afa15801561206f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209391906159b2565b60808401516040517f22afcccb00000000000000000000000000000000000000000000000000000000815262ffffff9091166004820152909150600090612129906001600160a01b038516906322afcccb90602401602060405180830381865afa158015612105573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3e91906159cf565b9050600061213682615a02565b60020b8560a0015160020b1415801561215957508160020b8560c0015160020b14155b156121915761218a61216e60208a018a615078565b60208a0135878561218560608e0160408f01615078565b614257565b9050612297565b50602087018035906121a39089615078565b6001600160a01b031663fc6f786560405180608001604052808481526020018b60400160208101906121d59190615078565b6001600160a01b0390811682526001600160801b0360208084018290526040938401829052835160e087901b7fffffffff0000000000000000000000000000000000000000000000000000000016815285516004820152908501519092166024830152918301518216604482015260609092015116606482015260840160408051808303816000875af1158015612270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122949190615a24565b50505b6020860151156124915760006122b96122b360208b018b615078565b83614754565b90506122c860208a018a615078565b6001600160a01b0316630c49ccbe6040518060a001604052808581526020016127108b60200151866001600160801b03166123039190615a48565b61230d9190615a75565b6001600160801b031681526020016000815260200160008152602001428152506040518263ffffffff1660e01b81526004016123879190600060a082019050825182526001600160801b03602084015116602083015260408301516040830152606083015160608301526080830151608083015292915050565b60408051808303816000875af11580156123a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c99190615a24565b506123d9905060208a018a615078565b604080516080810182528481526008546001600160a01b03908116602083019081526001600160801b0383850181815260608501828152955163fc6f786560e01b8152945160048601529151831660248501529051811660448401529251909216606482015291169063fc6f78659060840160408051808303816000875af1158015612469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248d9190615a24565b5050505b604080516101608101825260006020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820152600d548152906124f7908a018a615078565b6001600160a01b0390811660208301528416604082015260608082018390526125269060808b01908b01615078565b6001600160a01b03166080808301919091526125489060a08b01908b01615078565b6001600160a01b031660c080830191909152612569908a0160a08b01615078565b6001600160a01b031660e08083019190915260c08a01356101008084019190915261259991908b01908b0161573e565b61ffff90811661012083019081526040898101516101408501908152600d80546000908152600f602090815284822088518155908801516001820180546001600160a01b03199081166001600160a01b03938416179091559589015160028301805488169183169190911790556060808a015160038401556080808b01516004850180548a1691851691909117905560a08b01516005850180548a1691851691909117905560c08b01516006850180548a1691851691909117905560e08b01516007850180549099169316929092179096556101008901516008830155955160098201805461ffff191691909816179096559151600a9095019490945592546126ce9390926010926126af918f01908f01615078565b6001600160a01b03168152602081019190915260400160002090613c7a565b50600d80549060006126df83615a89565b909155505080516126ef906147d7565b5196505050505050506127026001600255565b919050565b61270f61389b565b612717613243565b6040516001600160a01b0382169083156108fc029084906000818181858888f1935050505015801561274d573d6000803e3d6000fd5b50610df26001600255565b612760613243565b6127698261329a565b6000828152600f60209081526040918290206006810180546001600160a01b0319166001600160a01b038616908117909155835186815292830152917fda22afd9d1e0640f160cada74dec56452db8535daf46772df2c5f7a3af46485f91016116a8565b6127d5613243565b6127de8261329a565b6000828152600f60205260409020600881015482116128415760405162461bcd60e51b8152600401610c1d9060208082526004908201527f4441544500000000000000000000000000000000000000000000000000000000604082015260600190565b42821161287e5760405162461bcd60e51b815260206004820152600b60248201526a1110551148141054d4d15160aa1b6044820152606401610c1d565b6402540be4008210806128925750600e5482145b6128cd5760405162461bcd60e51b815260206004820152600c60248201526b4d494c4c495345434f4e445360a01b6044820152606401610c1d565b6008810182905560408051848152602081018490527fefaff1b90138281d215452c67f793017f52e456f65c28ac63f5309a89a059b4791016116a8565b612912613243565b61291b8261329a565b6001600160a01b0381166129605760405162461bcd60e51b815260206004820152600c60248201526b21a7a62622a1aa2fa0a2222960a11b6044820152606401610c1d565b6000828152600f60209081526040918290206007810180546001600160a01b0319166001600160a01b038616908117909155835186815292830152917ff47f77d5d198f5b58faaca8c7dc86ebe53925091c07487a01ec62159ff16664e91016116a8565b6129cc61389b565b6000816040516020016129df9190615aa2565b604051602081830303815290604052805190602001209050604051602001612a1490661111519055531560ca1b815260070190565b604051602081830303815290604052805190602001208103612a625760405162461bcd60e51b81526020600482015260076024820152661111519055531560ca1b6044820152606401610c1d565b612a6d600482614a28565b612a7657600080fd5b612a8160048261387e565b506040518181527faea1931d5fe74928dff1db9836d2d9de778b60cb4afc9ec70c9a1f16b58598a59060200160405180910390a15050565b600081612ac981620d89e8615abe565b6116dc9190615af8565b612adb61389b565b600085604051602001612aee9190615aa2565b60408051601f19818403018152828252805160209182012060a084018352898452838201899052838301889052606084018790526001600160a01b038616608085015260008181526003909252919020825191935082918190612b519082615b5e565b50602082015160018201556040820151600282015560608201516003820155608090910151600491820180546001600160a01b0319166001600160a01b03909216919091179055612ba29083614a28565b612c0c57612bb1600483613c7a565b507f335d96fad821252e8298f51336937e44332b3731a3c3f249b2cdb77652b33e4f8282600001518360200151846040015185606001518660800151604051612bff96959493929190615c1e565b60405180910390a1612c62565b7fdd151e7029525c623e7c09af0f71271bd7642edd1bf2f64d97bc552faba7c86d8282600001518360200151846040015185606001518660800151604051612c5996959493929190615c1e565b60405180910390a15b50505050505050565b612ca66040518060a001604052806060815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600082604051602001612cb99190615aa2565b60408051601f1981840301815291905280516020909101209050612cde600482614a28565b612d2a5760405162461bcd60e51b815260206004820152600960248201527f4e4f5420464f554e4400000000000000000000000000000000000000000000006044820152606401610c1d565b60008181526003602052604090819020815160a08101909252805482908290612d5290615704565b80601f0160208091040260200160405190810160405280929190818152602001828054612d7e90615704565b8015612dcb5780601f10612da057610100808354040283529160200191612dcb565b820191906000526020600020905b815481529060010190602001808311612dae57829003601f168201915b50505091835250506001820154602082015260028201546040820152600382015460608201526004909101546001600160a01b03166080909101529392505050565b612e1561389b565b6000828152600f60205260409020600a8101548210612e765760405162461bcd60e51b815260206004820152600160248201527f4c000000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b600a810182905560408051848152602081018490527fa4b63b21571e7c2b944a681b0a39cda220f85f67aaa7aa4d23fcf7d31e2379a391015b60405180910390a1505050565b600080612ec7613243565b612ed08461329a565b6000848152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382019390935260028201548316938101939093526003810154606084018190526004820154831660808501526005820154831660a08501526006820154831660c0850152600782015490921660e08401526008810154610100840152600981015461ffff16610120840152600a0154610140830152843514612fad5760405162461bcd60e51b815260206004820152600660248201526513919508125160d21b6044820152606401610c1d565b600e5481610100015103612ff25760405162461bcd60e51b815260206004820152600c60248201526b455445524e414c5f4c4f434b60a01b6044820152606401610c1d565b42816101000151106130305760405162461bcd60e51b81526020600482015260076024820152661393d50816515560ca1b6044820152606401610c1d565b80602001516001600160a01b0316630c49ccbe856040518263ffffffff1660e01b81526004016130609190615c65565b60408051808303816000875af115801561307e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130a29190615a24565b602083810151604080516080810182526060808801518252339482019485526001600160801b03828401818152918301818152935163fc6f786560e01b81529251600484015294516001600160a01b0390811660248401529051851660448301529151909316606484015293965091945091169063fc6f78659060840160408051808303816000875af115801561313d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131619190615a24565b50506040518581527fffeb250f5933abd95c7c8e2c0317b8041dc9c5a309b73fa772f533ddd085dd3a9060200160405180910390a1506131a16001600255565b9250929050565b6131b061389b565b600180546001600160a01b0383166001600160a01b031990911681179091556131e16000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61322161389b565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60028054036132945760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c1d565b60028055565b6000818152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382019390935260028201548316938101939093526003810154606084015260048101548216608084018190526005820154831660a08501526006820154831660c0850152600782015490921660e08401526008810154610100840152600981015461ffff16610120840152600a01546101408301523314610df25760405162461bcd60e51b815260206004820152600560248201526427aba722a960d91b6044820152606401610c1d565b6000848152600f602090815260408083208151610160810183528154815260018201546001600160a01b039081169482019490945260028201548416928101929092526003810154606083015260048101548316608083018190526005820154841660a08401526006820154841660c0840152600780830154851660e08501526008830154610100850152600983015461ffff16610120850152600a90920154610140840152905484938493849390923392168214911480613443575060c08201516001600160a01b031633145b8061344b5750805b61347f5760405162461bcd60e51b815260206004820152600560248201526427aba722a960d91b6044820152606401610c1d565b816101400151600003613554576020808301516040805160808101825260608087015182526001600160a01b038e81169583019586526001600160801b03808f168486019081528e8216938501938452945163fc6f786560e01b815293516004850152955181166024840152925185166044830152519093166064840152169063fc6f78659060840160408051808303816000875af1158015613526573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354a9190615a24565b9096509450613871565b60008083602001516001600160a01b03166399fbab8885606001516040518263ffffffff1660e01b815260040161358d91815260200190565b61018060405180830381865afa1580156135ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135cf91906155ca565b505050505050505093509350505083602001516001600160a01b031663fc6f7865604051806080016040528087606001518152602001306001600160a01b031681526020018d6001600160801b031681526020018c6001600160801b03168152506040518263ffffffff1660e01b815260040161368a9190815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b60408051808303816000875af11580156136a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cc9190615a24565b50506040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015613715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137399190615caf565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190615caf565b90506000856137c1576009546001600160a01b03166137c3565b8d5b90506000866137d2578e6137d8565b8760e001515b9050831561382257612710886101400151856137f49190615a48565b6137fe9190615a75565b995061380b86838c613b4d565b6138158a85615cc8565b9b5061382286828e613b4d565b821561386a576127108861014001518461383c9190615a48565b6138469190615a75565b985061385385838b613b4d565b61385d8984615cc8565b9a5061386a85828d613b4d565b5050505050505b5050945094509450949050565b600061388a8383614a40565b9392505050565b60006116dc825490565b6000546001600160a01b031633146116f45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c1d565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916139729190615aa2565b6000604051808303816000865af19150503d80600081146139af576040519150601f19603f3d011682016040523d82523d6000602084013e6139b4565b606091505b50915091508180156139de5750805115806139de5750808060200190518101906139de91906156e2565b613a2a5760405162461bcd60e51b815260206004820152600360248201527f53544600000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1790529151600092839290871691613a8e9190615aa2565b6000604051808303816000865af19150503d8060008114613acb576040519150601f19603f3d011682016040523d82523d6000602084013e613ad0565b606091505b5091509150818015613afa575080511580613afa575080806020019051810190613afa91906156e2565b613b465760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b03167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691613bc29190615aa2565b6000604051808303816000865af19150503d8060008114613bff576040519150601f19603f3d011682016040523d82523d6000602084013e613c04565b606091505b5091509150818015613c2e575080511580613c2e575080806020019051810190613c2e91906156e2565b613b465760405162461bcd60e51b815260206004820152600260248201527f53540000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b600061388a8383614b3a565b600180546001600160a01b03191690556114c081614b89565b600061388a8383614bd9565b60008060008360020b12613cc2578260020b613ccf565b8260020b613ccf90615cdb565b9050613cde620d89e719615a02565b60020b811115613d305760405162461bcd60e51b815260206004820152600160248201527f54000000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b600081600116600003613d5457700100000000000000000000000000000000613d66565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615613da5576080613da0826ffff97272373d413259a46990580e213a615a48565b901c90505b6004821615613dcf576080613dca826ffff2e50f5f656932ef12357cf3c7fdcc615a48565b901c90505b6008821615613df9576080613df4826fffe5caca7e10e4e61c3624eaa0941cd0615a48565b901c90505b6010821615613e23576080613e1e826fffcb9843d60f6159c9db58835c926644615a48565b901c90505b6020821615613e4d576080613e48826fff973b41fa98c081472e6896dfb254c0615a48565b901c90505b6040821615613e77576080613e72826fff2ea16466c96a3843ec78b326b52861615a48565b901c90505b6080821615613ea1576080613e9c826ffe5dee046a99a2a811c461f1969c3053615a48565b901c90505b610100821615613ecc576080613ec7826ffcbe86c7900a88aedcffc83b479aa3a4615a48565b901c90505b610200821615613ef7576080613ef2826ff987a7253ac413176f2b074cf7815e54615a48565b901c90505b610400821615613f22576080613f1d826ff3392b0822b70005940c7a398e4b70f3615a48565b901c90505b610800821615613f4d576080613f48826fe7159475a2c29b7443b29c7fa6e889d9615a48565b901c90505b611000821615613f78576080613f73826fd097f3bdfd2022b8845ad8f792aa5825615a48565b901c90505b612000821615613fa3576080613f9e826fa9f746462d870fdf8a65dc1f90e061e5615a48565b901c90505b614000821615613fce576080613fc9826f70d869a156d2a1b890bb3df62baf32f7615a48565b901c90505b618000821615613ff9576080613ff4826f31be135f97d08fd981231505542fcfa6615a48565b901c90505b62010000821615614025576080614020826f09aa508b5b7a84e1c677de54f3e99bc9615a48565b901c90505b6202000082161561405057608061404b826e5d6af8dedb81196699c329225ee604615a48565b901c90505b6204000082161561407a576080614075826d2216e584f5fa1ea926041bedfe98615a48565b901c90505b620800008216156140a257608061409d826b048a170391f7dc42444e8fa2615a48565b901c90505b60008460020b13156140bd576140ba81600019615a75565b90505b6140cc64010000000082615d13565b156140d85760016140db565b60005b6140ec9060ff16602083901c615d27565b949350505050565b600080836001600160a01b0316856001600160a01b03161115614115579293925b846001600160a01b0316866001600160a01b03161161414057614139858585614c03565b9150611a2c565b836001600160a01b0316866001600160a01b0316101561417957614165868585614c03565b9150614172858785614c7f565b9050611a2c565b614184858585614c7f565b905094509492505050565b60808101516001600160a01b031661423257806060015134146141f45760405162461bcd60e51b815260206004820152600860248201527f464c4154204645450000000000000000000000000000000000000000000000006044820152606401610c1d565b60085460608201516040516001600160a01b039092169181156108fc0291906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b608081015160085460608301516114c0929133916001600160a01b03909116906138f5565b6040805160a08101825285815260e08501516001600160801b0390811660208301908152600083850181815260608501828152426080870190815296517f0c49ccbe000000000000000000000000000000000000000000000000000000008152955160048701529251909316602485015291516044840152516064830152915160848201526001600160a01b03871690630c49ccbe9060a40160408051808303816000875af115801561430e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143329190615a24565b50506040805160808101825286815230602082019081526001600160801b0382840181815260608401828152945163fc6f786560e01b81529351600485015291516001600160a01b039081166024850152915181166044840152925190921660648201529087169063fc6f78659060840160408051808303816000875af11580156143c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143e59190615a24565b505060006143f38787614cd2565b4261014082015230610120820152905061440c84615a02565b600290810b606083015284900b608082015280516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015614465573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144899190615caf565b60a082015260208101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156144d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144fc9190615caf565b60c0820152600060e08201819052610100820152805160a082015161452391908990613a32565b6145368160200151888360c00151613a32565b6040517f883164560000000000000000000000000000000000000000000000000000000081526000906001600160a01b0389169063883164569061457e908590600401615d3a565b6080604051808303816000875af115801561459d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145c19190615ded565b50506040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018a9052919250506001600160a01b038916906342966c6890602401600060405180830381600087803b15801561462257600080fd5b505af1158015614636573d6000803e3d6000fd5b505083516040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa158015614684573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146a89190615caf565b60208401516040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156146f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061471c9190615caf565b90508115614731578351614731908784613b4d565b80156147465761474684602001518783613b4d565b509098975050505050505050565b60405163133f757160e31b81526004810182905260009081906001600160a01b038516906399fbab889060240161018060405180830381865afa15801561479f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147c391906155ca565b50929e9d5050505050505050505050505050565b6000818152600f60209081526040808320815161016080820184528254825260018301546001600160a01b039081168387015260028401548116838601526003840154606080850191909152600485015482166080808601919091526005860154831660a0808701919091526006870154841660c080880191909152600788015490941660e080880191909152600888015461010080890191909152600989015461ffff16610120808a0191909152600a90990154610140808a01919091528a5161018081018c528d81529b8c018d9052998b018c9052938a018b90529189018a9052880189905291870188905290860187905285018690529184018590529183018490528201929092526020820151606083015160405163133f757160e31b81526001600160a01b03909216916399fbab889161491b9160040190815260200190565b61018060405180830381865afa158015614939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061495d91906155ca565b5050506001600160801b0390911660e0808b0191909152600292830b60c0808c01919091529390920b60a08a01525062ffffff9092166080808901919091526001600160a01b039384166060808a019190915293909416604080890191909152885160208a0151948a0151958a0151928a0151938a01516101008b01516101208c01516101408d01518d86015195517f3bf9c85fbe37d401523942f10940796acef64062e1a1c45647978e32f4969f5c9c50612eaf9b50949997959394929391929091908d90615e2b565b6000818152600183016020526040812054151561388a565b60008181526001830160205260408120548015614b29576000614a64600183615cc8565b8554909150600090614a7890600190615cc8565b9050818114614add576000866000018281548110614a9857614a986157ac565b9060005260206000200154905080876000018481548110614abb57614abb6157ac565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614aee57614aee615f63565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506116dc565b60009150506116dc565b5092915050565b6000818152600183016020526040812054614b81575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556116dc565b5060006116dc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826000018281548110614bf057614bf06157ac565b9060005260206000200154905092915050565b6000826001600160a01b0316846001600160a01b03161115614c23579192915b6001600160a01b038416614c757bffffffffffffffffffffffffffffffff000000000000000000000000606085901b16614c5d8787615f79565b6001600160a01b0316866001600160a01b0316614e1f565b6140ec9190615a75565b6000826001600160a01b0316846001600160a01b03161115614c9f579192915b6140ec6001600160801b038316614cb68686615f79565b6001600160a01b03166c01000000000000000000000000614e1f565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091526040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915260405163133f757160e31b8152600481018490526001600160a01b038516906399fbab889060240161018060405180830381865afa158015614dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614dee91906155ca565b50505062ffffff90941660408a01525050506001600160a01b03918216602087015250168352509091505092915050565b6000808060001985870985870292508281108382030391505080600003614e5957838281614e4f57614e4f615a5f565b049250505061388a565b808411614ea85760405162461bcd60e51b815260206004820152601560248201527f4d6174683a206d756c446976206f766572666c6f7700000000000000000000006044820152606401610c1d565b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6001600160a01b03811681146114c057600080fd5b60008060408385031215614f3957600080fd5b823591506020830135614f4b81614f11565b809150509250929050565b600080600060608486031215614f6b57600080fd5b8335614f7681614f11565b92506020840135614f8681614f11565b91506040840135614f9681614f11565b809150509250925092565b600080600080600060808688031215614fb957600080fd5b8535614fc481614f11565b94506020860135614fd481614f11565b935060408601359250606086013567ffffffffffffffff80821115614ff857600080fd5b818801915088601f83011261500c57600080fd5b81358181111561501b57600080fd5b89602082850101111561502d57600080fd5b9699959850939650602001949392505050565b60008082840360e081121561505457600080fd5b8335925060c0601f198201121561506a57600080fd5b506020830190509250929050565b60006020828403121561508a57600080fd5b813561388a81614f11565b6001600160801b03811681146114c057600080fd5b600080600080608085870312156150c057600080fd5b8435935060208501356150d281614f11565b925060408501356150e281615095565b915060608501356150f281615095565b939692955090935050565b60008060006060848603121561511257600080fd5b833561511d81614f11565b9250602084013561512d81614f11565b929592945050506040919091013590565b60006020828403121561515057600080fd5b5035919050565b60005b8381101561517257818101518382015260200161515a565b50506000910152565b60008151808452615193816020860160208601615157565b601f01601f19169290920160200192915050565b602081526000825160a060208401526151c360c084018261517b565b90506020840151604084015260408401516060840152606084015160808401526001600160a01b0360808501511660a08401528091505092915050565b6000806040838503121561521357600080fd5b823561521e81614f11565b946020939093013593505050565b81518152602080830151610160830191615250908401826001600160a01b03169052565b50604083015161526b60408401826001600160a01b03169052565b5060608301516060830152608083015161529060808401826001600160a01b03169052565b5060a08301516152ab60a08401826001600160a01b03169052565b5060c08301516152c660c08401826001600160a01b03169052565b5060e08301516152e160e08401826001600160a01b03169052565b5061010083810151908301526101208084015161ffff8116828501525b505061014092830151919092015290565b8060020b81146114c057600080fd5b6000806000806080858703121561533457600080fd5b843561533f8161530f565b9350602085013561534f8161530f565b925060408501356150e28161530f565b60006020828403121561537157600080fd5b813567ffffffffffffffff81111561538857600080fd5b8201610140818503121561388a57600080fd5b600080604083850312156153ae57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff811182821017156153f6576153f66153bd565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715615425576154256153bd565b604052919050565b600067ffffffffffffffff821115615447576154476153bd565b50601f01601f191660200190565b600082601f83011261546657600080fd5b81356154796154748261542d565b6153fc565b81815284602083860101111561548e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156154bd57600080fd5b813567ffffffffffffffff8111156154d457600080fd5b6140ec84828501615455565b6000602082840312156154f257600080fd5b813561388a8161530f565b600080600080600060a0868803121561551557600080fd5b853567ffffffffffffffff81111561552c57600080fd5b61553888828901615455565b955050602086013593506040860135925060608601359150608086013561555e81614f11565b809150509295509295909350565b60008082840360c081121561558057600080fd5b8335925060a0601f198201121561506a57600080fd5b805161270281614f11565b805162ffffff8116811461270257600080fd5b80516127028161530f565b805161270281615095565b6000806000806000806000806000806000806101808d8f0312156155ed57600080fd5b8c516bffffffffffffffffffffffff8116811461560957600080fd5b9b5061561760208e01615596565b9a5061562560408e01615596565b995061563360608e01615596565b985061564160808e016155a1565b975061564f60a08e016155b4565b965061565d60c08e016155b4565b955061566b60e08e016155bf565b94506101008d015193506101208d0151925061568a6101408e016155bf565b91506156996101608e016155bf565b90509295989b509295989b509295989b565b6000806000606084860312156156c057600080fd5b83516156cb81615095565b602085015160409095015190969495509392505050565b6000602082840312156156f457600080fd5b8151801515811461388a57600080fd5b600181811c9082168061571857607f821691505b60208210810361573857634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561575057600080fd5b813561ffff8116811461388a57600080fd5b6000808335601e1984360301811261577957600080fd5b83018035915067ffffffffffffffff82111561579457600080fd5b6020019150600581901b36038213156131a157600080fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126157d957600080fd5b83018035915067ffffffffffffffff8211156157f457600080fd5b6020019150368190038213156131a157600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040808252810183905260006060600585901b8301810190830186835b878110156158c357858403605f190183528135368a9003601e1901811261587557600080fd5b8901602081810191359067ffffffffffffffff82111561589457600080fd5b8136038313156158a357600080fd5b6158ae878385615809565b9650948501949390930192505060010161584f565b5050506001600160a01b038416602084015290506140ec565b600060208083850312156158ef57600080fd5b825167ffffffffffffffff8082111561590757600080fd5b9084019060a0828703121561591b57600080fd5b6159236153d3565b82518281111561593257600080fd5b83019150601f8201871361594557600080fd5b81516159536154748261542d565b818152888683860101111561596757600080fd5b61597682878301888701615157565b8083525050838301518482015260408301516040820152606083015160608201526159a360808401615596565b60808201529695505050505050565b6000602082840312156159c457600080fd5b815161388a81614f11565b6000602082840312156159e157600080fd5b815161388a8161530f565b634e487b7160e01b600052601160045260246000fd5b60008160020b627fffff198103615a1b57615a1b6159ec565b60000392915050565b60008060408385031215615a3757600080fd5b505080516020909101519092909150565b80820281158282048414176116dc576116dc6159ec565b634e487b7160e01b600052601260045260246000fd5b600082615a8457615a84615a5f565b500490565b600060018201615a9b57615a9b6159ec565b5060010190565b60008251615ab4818460208701615157565b9190910192915050565b60008160020b8360020b80615ad557615ad5615a5f565b627fffff19821460001982141615615aef57615aef6159ec565b90059392505050565b60008260020b8260020b028060020b9150808214614b3357614b336159ec565b601f8211156111c957600081815260208120601f850160051c81016020861015615b3f5750805b601f850160051c820191505b81811015613a2a57828155600101615b4b565b815167ffffffffffffffff811115615b7857615b786153bd565b615b8c81615b868454615704565b84615b18565b602080601f831160018114615bc15760008415615ba95750858301515b600019600386901b1c1916600185901b178555613a2a565b600085815260208120601f198616915b82811015615bf057888601518255948401946001909101908401615bd1565b5085821015615c0e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b86815260c060208201526000615c3760c083018861517b565b90508560408301528460608301528360808301526001600160a01b03831660a0830152979650505050505050565b8135815260a081016020830135615c7b81615095565b6001600160801b03811660208401525060408301356040830152606083013560608301526080830135608083015292915050565b600060208284031215615cc157600080fd5b5051919050565b818103818111156116dc576116dc6159ec565b60007f80000000000000000000000000000000000000000000000000000000000000008203615d0c57615d0c6159ec565b5060000390565b600082615d2257615d22615a5f565b500690565b808201808211156116dc576116dc6159ec565b81516001600160a01b0316815261016081016020830151615d6660208401826001600160a01b03169052565b506040830151615d7d604084018262ffffff169052565b506060830151615d92606084018260020b9052565b506080830151615da7608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e0830152610100808401518184015250610120808401516152fe828501826001600160a01b03169052565b60008060008060808587031215615e0357600080fd5b845193506020850151615e1581615095565b6040860151606090960151949790965092505050565b60006102c0820190508c82526001600160a01b03808d1660208401528b6040840152808b166060840152808a16608084015280891660a08401528760c084015261ffff871660e08401526101008681850152610120828716818601526101409250615ea683860187516bffffffffffffffffffffffff169052565b6020860151610160615ec2818801836001600160a01b03169052565b60408801516001600160a01b039081166101808901526060890151166101a0880152608088015162ffffff166101c088015260a0880151600290810b6101e089015260c0890151900b61020088015260e08801516001600160801b039081166102208901529388015161024088015291870151610260870152509185015181166102808501529301519092166102a0909101529a9950505050505050505050565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03828116828216039080821115614b3357614b336159ec56fea2646970667358221220befe154a35d734ba7e5849dfd1af07c2d3a0914833a2fc23b5485d286864686764736f6c634300081300330000000000000000000000009720526c803aeee9c7558dbd19a4d6b512a49b9400000000000000000000000012a51944e8349b8e70ed8e2d9bfbc88adb4a8f4e00000000000000000000000004bda42de3bc32abb00df46004204424d4cf828700000000000000000000000012a51944e8349b8e70ed8e2d9bfbc88adb4a8f4e

Deployed Bytecode

0x6080604052600436106102fc5760003560e01c80639f185a0b1161018f578063d68f4dd1116100e1578063ed1eee681161008a578063f2fde38b11610064578063f2fde38b14610ac9578063fae2e64814610ae9578063fe0ab56114610b0957600080fd5b8063ed1eee6814610a76578063ef24894414610a96578063f11478f814610ab657600080fd5b8063e30c3978116100bb578063e30c397814610a05578063e526dd4814610a23578063e7a7bdfe14610a5657600080fd5b8063d68f4dd1146108be578063d73792a9146109d9578063e091dd1a146109ef57600080fd5b8063b2fb30cb11610143578063cf0d5af31161011d578063cf0d5af314610786578063d1f55d451461087e578063d5fdb7321461089e57600080fd5b8063b2fb30cb14610726578063b707a28814610746578063c7a85b401461076657600080fd5b8063a35a96b811610174578063a35a96b8146106d3578063ab9ae180146106e6578063ac4521c61461070657600080fd5b80639f185a0b14610671578063a339df121461069e57600080fd5b8063454b06081161025357806375eb8e69116101fc5780638b52a6ee116101d65780638b52a6ee146106135780638da5cb5b146106335780639ecd74721461065157600080fd5b806375eb8e69146105bb57806379ba5097146105d157806383fb69ad146105e657600080fd5b80635a04fb691161022d5780635a04fb6914610566578063611f6fe614610586578063715018a6146105a657600080fd5b8063454b06081461051157806345908a4714610531578063489c18b01461055157600080fd5b8063150b7a02116102b557806323cf31181161028f57806323cf311814610491578063260e12b0146104b1578063280f3867146104f157600080fd5b8063150b7a02146103c357806318694155146104395780631f113fc31461047157600080fd5b8063066b58c7116102e6578063066b58c71461034b57806309564ab0146103835780630ae300bf146103a357600080fd5b8062f714ce14610301578063038975a114610323575b600080fd5b34801561030d57600080fd5b5061032161031c366004614f26565b610b29565b005b34801561032f57600080fd5b50610338610df6565b6040519081526020015b60405180910390f35b34801561035757600080fd5b5060075461036b906001600160a01b031681565b6040516001600160a01b039091168152602001610342565b34801561038f57600080fd5b5061032161039e366004614f56565b610e07565b3480156103af57600080fd5b5060085461036b906001600160a01b031681565b3480156103cf57600080fd5b506104086103de366004614fa1565b7f150b7a020000000000000000000000000000000000000000000000000000000095945050505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610342565b61044c610447366004615040565b610e4e565b604080516001600160801b039094168452602084019290925290820152606001610342565b34801561047d57600080fd5b5060095461036b906001600160a01b031681565b34801561049d57600080fd5b506103216104ac366004615078565b61110f565b3480156104bd57600080fd5b506104d16104cc3660046150aa565b61116b565b604080519485526020850193909352918301526060820152608001610342565b3480156104fd57600080fd5b5061032161050c3660046150fd565b6111a4565b34801561051d57600080fd5b5061032161052c36600461513e565b6111ce565b34801561053d57600080fd5b5061032161054c36600461513e565b6114c3565b34801561055d57600080fd5b50600d54610338565b34801561057257600080fd5b50610321610581366004614f26565b6115d3565b34801561059257600080fd5b506103386105a1366004615078565b6116bb565b3480156105b257600080fd5b506103216116e2565b3480156105c757600080fd5b50610338600e5481565b3480156105dd57600080fd5b506103216116f6565b3480156105f257600080fd5b5061060661060136600461513e565b611781565b60405161034291906151a7565b34801561061f57600080fd5b5061032161062e366004615078565b6118ae565b34801561063f57600080fd5b506000546001600160a01b031661036b565b34801561065d57600080fd5b50600b5461036b906001600160a01b031681565b34801561067d57600080fd5b5061069161068c366004615200565b6118d8565b604051610342919061522c565b3480156106aa57600080fd5b506106be6106b936600461531e565b611a00565b60408051928352602083019190915201610342565b6103386106e136600461535f565b611a35565b3480156106f257600080fd5b50610321610701366004614f26565b612707565b34801561071257600080fd5b50610321610721366004614f26565b612758565b34801561073257600080fd5b5061032161074136600461539b565b6127cd565b34801561075257600080fd5b50610321610761366004614f26565b61290a565b34801561077257600080fd5b50600c5461036b906001600160a01b031681565b34801561079257600080fd5b506108126107a136600461513e565b600f60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600a909a015498996001600160a01b039889169997891698969795871696948516959385169490921692909161ffff16908b565b604080519b8c526001600160a01b039a8b1660208d0152988a16988b019890985260608a0196909652938716608089015291861660a0880152851660c087015290931660e085015261010084019290925261ffff90911661012083015261014082015261016001610342565b34801561088a57600080fd5b5060065461036b906001600160a01b031681565b3480156108aa57600080fd5b506103216108b93660046154ab565b6129c4565b3480156108ca57600080fd5b506106916108d936600461513e565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081018290526101208101829052610140810191909152506000908152600f60209081526040918290208251610160810184528154815260018201546001600160a01b03908116938201939093526002820154831693810193909352600381015460608401526004810154821660808401526005810154821660a08401526006810154821660c0840152600781015490911660e08301526008810154610100830152600981015461ffff16610120830152600a015461014082015290565b3480156109e557600080fd5b5061033861271081565b3480156109fb57600080fd5b50610338600d5481565b348015610a1157600080fd5b506001546001600160a01b031661036b565b348015610a2f57600080fd5b50610a43610a3e3660046154e0565b612ab9565b60405160029190910b8152602001610342565b348015610a6257600080fd5b50610321610a713660046154fd565b612ad3565b348015610a8257600080fd5b50610606610a913660046154ab565b612c6b565b348015610aa257600080fd5b50610321610ab136600461539b565b612e0d565b6106be610ac436600461556c565b612ebc565b348015610ad557600080fd5b50610321610ae4366004615078565b6131a8565b348015610af557600080fd5b50610321610b04366004615078565b613219565b348015610b1557600080fd5b50600a5461036b906001600160a01b031681565b610b31613243565b610b3a8261329a565b6000828152600f60209081526040918290208251610160810184528154815260018201546001600160a01b03908116938201939093526002820154831693810193909352600381015460608401526004810154821660808401526005810154821660a08401526006810154821660c0840152600781015490911660e083015260088101546101008301819052600982015461ffff16610120840152600a90910154610140830152600e549003610c265760405162461bcd60e51b815260206004820152600c60248201526b455445524e414c5f4c4f434b60a01b60448201526064015b60405180910390fd5b4281610100015110610c645760405162461bcd60e51b81526020600482015260076024820152661393d50816515560ca1b6044820152606401610c1d565b61014081015115610c8757610c8283836001600160801b0380613375565b505050505b60208101516060820151604051632142170760e11b81523060048201526001600160a01b03858116602483015260448201929092529116906342842e0e90606401600060405180830381600087803b158015610ce257600080fd5b505af1158015610cf6573d6000803e3d6000fd5b50505060808201516001600160a01b03166000908152601060205260409020610d2091508461387e565b506080810151604080518581526001600160a01b03928316602082015291841682820152517fcf3f38c6e10e7fa2c0a2d09ff592596efa8ea3865dd7aabb9bff9c5189c607a89181900360600190a1506000828152600f602052604081208181556001810180546001600160a01b0319908116909155600282018054821690556003820183905560048201805482169055600582018054821690556006820180548216905560078201805490911690556008810182905560098101805461ffff19169055600a0155610df26001600255565b5050565b6000610e026004613891565b905090565b610e0f61389b565b600780546001600160a01b039485166001600160a01b031991821617909155600880549385169382169390931790925560098054919093169116179055565b6000806000610e5b613243565b6000858152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382019390935260028201548316938101939093526003810154606084018190526004820154831660808501526005820154831660a08501526006820154831660c0850152600782015490921660e08401526008810154610100840152600981015461ffff16610120840152600a0154610140830152853514610f385760405162461bcd60e51b815260206004820152600660248201526513919508125160d21b6044820152606401610c1d565b60008082602001516001600160a01b03166399fbab8884606001516040518263ffffffff1660e01b8152600401610f7191815260200190565b61018060405180830381865afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb391906155ca565b5050505050505050935093505050610fd18233308a602001356138f5565b610fe18133308a604001356138f5565b610ff48284602001518960200135613a32565b6110078184602001518960400135613a32565b602080840151604080517f219f5d170000000000000000000000000000000000000000000000000000000081528a356004820152928a013560248401528901356044830152606089013560648301526080890135608483015260a089013560a48301526001600160a01b03169063219f5d179060c4016060604051808303816000875af115801561109c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c091906156ab565b6040518b815292985090965094507f38f5d789b3e0e71e68d20081e98d4b02ae7ecab7482b6634306b2261e90f806f9060200160405180910390a15050506111086001600255565b9250925092565b61111761389b565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f48af0f3916eee80364290b1aca1b04532ba7394a23ceeb066b5df1aa9c5b51c49060200160405180910390a150565b600080600080611179613243565b61118588888888613375565b929650909450925090506111996001600255565b945094509450949050565b6111ac61389b565b6111b4613243565b6111bf838383613b4d565b6111c96001600255565b505050565b6111d6613243565b600b546001600160a01b031661122e5760405162461bcd60e51b815260206004820152600760248201527f4e4f5420534554000000000000000000000000000000000000000000000000006044820152606401610c1d565b6112378161329a565b6000818152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382018490526002830154811682860152600383015460608301819052600480850154831660808501526005850154831660a08501526006850154831660c08501526007850154831660e08501526008850154610100850152600985015461ffff16610120850152600a90940154610140840152600b54955163095ea7b360e01b8152959091169285019290925260248401919091529163095ea7b390604401600060405180830381600087803b15801561132057600080fd5b505af1158015611334573d6000803e3d6000fd5b5050600b54602084015160608501516040517f4ef88bea000000000000000000000000000000000000000000000000000000008152600481018890526001600160a01b039283166024820152604481019190915291169250634ef88bea91506064016020604051808303816000875af11580156113b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d991906156e2565b5060808101516001600160a01b03166000908152601060205260409020611400908361387e565b506000828152600f60205260408082208281556001810180546001600160a01b0319908116909155600282018054821690556003820184905560048201805482169055600582018054821690556006820180548216905560078201805490911690556008810183905560098101805461ffff19169055600a0191909155517f97923ecdf32419caa09669588eaa60fcc1c41069814b4f4f52ec31e9fdec1aea906114ad9084815260200190565b60405180910390a1506114c06001600255565b50565b6114cb613243565b6000818152600f6020526040902060058101546001600160a01b0316331461151d5760405162461bcd60e51b815260206004820152600560248201526427aba722a960d91b6044820152606401610c1d565b60048101546001600160a01b03166000818152601060205260409020611543908461387e565b50600482018054336001600160a01b031991821681179092556005840180549091169055600090815260106020526040902061157f9084613c7a565b50604080518481526001600160a01b0383166020820152338183015290517ff91adf142bcf2de4e78197d8153f97cc3bf959173f88d7e5091f50d40e1085fe9181900360600190a150506114c06001600255565b6115db613243565b6115e48261329a565b6001600160a01b038116330361163c5760405162461bcd60e51b815260206004820152600a60248201527f53414d45204f574e4552000000000000000000000000000000000000000000006044820152606401610c1d565b6000828152600f60209081526040918290206005810180546001600160a01b0319166001600160a01b03861690811790915583518681523393810193909352928201929092527f7336363d3c1722824dac3c93d1256b57d394f59da51548af7e779e47c13fff10906060015b60405180910390a150610df26001600255565b6001600160a01b03811660009081526010602052604081206116dc90613891565b92915050565b6116ea61389b565b6116f46000613c86565b565b60015433906001600160a01b031681146117785760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f74207468652060448201527f6e6577206f776e657200000000000000000000000000000000000000000000006064820152608401610c1d565b6114c081613c86565b6117bc6040518060a001604052806060815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600360006117cb600485613c9f565b81526020019081526020016000206040518060a00160405290816000820180546117f490615704565b80601f016020809104026020016040519081016040528092919081815260200182805461182090615704565b801561186d5780601f106118425761010080835404028352916020019161186d565b820191906000526020600020905b81548152906001019060200180831161185057829003601f168201915b50505091835250506001820154602082015260028201546040820152600382015460608201526004909101546001600160a01b031660809091015292915050565b6118b661389b565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b604080516101608101825260008082526020808301829052828401829052606083018290526080830182905260a0830182905260c0830182905260e083018290526101008301829052610120830182905261014083018290526001600160a01b0386168252601090529182209091600f916119539085613c9f565b815260208082019290925260409081016000208151610160810183528154815260018201546001600160a01b03908116948201949094526002820154841692810192909252600381015460608301526004810154831660808301526005810154831660a08301526006810154831660c0830152600781015490921660e08201526008820154610100820152600982015461ffff16610120820152600a909101546101408201529392505050565b600080611a27611a0f87613cab565b611a1887613cab565b611a2187613cab565b866140f4565b915091505b94509492505050565b6000611a3f613243565b6000611a516080840160608501615078565b6001600160a01b031603611a6457600080fd5b6000611a7660c0840160a08501615078565b6001600160a01b031603611abb5760405162461bcd60e51b815260206004820152600c60248201526b21a7a62622a1aa2fa0a2222960a11b6044820152606401610c1d565b6402540be4008260c001351080611ad75750600e548260c00135145b611b125760405162461bcd60e51b815260206004820152600c60248201526b4d494c4c495345434f4e445360a01b6044820152606401610c1d565b428260c0013511611b535760405162461bcd60e51b815260206004820152600b60248201526a1110551148141054d4d15160aa1b6044820152606401610c1d565b600a546001600160a01b0316635cb49b55611b75610100850160e0860161573e565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261ffff9091166004820152602401602060405180830381865afa158015611bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf091906156e2565b611c3c5760405162461bcd60e51b815260206004820152600760248201527f434f554e545259000000000000000000000000000000000000000000000000006044820152606401610c1d565b611c776040518060a001604052806060815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600c546001600160a01b03163303611cd157611c97610120840184615762565b6000818110611ca857611ca86157ac565b9050602002810190611cba91906157c2565b810190611cc7919061513e565b6040820152611dd6565b6000611ce1610120850185615762565b90501115611d75576006546001600160a01b03166332c07c9e611d08610120860186615762565b336040518463ffffffff1660e01b8152600401611d2793929190615832565b6000604051808303816000875af1158015611d46573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d6e91908101906158dc565b9050611dc3565b611dc0611d866101008501856157c2565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612c6b92505050565b90505b606081015115611dd657611dd68161418f565b611de36020840184615078565b604051632142170760e11b8152336004820152306024820152602085013560448201526001600160a01b0391909116906342842e0e90606401600060405180830381600087803b158015611e3657600080fd5b505af1158015611e4a573d6000803e3d6000fd5b50506040805161018081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081018290526101608101919091529150611eb69050565b611ec36020850185615078565b60405163133f757160e31b8152602086013560048201526001600160a01b0391909116906399fbab889060240161018060405180830381865afa158015611f0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3291906155ca565b505050506001600160801b031660e0890152600290810b60c08901520b60a087015262ffffff1660808601526001600160a01b0390811660608601521660408401525060009050611f866020860186615078565b6001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe791906159b2565b6040808401516060850151608086015192517f1698ee820000000000000000000000000000000000000000000000000000000081526001600160a01b039283166004820152908216602482015262ffffff9092166044830152919250600091831690631698ee8290606401602060405180830381865afa15801561206f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209391906159b2565b60808401516040517f22afcccb00000000000000000000000000000000000000000000000000000000815262ffffff9091166004820152909150600090612129906001600160a01b038516906322afcccb90602401602060405180830381865afa158015612105573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3e91906159cf565b9050600061213682615a02565b60020b8560a0015160020b1415801561215957508160020b8560c0015160020b14155b156121915761218a61216e60208a018a615078565b60208a0135878561218560608e0160408f01615078565b614257565b9050612297565b50602087018035906121a39089615078565b6001600160a01b031663fc6f786560405180608001604052808481526020018b60400160208101906121d59190615078565b6001600160a01b0390811682526001600160801b0360208084018290526040938401829052835160e087901b7fffffffff0000000000000000000000000000000000000000000000000000000016815285516004820152908501519092166024830152918301518216604482015260609092015116606482015260840160408051808303816000875af1158015612270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122949190615a24565b50505b6020860151156124915760006122b96122b360208b018b615078565b83614754565b90506122c860208a018a615078565b6001600160a01b0316630c49ccbe6040518060a001604052808581526020016127108b60200151866001600160801b03166123039190615a48565b61230d9190615a75565b6001600160801b031681526020016000815260200160008152602001428152506040518263ffffffff1660e01b81526004016123879190600060a082019050825182526001600160801b03602084015116602083015260408301516040830152606083015160608301526080830151608083015292915050565b60408051808303816000875af11580156123a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c99190615a24565b506123d9905060208a018a615078565b604080516080810182528481526008546001600160a01b03908116602083019081526001600160801b0383850181815260608501828152955163fc6f786560e01b8152945160048601529151831660248501529051811660448401529251909216606482015291169063fc6f78659060840160408051808303816000875af1158015612469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248d9190615a24565b5050505b604080516101608101825260006020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082018190526101208201819052610140820152600d548152906124f7908a018a615078565b6001600160a01b0390811660208301528416604082015260608082018390526125269060808b01908b01615078565b6001600160a01b03166080808301919091526125489060a08b01908b01615078565b6001600160a01b031660c080830191909152612569908a0160a08b01615078565b6001600160a01b031660e08083019190915260c08a01356101008084019190915261259991908b01908b0161573e565b61ffff90811661012083019081526040898101516101408501908152600d80546000908152600f602090815284822088518155908801516001820180546001600160a01b03199081166001600160a01b03938416179091559589015160028301805488169183169190911790556060808a015160038401556080808b01516004850180548a1691851691909117905560a08b01516005850180548a1691851691909117905560c08b01516006850180548a1691851691909117905560e08b01516007850180549099169316929092179096556101008901516008830155955160098201805461ffff191691909816179096559151600a9095019490945592546126ce9390926010926126af918f01908f01615078565b6001600160a01b03168152602081019190915260400160002090613c7a565b50600d80549060006126df83615a89565b909155505080516126ef906147d7565b5196505050505050506127026001600255565b919050565b61270f61389b565b612717613243565b6040516001600160a01b0382169083156108fc029084906000818181858888f1935050505015801561274d573d6000803e3d6000fd5b50610df26001600255565b612760613243565b6127698261329a565b6000828152600f60209081526040918290206006810180546001600160a01b0319166001600160a01b038616908117909155835186815292830152917fda22afd9d1e0640f160cada74dec56452db8535daf46772df2c5f7a3af46485f91016116a8565b6127d5613243565b6127de8261329a565b6000828152600f60205260409020600881015482116128415760405162461bcd60e51b8152600401610c1d9060208082526004908201527f4441544500000000000000000000000000000000000000000000000000000000604082015260600190565b42821161287e5760405162461bcd60e51b815260206004820152600b60248201526a1110551148141054d4d15160aa1b6044820152606401610c1d565b6402540be4008210806128925750600e5482145b6128cd5760405162461bcd60e51b815260206004820152600c60248201526b4d494c4c495345434f4e445360a01b6044820152606401610c1d565b6008810182905560408051848152602081018490527fefaff1b90138281d215452c67f793017f52e456f65c28ac63f5309a89a059b4791016116a8565b612912613243565b61291b8261329a565b6001600160a01b0381166129605760405162461bcd60e51b815260206004820152600c60248201526b21a7a62622a1aa2fa0a2222960a11b6044820152606401610c1d565b6000828152600f60209081526040918290206007810180546001600160a01b0319166001600160a01b038616908117909155835186815292830152917ff47f77d5d198f5b58faaca8c7dc86ebe53925091c07487a01ec62159ff16664e91016116a8565b6129cc61389b565b6000816040516020016129df9190615aa2565b604051602081830303815290604052805190602001209050604051602001612a1490661111519055531560ca1b815260070190565b604051602081830303815290604052805190602001208103612a625760405162461bcd60e51b81526020600482015260076024820152661111519055531560ca1b6044820152606401610c1d565b612a6d600482614a28565b612a7657600080fd5b612a8160048261387e565b506040518181527faea1931d5fe74928dff1db9836d2d9de778b60cb4afc9ec70c9a1f16b58598a59060200160405180910390a15050565b600081612ac981620d89e8615abe565b6116dc9190615af8565b612adb61389b565b600085604051602001612aee9190615aa2565b60408051601f19818403018152828252805160209182012060a084018352898452838201899052838301889052606084018790526001600160a01b038616608085015260008181526003909252919020825191935082918190612b519082615b5e565b50602082015160018201556040820151600282015560608201516003820155608090910151600491820180546001600160a01b0319166001600160a01b03909216919091179055612ba29083614a28565b612c0c57612bb1600483613c7a565b507f335d96fad821252e8298f51336937e44332b3731a3c3f249b2cdb77652b33e4f8282600001518360200151846040015185606001518660800151604051612bff96959493929190615c1e565b60405180910390a1612c62565b7fdd151e7029525c623e7c09af0f71271bd7642edd1bf2f64d97bc552faba7c86d8282600001518360200151846040015185606001518660800151604051612c5996959493929190615c1e565b60405180910390a15b50505050505050565b612ca66040518060a001604052806060815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b600082604051602001612cb99190615aa2565b60408051601f1981840301815291905280516020909101209050612cde600482614a28565b612d2a5760405162461bcd60e51b815260206004820152600960248201527f4e4f5420464f554e4400000000000000000000000000000000000000000000006044820152606401610c1d565b60008181526003602052604090819020815160a08101909252805482908290612d5290615704565b80601f0160208091040260200160405190810160405280929190818152602001828054612d7e90615704565b8015612dcb5780601f10612da057610100808354040283529160200191612dcb565b820191906000526020600020905b815481529060010190602001808311612dae57829003601f168201915b50505091835250506001820154602082015260028201546040820152600382015460608201526004909101546001600160a01b03166080909101529392505050565b612e1561389b565b6000828152600f60205260409020600a8101548210612e765760405162461bcd60e51b815260206004820152600160248201527f4c000000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b600a810182905560408051848152602081018490527fa4b63b21571e7c2b944a681b0a39cda220f85f67aaa7aa4d23fcf7d31e2379a391015b60405180910390a1505050565b600080612ec7613243565b612ed08461329a565b6000848152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382019390935260028201548316938101939093526003810154606084018190526004820154831660808501526005820154831660a08501526006820154831660c0850152600782015490921660e08401526008810154610100840152600981015461ffff16610120840152600a0154610140830152843514612fad5760405162461bcd60e51b815260206004820152600660248201526513919508125160d21b6044820152606401610c1d565b600e5481610100015103612ff25760405162461bcd60e51b815260206004820152600c60248201526b455445524e414c5f4c4f434b60a01b6044820152606401610c1d565b42816101000151106130305760405162461bcd60e51b81526020600482015260076024820152661393d50816515560ca1b6044820152606401610c1d565b80602001516001600160a01b0316630c49ccbe856040518263ffffffff1660e01b81526004016130609190615c65565b60408051808303816000875af115801561307e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130a29190615a24565b602083810151604080516080810182526060808801518252339482019485526001600160801b03828401818152918301818152935163fc6f786560e01b81529251600484015294516001600160a01b0390811660248401529051851660448301529151909316606484015293965091945091169063fc6f78659060840160408051808303816000875af115801561313d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131619190615a24565b50506040518581527fffeb250f5933abd95c7c8e2c0317b8041dc9c5a309b73fa772f533ddd085dd3a9060200160405180910390a1506131a16001600255565b9250929050565b6131b061389b565b600180546001600160a01b0383166001600160a01b031990911681179091556131e16000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b61322161389b565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60028054036132945760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c1d565b60028055565b6000818152600f60209081526040918290208251610160810184528154815260018201546001600160a01b039081169382019390935260028201548316938101939093526003810154606084015260048101548216608084018190526005820154831660a08501526006820154831660c0850152600782015490921660e08401526008810154610100840152600981015461ffff16610120840152600a01546101408301523314610df25760405162461bcd60e51b815260206004820152600560248201526427aba722a960d91b6044820152606401610c1d565b6000848152600f602090815260408083208151610160810183528154815260018201546001600160a01b039081169482019490945260028201548416928101929092526003810154606083015260048101548316608083018190526005820154841660a08401526006820154841660c0840152600780830154851660e08501526008830154610100850152600983015461ffff16610120850152600a90920154610140840152905484938493849390923392168214911480613443575060c08201516001600160a01b031633145b8061344b5750805b61347f5760405162461bcd60e51b815260206004820152600560248201526427aba722a960d91b6044820152606401610c1d565b816101400151600003613554576020808301516040805160808101825260608087015182526001600160a01b038e81169583019586526001600160801b03808f168486019081528e8216938501938452945163fc6f786560e01b815293516004850152955181166024840152925185166044830152519093166064840152169063fc6f78659060840160408051808303816000875af1158015613526573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061354a9190615a24565b9096509450613871565b60008083602001516001600160a01b03166399fbab8885606001516040518263ffffffff1660e01b815260040161358d91815260200190565b61018060405180830381865afa1580156135ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135cf91906155ca565b505050505050505093509350505083602001516001600160a01b031663fc6f7865604051806080016040528087606001518152602001306001600160a01b031681526020018d6001600160801b031681526020018c6001600160801b03168152506040518263ffffffff1660e01b815260040161368a9190815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b60408051808303816000875af11580156136a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cc9190615a24565b50506040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015613715573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137399190615caf565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190615caf565b90506000856137c1576009546001600160a01b03166137c3565b8d5b90506000866137d2578e6137d8565b8760e001515b9050831561382257612710886101400151856137f49190615a48565b6137fe9190615a75565b995061380b86838c613b4d565b6138158a85615cc8565b9b5061382286828e613b4d565b821561386a576127108861014001518461383c9190615a48565b6138469190615a75565b985061385385838b613b4d565b61385d8984615cc8565b9a5061386a85828d613b4d565b5050505050505b5050945094509450949050565b600061388a8383614a40565b9392505050565b60006116dc825490565b6000546001600160a01b031633146116f45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c1d565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916139729190615aa2565b6000604051808303816000865af19150503d80600081146139af576040519150601f19603f3d011682016040523d82523d6000602084013e6139b4565b606091505b50915091508180156139de5750805115806139de5750808060200190518101906139de91906156e2565b613a2a5760405162461bcd60e51b815260206004820152600360248201527f53544600000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1790529151600092839290871691613a8e9190615aa2565b6000604051808303816000865af19150503d8060008114613acb576040519150601f19603f3d011682016040523d82523d6000602084013e613ad0565b606091505b5091509150818015613afa575080511580613afa575080806020019051810190613afa91906156e2565b613b465760405162461bcd60e51b815260206004820152600260248201527f53410000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b03167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691613bc29190615aa2565b6000604051808303816000865af19150503d8060008114613bff576040519150601f19603f3d011682016040523d82523d6000602084013e613c04565b606091505b5091509150818015613c2e575080511580613c2e575080806020019051810190613c2e91906156e2565b613b465760405162461bcd60e51b815260206004820152600260248201527f53540000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b600061388a8383614b3a565b600180546001600160a01b03191690556114c081614b89565b600061388a8383614bd9565b60008060008360020b12613cc2578260020b613ccf565b8260020b613ccf90615cdb565b9050613cde620d89e719615a02565b60020b811115613d305760405162461bcd60e51b815260206004820152600160248201527f54000000000000000000000000000000000000000000000000000000000000006044820152606401610c1d565b600081600116600003613d5457700100000000000000000000000000000000613d66565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615613da5576080613da0826ffff97272373d413259a46990580e213a615a48565b901c90505b6004821615613dcf576080613dca826ffff2e50f5f656932ef12357cf3c7fdcc615a48565b901c90505b6008821615613df9576080613df4826fffe5caca7e10e4e61c3624eaa0941cd0615a48565b901c90505b6010821615613e23576080613e1e826fffcb9843d60f6159c9db58835c926644615a48565b901c90505b6020821615613e4d576080613e48826fff973b41fa98c081472e6896dfb254c0615a48565b901c90505b6040821615613e77576080613e72826fff2ea16466c96a3843ec78b326b52861615a48565b901c90505b6080821615613ea1576080613e9c826ffe5dee046a99a2a811c461f1969c3053615a48565b901c90505b610100821615613ecc576080613ec7826ffcbe86c7900a88aedcffc83b479aa3a4615a48565b901c90505b610200821615613ef7576080613ef2826ff987a7253ac413176f2b074cf7815e54615a48565b901c90505b610400821615613f22576080613f1d826ff3392b0822b70005940c7a398e4b70f3615a48565b901c90505b610800821615613f4d576080613f48826fe7159475a2c29b7443b29c7fa6e889d9615a48565b901c90505b611000821615613f78576080613f73826fd097f3bdfd2022b8845ad8f792aa5825615a48565b901c90505b612000821615613fa3576080613f9e826fa9f746462d870fdf8a65dc1f90e061e5615a48565b901c90505b614000821615613fce576080613fc9826f70d869a156d2a1b890bb3df62baf32f7615a48565b901c90505b618000821615613ff9576080613ff4826f31be135f97d08fd981231505542fcfa6615a48565b901c90505b62010000821615614025576080614020826f09aa508b5b7a84e1c677de54f3e99bc9615a48565b901c90505b6202000082161561405057608061404b826e5d6af8dedb81196699c329225ee604615a48565b901c90505b6204000082161561407a576080614075826d2216e584f5fa1ea926041bedfe98615a48565b901c90505b620800008216156140a257608061409d826b048a170391f7dc42444e8fa2615a48565b901c90505b60008460020b13156140bd576140ba81600019615a75565b90505b6140cc64010000000082615d13565b156140d85760016140db565b60005b6140ec9060ff16602083901c615d27565b949350505050565b600080836001600160a01b0316856001600160a01b03161115614115579293925b846001600160a01b0316866001600160a01b03161161414057614139858585614c03565b9150611a2c565b836001600160a01b0316866001600160a01b0316101561417957614165868585614c03565b9150614172858785614c7f565b9050611a2c565b614184858585614c7f565b905094509492505050565b60808101516001600160a01b031661423257806060015134146141f45760405162461bcd60e51b815260206004820152600860248201527f464c4154204645450000000000000000000000000000000000000000000000006044820152606401610c1d565b60085460608201516040516001600160a01b039092169181156108fc0291906000818181858888f19350505050158015610df2573d6000803e3d6000fd5b608081015160085460608301516114c0929133916001600160a01b03909116906138f5565b6040805160a08101825285815260e08501516001600160801b0390811660208301908152600083850181815260608501828152426080870190815296517f0c49ccbe000000000000000000000000000000000000000000000000000000008152955160048701529251909316602485015291516044840152516064830152915160848201526001600160a01b03871690630c49ccbe9060a40160408051808303816000875af115801561430e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143329190615a24565b50506040805160808101825286815230602082019081526001600160801b0382840181815260608401828152945163fc6f786560e01b81529351600485015291516001600160a01b039081166024850152915181166044840152925190921660648201529087169063fc6f78659060840160408051808303816000875af11580156143c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143e59190615a24565b505060006143f38787614cd2565b4261014082015230610120820152905061440c84615a02565b600290810b606083015284900b608082015280516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015614465573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144899190615caf565b60a082015260208101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156144d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144fc9190615caf565b60c0820152600060e08201819052610100820152805160a082015161452391908990613a32565b6145368160200151888360c00151613a32565b6040517f883164560000000000000000000000000000000000000000000000000000000081526000906001600160a01b0389169063883164569061457e908590600401615d3a565b6080604051808303816000875af115801561459d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145c19190615ded565b50506040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018a9052919250506001600160a01b038916906342966c6890602401600060405180830381600087803b15801561462257600080fd5b505af1158015614636573d6000803e3d6000fd5b505083516040516370a0823160e01b8152306004820152600093506001600160a01b0390911691506370a0823190602401602060405180830381865afa158015614684573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906146a89190615caf565b60208401516040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156146f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061471c9190615caf565b90508115614731578351614731908784613b4d565b80156147465761474684602001518783613b4d565b509098975050505050505050565b60405163133f757160e31b81526004810182905260009081906001600160a01b038516906399fbab889060240161018060405180830381865afa15801561479f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906147c391906155ca565b50929e9d5050505050505050505050505050565b6000818152600f60209081526040808320815161016080820184528254825260018301546001600160a01b039081168387015260028401548116838601526003840154606080850191909152600485015482166080808601919091526005860154831660a0808701919091526006870154841660c080880191909152600788015490941660e080880191909152600888015461010080890191909152600989015461ffff16610120808a0191909152600a90990154610140808a01919091528a5161018081018c528d81529b8c018d9052998b018c9052938a018b90529189018a9052880189905291870188905290860187905285018690529184018590529183018490528201929092526020820151606083015160405163133f757160e31b81526001600160a01b03909216916399fbab889161491b9160040190815260200190565b61018060405180830381865afa158015614939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061495d91906155ca565b5050506001600160801b0390911660e0808b0191909152600292830b60c0808c01919091529390920b60a08a01525062ffffff9092166080808901919091526001600160a01b039384166060808a019190915293909416604080890191909152885160208a0151948a0151958a0151928a0151938a01516101008b01516101208c01516101408d01518d86015195517f3bf9c85fbe37d401523942f10940796acef64062e1a1c45647978e32f4969f5c9c50612eaf9b50949997959394929391929091908d90615e2b565b6000818152600183016020526040812054151561388a565b60008181526001830160205260408120548015614b29576000614a64600183615cc8565b8554909150600090614a7890600190615cc8565b9050818114614add576000866000018281548110614a9857614a986157ac565b9060005260206000200154905080876000018481548110614abb57614abb6157ac565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614aee57614aee615f63565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506116dc565b60009150506116dc565b5092915050565b6000818152600183016020526040812054614b81575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556116dc565b5060006116dc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826000018281548110614bf057614bf06157ac565b9060005260206000200154905092915050565b6000826001600160a01b0316846001600160a01b03161115614c23579192915b6001600160a01b038416614c757bffffffffffffffffffffffffffffffff000000000000000000000000606085901b16614c5d8787615f79565b6001600160a01b0316866001600160a01b0316614e1f565b6140ec9190615a75565b6000826001600160a01b0316846001600160a01b03161115614c9f579192915b6140ec6001600160801b038316614cb68686615f79565b6001600160a01b03166c01000000000000000000000000614e1f565b6040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101919091526040805161016081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290526101008101829052610120810182905261014081019190915260405163133f757160e31b8152600481018490526001600160a01b038516906399fbab889060240161018060405180830381865afa158015614dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614dee91906155ca565b50505062ffffff90941660408a01525050506001600160a01b03918216602087015250168352509091505092915050565b6000808060001985870985870292508281108382030391505080600003614e5957838281614e4f57614e4f615a5f565b049250505061388a565b808411614ea85760405162461bcd60e51b815260206004820152601560248201527f4d6174683a206d756c446976206f766572666c6f7700000000000000000000006044820152606401610c1d565b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6001600160a01b03811681146114c057600080fd5b60008060408385031215614f3957600080fd5b823591506020830135614f4b81614f11565b809150509250929050565b600080600060608486031215614f6b57600080fd5b8335614f7681614f11565b92506020840135614f8681614f11565b91506040840135614f9681614f11565b809150509250925092565b600080600080600060808688031215614fb957600080fd5b8535614fc481614f11565b94506020860135614fd481614f11565b935060408601359250606086013567ffffffffffffffff80821115614ff857600080fd5b818801915088601f83011261500c57600080fd5b81358181111561501b57600080fd5b89602082850101111561502d57600080fd5b9699959850939650602001949392505050565b60008082840360e081121561505457600080fd5b8335925060c0601f198201121561506a57600080fd5b506020830190509250929050565b60006020828403121561508a57600080fd5b813561388a81614f11565b6001600160801b03811681146114c057600080fd5b600080600080608085870312156150c057600080fd5b8435935060208501356150d281614f11565b925060408501356150e281615095565b915060608501356150f281615095565b939692955090935050565b60008060006060848603121561511257600080fd5b833561511d81614f11565b9250602084013561512d81614f11565b929592945050506040919091013590565b60006020828403121561515057600080fd5b5035919050565b60005b8381101561517257818101518382015260200161515a565b50506000910152565b60008151808452615193816020860160208601615157565b601f01601f19169290920160200192915050565b602081526000825160a060208401526151c360c084018261517b565b90506020840151604084015260408401516060840152606084015160808401526001600160a01b0360808501511660a08401528091505092915050565b6000806040838503121561521357600080fd5b823561521e81614f11565b946020939093013593505050565b81518152602080830151610160830191615250908401826001600160a01b03169052565b50604083015161526b60408401826001600160a01b03169052565b5060608301516060830152608083015161529060808401826001600160a01b03169052565b5060a08301516152ab60a08401826001600160a01b03169052565b5060c08301516152c660c08401826001600160a01b03169052565b5060e08301516152e160e08401826001600160a01b03169052565b5061010083810151908301526101208084015161ffff8116828501525b505061014092830151919092015290565b8060020b81146114c057600080fd5b6000806000806080858703121561533457600080fd5b843561533f8161530f565b9350602085013561534f8161530f565b925060408501356150e28161530f565b60006020828403121561537157600080fd5b813567ffffffffffffffff81111561538857600080fd5b8201610140818503121561388a57600080fd5b600080604083850312156153ae57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff811182821017156153f6576153f66153bd565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715615425576154256153bd565b604052919050565b600067ffffffffffffffff821115615447576154476153bd565b50601f01601f191660200190565b600082601f83011261546657600080fd5b81356154796154748261542d565b6153fc565b81815284602083860101111561548e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156154bd57600080fd5b813567ffffffffffffffff8111156154d457600080fd5b6140ec84828501615455565b6000602082840312156154f257600080fd5b813561388a8161530f565b600080600080600060a0868803121561551557600080fd5b853567ffffffffffffffff81111561552c57600080fd5b61553888828901615455565b955050602086013593506040860135925060608601359150608086013561555e81614f11565b809150509295509295909350565b60008082840360c081121561558057600080fd5b8335925060a0601f198201121561506a57600080fd5b805161270281614f11565b805162ffffff8116811461270257600080fd5b80516127028161530f565b805161270281615095565b6000806000806000806000806000806000806101808d8f0312156155ed57600080fd5b8c516bffffffffffffffffffffffff8116811461560957600080fd5b9b5061561760208e01615596565b9a5061562560408e01615596565b995061563360608e01615596565b985061564160808e016155a1565b975061564f60a08e016155b4565b965061565d60c08e016155b4565b955061566b60e08e016155bf565b94506101008d015193506101208d0151925061568a6101408e016155bf565b91506156996101608e016155bf565b90509295989b509295989b509295989b565b6000806000606084860312156156c057600080fd5b83516156cb81615095565b602085015160409095015190969495509392505050565b6000602082840312156156f457600080fd5b8151801515811461388a57600080fd5b600181811c9082168061571857607f821691505b60208210810361573857634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561575057600080fd5b813561ffff8116811461388a57600080fd5b6000808335601e1984360301811261577957600080fd5b83018035915067ffffffffffffffff82111561579457600080fd5b6020019150600581901b36038213156131a157600080fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126157d957600080fd5b83018035915067ffffffffffffffff8211156157f457600080fd5b6020019150368190038213156131a157600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040808252810183905260006060600585901b8301810190830186835b878110156158c357858403605f190183528135368a9003601e1901811261587557600080fd5b8901602081810191359067ffffffffffffffff82111561589457600080fd5b8136038313156158a357600080fd5b6158ae878385615809565b9650948501949390930192505060010161584f565b5050506001600160a01b038416602084015290506140ec565b600060208083850312156158ef57600080fd5b825167ffffffffffffffff8082111561590757600080fd5b9084019060a0828703121561591b57600080fd5b6159236153d3565b82518281111561593257600080fd5b83019150601f8201871361594557600080fd5b81516159536154748261542d565b818152888683860101111561596757600080fd5b61597682878301888701615157565b8083525050838301518482015260408301516040820152606083015160608201526159a360808401615596565b60808201529695505050505050565b6000602082840312156159c457600080fd5b815161388a81614f11565b6000602082840312156159e157600080fd5b815161388a8161530f565b634e487b7160e01b600052601160045260246000fd5b60008160020b627fffff198103615a1b57615a1b6159ec565b60000392915050565b60008060408385031215615a3757600080fd5b505080516020909101519092909150565b80820281158282048414176116dc576116dc6159ec565b634e487b7160e01b600052601260045260246000fd5b600082615a8457615a84615a5f565b500490565b600060018201615a9b57615a9b6159ec565b5060010190565b60008251615ab4818460208701615157565b9190910192915050565b60008160020b8360020b80615ad557615ad5615a5f565b627fffff19821460001982141615615aef57615aef6159ec565b90059392505050565b60008260020b8260020b028060020b9150808214614b3357614b336159ec565b601f8211156111c957600081815260208120601f850160051c81016020861015615b3f5750805b601f850160051c820191505b81811015613a2a57828155600101615b4b565b815167ffffffffffffffff811115615b7857615b786153bd565b615b8c81615b868454615704565b84615b18565b602080601f831160018114615bc15760008415615ba95750858301515b600019600386901b1c1916600185901b178555613a2a565b600085815260208120601f198616915b82811015615bf057888601518255948401946001909101908401615bd1565b5085821015615c0e5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b86815260c060208201526000615c3760c083018861517b565b90508560408301528460608301528360808301526001600160a01b03831660a0830152979650505050505050565b8135815260a081016020830135615c7b81615095565b6001600160801b03811660208401525060408301356040830152606083013560608301526080830135608083015292915050565b600060208284031215615cc157600080fd5b5051919050565b818103818111156116dc576116dc6159ec565b60007f80000000000000000000000000000000000000000000000000000000000000008203615d0c57615d0c6159ec565b5060000390565b600082615d2257615d22615a5f565b500690565b808201808211156116dc576116dc6159ec565b81516001600160a01b0316815261016081016020830151615d6660208401826001600160a01b03169052565b506040830151615d7d604084018262ffffff169052565b506060830151615d92606084018260020b9052565b506080830151615da7608084018260020b9052565b5060a083015160a083015260c083015160c083015260e083015160e0830152610100808401518184015250610120808401516152fe828501826001600160a01b03169052565b60008060008060808587031215615e0357600080fd5b845193506020850151615e1581615095565b6040860151606090960151949790965092505050565b60006102c0820190508c82526001600160a01b03808d1660208401528b6040840152808b166060840152808a16608084015280891660a08401528760c084015261ffff871660e08401526101008681850152610120828716818601526101409250615ea683860187516bffffffffffffffffffffffff169052565b6020860151610160615ec2818801836001600160a01b03169052565b60408801516001600160a01b039081166101808901526060890151166101a0880152608088015162ffffff166101c088015260a0880151600290810b6101e089015260c0890151900b61020088015260e08801516001600160801b039081166102208901529388015161024088015291870151610260870152509185015181166102808501529301519092166102a0909101529a9950505050505050505050565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03828116828216039080821115614b3357614b336159ec56fea2646970667358221220befe154a35d734ba7e5849dfd1af07c2d3a0914833a2fc23b5485d286864686764736f6c63430008130033

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

0000000000000000000000009720526c803aeee9c7558dbd19a4d6b512a49b9400000000000000000000000012a51944e8349b8e70ed8e2d9bfbc88adb4a8f4e00000000000000000000000004bda42de3bc32abb00df46004204424d4cf828700000000000000000000000012a51944e8349b8e70ed8e2d9bfbc88adb4a8f4e

-----Decoded View---------------
Arg [0] : _countryList (address): 0x9720526C803aeee9c7558dBD19A4d6b512a49B94
Arg [1] : _autoCollectAddress (address): 0x12a51944e8349B8e70Ed8e2d9BFbc88Adb4A8F4E
Arg [2] : _lpFeeReceiver (address): 0x04bDa42de3bc32Abb00df46004204424d4Cf8287
Arg [3] : _collectFeeReceiver (address): 0x12a51944e8349B8e70Ed8e2d9BFbc88Adb4A8F4E

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000009720526c803aeee9c7558dbd19a4d6b512a49b94
Arg [1] : 00000000000000000000000012a51944e8349b8e70ed8e2d9bfbc88adb4a8f4e
Arg [2] : 00000000000000000000000004bda42de3bc32abb00df46004204424d4cf8287
Arg [3] : 00000000000000000000000012a51944e8349b8e70ed8e2d9bfbc88adb4a8f4e


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Trustless smart contract available for locking LP (liquidity providers) NFT tokens for pairs created on top of UniSwap V3. The UNCX Network team has deployed this contract.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.