ETH Price: $3,074.68 (+0.85%)
Gas: 3 Gwei

Contract

0x63534BF9ae7C066Cb9413613212925D70235754F
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Withdraw NFT153558392022-08-17 1:34:06692 days ago1660700046IN
0x63534BF9...70235754F
0 ETH0.0031266414.28313481
Withdraw NFT146713792022-04-28 6:55:33803 days ago1651128933IN
0x63534BF9...70235754F
0 ETH0.0054339828
Withdraw NFT146713792022-04-28 6:55:33803 days ago1651128933IN
0x63534BF9...70235754F
0 ETH0.0071508628
Withdraw NFT146379572022-04-23 0:41:35808 days ago1650674495IN
0x63534BF9...70235754F
0 ETH0.0050940627.5776922
Withdraw NFT146379542022-04-23 0:41:13808 days ago1650674473IN
0x63534BF9...70235754F
0 ETH0.0065655929.64952239
Withdraw NFT146379522022-04-23 0:40:46808 days ago1650674446IN
0x63534BF9...70235754F
0 ETH0.0056992630.85401558
Withdraw NFT146216222022-04-20 11:30:21811 days ago1650454221IN
0x63534BF9...70235754F
0 ETH0.0075540134.11453213
Withdraw NFT146216142022-04-20 11:28:57811 days ago1650454137IN
0x63534BF9...70235754F
0 ETH0.0085358634.41380754
Withdraw NFT145543882022-04-09 23:07:18821 days ago1649545638IN
0x63534BF9...70235754F
0 ETH0.0066394929
Withdraw NFT145460612022-04-08 15:53:55822 days ago1649433235IN
0x63534BF9...70235754F
0 ETH0.0095919946.37310662
Withdraw Reward145460582022-04-08 15:53:15822 days ago1649433195IN
0x63534BF9...70235754F
0 ETH0.0045246.95820751
Withdraw NFT145460432022-04-08 15:49:54822 days ago1649432994IN
0x63534BF9...70235754F
0 ETH0.0120700849.05818896
Withdraw NFT145389312022-04-07 13:09:21823 days ago1649336961IN
0x63534BF9...70235754F
0 ETH0.0183241274.47378743
Withdraw NFT145364062022-04-07 3:42:35824 days ago1649302955IN
0x63534BF9...70235754F
0 ETH0.0091043937.0043173
Withdraw NFT145350702022-04-06 22:39:13824 days ago1649284753IN
0x63534BF9...70235754F
0 ETH0.0072139335.74493904
Withdraw NFT145317002022-04-06 10:03:45825 days ago1649239425IN
0x63534BF9...70235754F
0 ETH0.0077361535.26292502
Withdraw NFT145312082022-04-06 8:10:31825 days ago1649232631IN
0x63534BF9...70235754F
0 ETH0.0091294934.69340011
Withdraw NFT145305572022-04-06 5:45:12825 days ago1649223912IN
0x63534BF9...70235754F
0 ETH0.0088486635
Withdraw NFT145284822022-04-05 22:00:11825 days ago1649196011IN
0x63534BF9...70235754F
0 ETH0.02233533115.51167937
Withdraw Reward145277482022-04-05 19:15:28825 days ago1649186128IN
0x63534BF9...70235754F
0 ETH0.0107354976.42283231
Withdraw NFT145208942022-04-04 17:35:59826 days ago1649093759IN
0x63534BF9...70235754F
0 ETH0.0154433167.45335212
Withdraw NFT145207532022-04-04 17:05:34826 days ago1649091934IN
0x63534BF9...70235754F
0 ETH0.0156314168.00909514
Withdraw Reward145207502022-04-04 17:04:57826 days ago1649091897IN
0x63534BF9...70235754F
0 ETH0.012151177.11316981
Withdraw NFT145193092022-04-04 11:35:54827 days ago1649072154IN
0x63534BF9...70235754F
0 ETH0.0087218335.44092911
Withdraw Reward145193022022-04-04 11:35:00827 days ago1649072100IN
0x63534BF9...70235754F
0 ETH0.0075663553.840008
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:
UnipilotFarm

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 1200 runs

Other Settings:
default evmVersion
File 1 of 17 : UnipilotFarm.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma abicoder v2;

/// @title Unipilot Yield Farming
/// @author Asim Raza
/// @notice You can use this contract for earn reward on staking nft
/// @dev All function calls are currently implemented without side effects

//Utility imports
import "./interfaces/IUnipilotFarm.sol";
import "./interfaces/uniswap/IUniswapLiquidityManager.sol";
import "./interfaces/IUnipilot.sol";
import "./interfaces/IFarmV1.sol";
import "./interfaces/IUnipilotStake.sol";

//Uniswap v3 core imports
import "@uniswap/v3-core/contracts/libraries/FullMath.sol";

//Openzeppelin imports
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

import "./ReentrancyGuard.sol";

contract UnipilotFarm is IUnipilotFarm, ReentrancyGuard, IERC721Receiver {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    bool public isFarmingActive;
    bool public backwardCompatible;
    address public governance;
    uint256 public pilotPerBlock = 1e18;
    uint256 public farmingGrowthBlockLimit;
    uint256 public totalRewardSent;

    address private ulm;
    address private stakeContract;
    address[2] private deprecated;

    address private constant PILOT_TOKEN = 0x37C997B35C619C21323F3518B9357914E8B99525; 
    address private constant UNIPILOT = 0xde5bF92E3372AA59C73Ca7dFc6CEc599E1B2b08C;

    address[] public poolListed;

    // farming status --> tokenId => bool
    mapping(uint256 => bool) public farmingActive;

    // exist in whitelist or not --> pool address => bool
    mapping(address => bool) public poolWhitelist;

    // poolinfo address =>Poolinfo struct
    mapping(address => PoolInfo) public poolInfo;

    // poolAltInfo address => PoolAltInfo struct
    mapping(address => PoolAltInfo) public poolAltInfo;

    // userinfo user --> tokenId nft => userInfo struct
    mapping(uint256 => UserInfo) public userInfo;

    //user address => pool address => tokenId[]
    mapping(address => mapping(address => uint256[])) public userToPoolToTokenIds;
    modifier onlyGovernance() {
        require(msg.sender == governance, "NA");
        _;
    }

    modifier isActive() {
        require(isFarmingActive, "FNA");
        _;
    }

    modifier isLimitActive() {
        require(farmingGrowthBlockLimit == 0, "LA");
        _;
    }

    modifier onlyOwner(uint256 _tokenId) {
        require(IERC721(UNIPILOT).ownerOf(_tokenId) == msg.sender, "NO");
        _;
    }

    modifier isPoolRewardActive(address pool) {
        require(poolInfo[pool].isRewardActive, "RNA");
        _;
    }

    modifier onlyStake() {
        require(msg.sender == stakeContract, "NS");
        _;
    }

    constructor(
        address _ulm,
        address _governance,
        address[2] memory _deprecated
    ) {
        governance = _governance;

        ulm = _ulm;

        isFarmingActive = true;

        deprecated = _deprecated;

        backwardCompatible = true;
    }

    /// @notice withdraw NFT with reward
    /// @dev only owner of nft can withdraw
    /// @param _tokenId unstake tokenID
    function withdrawNFT(uint256 _tokenId) external override {
        UserInfo storage userState = userInfo[_tokenId];

        PoolInfo storage poolState = poolInfo[userState.pool];

        PoolAltInfo storage poolAltState = poolAltInfo[userState.pool];

        withdrawReward(_tokenId);

        poolState.totalLockedLiquidity = poolState.totalLockedLiquidity.sub(
            userState.liquidity
        );

        IERC721(UNIPILOT).safeTransferFrom(address(this), msg.sender, _tokenId);

        farmingActive[_tokenId] = false;

        emit WithdrawNFT(
            userState.pool,
            userState.user,
            _tokenId,
            poolState.totalLockedLiquidity
        );

        if (poolState.totalLockedLiquidity == 0) {
            poolState.startBlock = block.number;
            poolState.lastRewardBlock = block.number;
            poolState.globalReward = 0;

            poolAltState.startBlock = block.number;
            poolAltState.lastRewardBlock = block.number;
            poolAltState.globalReward = 0;
        }

        uint256 index = callIndex(userState.pool, _tokenId);

        updateNFTList(index, userState.user, userState.pool);

        delete userInfo[_tokenId];
    }

    /// @notice withdraw NFT without reward claiming
    /// @param _tokenId unstake this tokenID
    function emergencyNFTWithdraw(uint256 _tokenId) external {
        UserInfo storage userState = userInfo[_tokenId];

        require(userState.user == msg.sender, "NOO");

        PoolInfo storage poolState = poolInfo[userState.pool];

        PoolAltInfo storage poolAltState = poolAltInfo[userState.pool];

        poolState.totalLockedLiquidity = poolState.totalLockedLiquidity.sub(
            userState.liquidity
        );

        IERC721(UNIPILOT).safeTransferFrom(address(this), userState.user, _tokenId);

        if (poolState.totalLockedLiquidity == 0) {
            poolState.startBlock = block.number;
            poolState.lastRewardBlock = block.number;
            poolState.globalReward = 0;

            poolAltState.startBlock = block.number;
            poolAltState.lastRewardBlock = block.number;
            poolAltState.globalReward = 0;
        }
        uint256 index = callIndex(userState.pool, _tokenId);
        updateNFTList(index, userState.user, userState.pool);
        delete userInfo[_tokenId];
    }

    /// @notice Migrate funds to Governance address or in new Contract
    /// @dev only governance can call this
    /// @param _newContract address of new contract or wallet address
    /// @param _tokenAddress address of token which want to migrate
    /// @param _amount withdraw that amount which are required
    function migrateFunds(
        address _newContract,
        address _tokenAddress,
        uint256 _amount
    ) external onlyGovernance {
        require(_newContract != address(0), "CNE");
        IERC20(_tokenAddress).safeTransfer(_newContract, _amount);
        emit MigrateFunds(_newContract, _tokenAddress, _amount);
    }

    /// @notice Use to blacklist pools
    /// @dev only governance can call this
    /// @param _pools addresses to be blacklisted
    function blacklistPools(address[] memory _pools) external override onlyGovernance {
        for (uint256 i = 0; i < _pools.length; i++) {
            poolWhitelist[_pools[i]] = false;
            poolInfo[_pools[i]].rewardMultiplier = 0;    
            emit BlacklistPool(_pools[i], poolWhitelist[_pools[i]], block.timestamp);
        }
    }

    /// @notice Use to update ULM address
    /// @dev only governance can call this
    /// @param _ulm new address of ULM
    function updateULM(address _ulm) external override onlyGovernance {
        emit UpdateULM(ulm, ulm = _ulm, block.timestamp);
    }

    /// @notice Updating pilot per block for every pool
    /// @dev only governance can call this
    /// @param _value new value of pilot per block
    function updatePilotPerBlock(uint256 _value) external override onlyGovernance {
        address[] memory pools = poolListed;
        pilotPerBlock = _value;
        for (uint256 i = 0; i < pools.length; i++) {
            if (poolWhitelist[pools[i]]) {
                if (poolInfo[pools[i]].totalLockedLiquidity != 0) {
                    updatePoolState(pools[i]);
                }
                emit UpdatePilotPerBlock(pools[i], pilotPerBlock);
            }
        }
    }

    /// @notice Updating multiplier for single pool
    /// @dev only governance can call this
    /// @param _pool pool address
    /// @param _value new value of multiplier of pool
    function updateMultiplier(address _pool, uint256 _value)
        external
        override
        onlyGovernance
    {
        updatePoolState(_pool);

        emit UpdateMultiplier(
            _pool,
            poolInfo[_pool].rewardMultiplier,
            poolInfo[_pool].rewardMultiplier = _value
        );
    }

    /// @notice User total nft(s) with respect to pool
    /// @param _user particular user address
    /// @param _pool particular pool address
    /// @return tokenCount count of nft(s)
    /// @return tokenIds array of tokenID
    function totalUserNftWRTPool(address _user, address _pool)
        external
        view
        override
        returns (uint256 tokenCount, uint256[] memory tokenIds)
    {
        tokenCount = userToPoolToTokenIds[_user][_pool].length;
        tokenIds = userToPoolToTokenIds[_user][_pool];
    }

    /// @notice NFT token ID farming status
    /// @param _tokenId particular tokenId
    function nftStatus(uint256 _tokenId) external view override returns (bool) {
        return farmingActive[_tokenId];
    }

    /// @notice User can call tx to deposit nft
    /// @dev pool address must be exist in whitelisted pools
    /// @param _tokenId tokenID which want to deposit
    /// @return status of farming is active for particular tokenID
    function depositNFT(uint256 _tokenId)
        external
        override
        isActive
        isLimitActive
        onlyOwner(_tokenId)
        returns (bool)
    {
        address sender = msg.sender;
        IUniswapLiquidityManager.Position memory positions = IUniswapLiquidityManager(ulm)
            .userPositions(_tokenId);

        (address pool, uint256 liquidity) = (positions.pool, positions.liquidity);

        require(poolWhitelist[pool], "PNW");

        IUniswapLiquidityManager.LiquidityPosition
            memory liquidityPositions = IUniswapLiquidityManager(ulm).poolPositions(pool);

        uint256 totalLiquidity = liquidityPositions.totalLiquidity;

        require(totalLiquidity >= liquidity && liquidity > 0, "IL");

        PoolInfo storage poolState = poolInfo[pool];

        if (poolState.lastRewardBlock != poolState.startBlock) {
            uint256 blockDifference = (block.number).sub(poolState.lastRewardBlock);

            poolState.globalReward = getGlobalReward(
                pool,
                blockDifference,
                pilotPerBlock,
                poolState.rewardMultiplier,
                poolState.globalReward
            );
        }

        poolState.totalLockedLiquidity = poolState.totalLockedLiquidity.add(liquidity);

        userInfo[_tokenId] = UserInfo({
            pool: pool,
            liquidity: liquidity,
            user: sender,
            reward: poolState.globalReward,
            altReward: userInfo[_tokenId].altReward,
            boosterActive: false
        });
        userToPoolToTokenIds[sender][pool].push(_tokenId);

        farmingActive[_tokenId] = true; // user's farming active

        IERC721(UNIPILOT).safeTransferFrom(sender, address(this), _tokenId);

        if (poolState.isAltActive) {
            altGR(pool, _tokenId);
        }

        poolState.lastRewardBlock = block.number;

        emit Deposit(
            pool,
            _tokenId,
            userInfo[_tokenId].liquidity,
            poolState.totalLockedLiquidity,
            poolState.globalReward,
            poolState.rewardMultiplier,
            pilotPerBlock
        );
        return farmingActive[_tokenId];
    }

    /// @notice toggle alt token state on pool
    /// @dev only governance can call this
    /// @param _pool pool address for alt token
    function toggleActiveAlt(address _pool) external onlyGovernance returns (bool) {
        require(poolAltInfo[_pool].altToken != address(0), "TNE");
        emit UpdateAltState(
            poolInfo[_pool].isAltActive,
            poolInfo[_pool].isAltActive = !poolInfo[_pool].isAltActive,
            _pool
        );

        if (poolInfo[_pool].isAltActive) {
            updateAltPoolState(_pool);
        } else {
            poolAltInfo[_pool].lastRewardBlock = block.number;
        }

        return poolInfo[_pool].isAltActive;
    }

    ///@notice Updating address of alt token
    ///@dev only Governance can call this
    function updateAltToken(address _pool, address _altToken) external onlyGovernance {
        emit UpdateActiveAlt(
            poolAltInfo[_pool].altToken,
            poolAltInfo[_pool].altToken = _altToken,
            _pool
        );

        PoolAltInfo memory poolAltState = poolAltInfo[_pool];
        poolAltState = PoolAltInfo({
            globalReward: 0,
            lastRewardBlock: block.number,
            altToken: poolAltInfo[_pool].altToken,
            startBlock: block.number
        });

        poolAltInfo[_pool] = poolAltState;
    }

    /// @dev onlyGovernance can call this
    /// @param _pools The pools to make whitelist or initialize
    /// @param _multipliers multiplier of pools
    function initializer(address[] memory _pools, uint256[] memory _multipliers)
        public
        override
        onlyGovernance
    {
        require(_pools.length == _multipliers.length, "LNS");
        for (uint256 i = 0; i < _pools.length; i++) {
            if (
                !poolWhitelist[_pools[i]] && poolInfo[_pools[i]].startBlock == 0
            ) {
                insertPool(_pools[i], _multipliers[i]);
            } else {
                poolWhitelist[_pools[i]] = true;
                poolInfo[_pools[i]].rewardMultiplier = _multipliers[i];
            }
        }
    }

    /// @notice Generic function to calculating global reward
    /// @param pool pool address
    /// @param blockDifference difference of block from current block to last reward block
    /// @param rewardPerBlock reward on per block
    /// @param multiplier multiplier value
    /// @return globalReward calculating global reward
    function getGlobalReward(
        address pool,
        uint256 blockDifference,
        uint256 rewardPerBlock,
        uint256 multiplier,
        uint256 _globalReward
    ) public view returns (uint256 globalReward) {
        uint256 tvl;
        if (backwardCompatible) {
            for(uint i = 0; i < deprecated.length; i++){
               uint256 prevTvl=(IUnipilotFarmV1(deprecated[i]).poolInfo(pool).totalLockedLiquidity);
               tvl=tvl.add(prevTvl); 
            }
            tvl = tvl.add(poolInfo[pool].totalLockedLiquidity);
        } else {
            tvl = poolInfo[pool].totalLockedLiquidity;
        }
        uint256 temp = FullMath.mulDiv(rewardPerBlock, multiplier, 1e18);
        globalReward = FullMath.mulDiv(blockDifference.mul(temp), 1e18, tvl).add(
            _globalReward
        );
    }

    /// @notice Generic function to calculating reward of tokenId
    /// @param _tokenId find current reward of tokenID
    /// @return pilotReward calculate pilot reward
    /// @return globalReward calculate global reward
    /// @return globalAltReward calculate global reward of alt token
    /// @return altReward calculate reward of alt token
    function currentReward(uint256 _tokenId)
        public
        view
        override
        returns (
            uint256 pilotReward,
            uint256 globalReward,
            uint256 globalAltReward,
            uint256 altReward
        )
    {
        UserInfo memory userState = userInfo[_tokenId];
        PoolInfo memory poolState = poolInfo[userState.pool];
        PoolAltInfo memory poolAltState = poolAltInfo[userState.pool];

        DirectTo check = DirectTo.GRforPilot;

        if (isFarmingActive) {
            globalReward = checkLimit(_tokenId, check);

            if (poolState.isAltActive) {
                check = DirectTo.GRforAlt;
                globalAltReward = checkLimit(_tokenId, check);
            } else {
                globalAltReward = poolAltState.globalReward;
            }
        } else {
            globalReward = poolState.globalReward;
            globalAltReward = poolAltState.globalReward;
        }

        uint256 userReward = globalReward.sub(userState.reward);
        uint256 _reward = (userReward.mul(userState.liquidity)).div(1e18);
        if (userState.boosterActive) {
            uint256 multiplier = IUnipilotStake(stakeContract).getBoostMultiplier(
                userState.user,
                userState.pool,
                _tokenId
            );
            uint256 boostedReward = (_reward.mul(multiplier)).div(1e18);
            pilotReward = _reward.add((boostedReward));
        } else {
            pilotReward = _reward;
        }

        _reward = globalAltReward.sub(userState.altReward);
        altReward = (_reward.mul(userState.liquidity)).div(1e18);
    }

    /// @notice Generic function to check limit of global reward of token Id
    function checkLimit(uint256 _tokenId, DirectTo _check)
        internal
        view
        returns (uint256 globalReward)
    {
        address pool = userInfo[_tokenId].pool;

        TempInfo memory poolState;

        if (_check == DirectTo.GRforPilot) {
            poolState = TempInfo({
                globalReward: poolInfo[pool].globalReward,
                lastRewardBlock: poolInfo[pool].lastRewardBlock,
                rewardMultiplier: poolInfo[pool].rewardMultiplier
            });
        } else if (_check == DirectTo.GRforAlt) {
            poolState = TempInfo({
                globalReward: poolAltInfo[pool].globalReward,
                lastRewardBlock: poolAltInfo[pool].lastRewardBlock,
                rewardMultiplier: poolInfo[pool].rewardMultiplier
            });
        }

        if (
            poolState.lastRewardBlock < farmingGrowthBlockLimit &&
            block.number > farmingGrowthBlockLimit
        ) {
            globalReward = getGlobalReward(
                pool,
                farmingGrowthBlockLimit.sub(poolState.lastRewardBlock),
                pilotPerBlock,
                poolState.rewardMultiplier,
                poolState.globalReward
            );
        } else if (
            poolState.lastRewardBlock > farmingGrowthBlockLimit &&
            farmingGrowthBlockLimit > 0
        ) {
            globalReward = poolState.globalReward;
        } else {
            uint256 blockDifference = (block.number).sub(poolState.lastRewardBlock);
            globalReward = getGlobalReward(
                pool,
                blockDifference,
                pilotPerBlock,
                poolState.rewardMultiplier,
                poolState.globalReward
            );
        }
    }

    /// @notice Withdraw reward of token Id
    /// @dev only owner of nft can withdraw
    /// @param _tokenId withdraw reward of this tokenID
    function withdrawReward(uint256 _tokenId)
        public
        override
        nonReentrant
        isPoolRewardActive(userInfo[_tokenId].pool)
    {
        UserInfo storage userState = userInfo[_tokenId];
        PoolInfo storage poolState = poolInfo[userState.pool];

        require(userState.user == msg.sender, "NO");
        (
            uint256 pilotReward,
            uint256 globalReward,
            uint256 globalAltReward,
            uint256 altReward
        ) = currentReward(_tokenId);

        require(IERC20(PILOT_TOKEN).balanceOf(address(this)) >= pilotReward, "IF");

        poolState.globalReward = globalReward;
        poolState.lastRewardBlock = block.number;
        userState.reward = globalReward;

        totalRewardSent += pilotReward;

        IERC20(PILOT_TOKEN).safeTransfer(userInfo[_tokenId].user, pilotReward);

        if (poolState.isAltActive) {
            altWithdraw(_tokenId, globalAltReward, altReward);
        }

        emit WithdrawReward(
            userState.pool,
            _tokenId,
            userState.liquidity,
            userState.reward,
            poolState.globalReward,
            poolState.totalLockedLiquidity,
            pilotReward
        );
    }

    /// @notice internal function use for initialize struct values of single pool
    /// @dev generalFunction to add pools
    /// @param _pool pool address
    function insertPool(address _pool, uint256 _multiplier) internal {
        poolWhitelist[_pool] = true;
        poolListed.push(_pool);
        poolInfo[_pool] = PoolInfo({
            startBlock: block.number,
            globalReward: 0,
            lastRewardBlock: block.number,
            totalLockedLiquidity: 0,
            rewardMultiplier: _multiplier,
            isRewardActive: true,
            isAltActive: poolInfo[_pool].isAltActive
        });

        emit NewPool(
            _pool,
            pilotPerBlock,
            poolInfo[_pool].rewardMultiplier,
            poolInfo[_pool].lastRewardBlock,
            poolWhitelist[_pool]
        );
    }

    /// @notice Use to update state of alt token
    function altGR(address _pool, uint256 _tokenId) internal {
        PoolAltInfo storage poolAltState = poolAltInfo[_pool];

        if (poolAltState.lastRewardBlock != poolAltState.startBlock) {
            uint256 blockDifference = (block.number).sub(poolAltState.lastRewardBlock);

            poolAltState.globalReward = getGlobalReward(
                _pool,
                blockDifference,
                pilotPerBlock,
                poolInfo[_pool].rewardMultiplier,
                poolAltState.globalReward
            );
        }

        poolAltState.lastRewardBlock = block.number;

        userInfo[_tokenId].altReward = poolAltState.globalReward;
    }

    /// @notice Use for pool tokenId to find its index
    function callIndex(address pool, uint256 _tokenId)
        internal
        view
        returns (uint256 index)
    {
        uint256[] memory tokens = userToPoolToTokenIds[msg.sender][pool];
        for (uint256 i = 0; i <= tokens.length; i++) {
            if (_tokenId == userToPoolToTokenIds[msg.sender][pool][i]) {
                index = i;
                break;
            }
        }
        return index;
    }

    /// @notice Use to update list of NFT(s)
    function updateNFTList(
        uint256 _index,
        address user,
        address pool
    ) internal {
        require(_index < userToPoolToTokenIds[user][pool].length, "IOB");
        uint256 temp = userToPoolToTokenIds[user][pool][
            userToPoolToTokenIds[user][pool].length.sub(1)
        ];
        userToPoolToTokenIds[user][pool][_index] = temp;
        userToPoolToTokenIds[user][pool].pop();
    }

    /// @notice Use to toggle farming state of contract
    function toggleFarmingActive() external override onlyGovernance {
        emit FarmingStatus(
            isFarmingActive,
            isFarmingActive = !isFarmingActive,
            block.timestamp
        );
    }

    /// @notice Use to withdraw alt tokens of token Id (internal)
    function altWithdraw(
        uint256 _tokenId,
        uint256 altGlobalReward,
        uint256 altReward
    ) internal {
        PoolAltInfo storage poolAltState = poolAltInfo[userInfo[_tokenId].pool];
        require(
            IERC20(poolAltState.altToken).balanceOf(address(this)) >= altReward,
            "IF"
        );
        poolAltState.lastRewardBlock = block.number;
        poolAltState.globalReward = altGlobalReward;
        userInfo[_tokenId].altReward = altGlobalReward;
        IERC20(poolAltState.altToken).safeTransfer(userInfo[_tokenId].user, altReward);
    }

    /// @notice Use to toggle state of reward of pool
    function toggleRewardStatus(address _pool) external override onlyGovernance {
        if (poolInfo[_pool].isRewardActive) {
            updatePoolState(_pool);
        } else {
            poolInfo[_pool].lastRewardBlock = block.number;
        }

        emit RewardStatus(
            _pool,
            poolInfo[_pool].isRewardActive,
            poolInfo[_pool].isRewardActive = !poolInfo[_pool].isRewardActive
        );
    }

    /// @notice Use to update pool state (internal)
    function updatePoolState(address _pool) internal {
        PoolInfo storage poolState = poolInfo[_pool];
        if (poolState.totalLockedLiquidity > 0) {
            uint256 currentGlobalReward = getGlobalReward(
                _pool,
                (block.number).sub(poolState.lastRewardBlock),
                pilotPerBlock,
                poolState.rewardMultiplier,
                poolState.globalReward
            );

            poolState.globalReward = currentGlobalReward;
            poolState.lastRewardBlock = block.number;
        }
    }

    /// @notice Use to update alt token state (internal)
    function updateAltPoolState(address _pool) internal {
        PoolAltInfo storage poolAltState = poolAltInfo[_pool];
        if (poolInfo[_pool].totalLockedLiquidity > 0) {
            uint256 currentGlobalReward = getGlobalReward(
                _pool,
                (block.number).sub(poolAltState.lastRewardBlock),
                pilotPerBlock,
                poolInfo[_pool].rewardMultiplier,
                poolAltState.globalReward
            );

            poolAltState.globalReward = currentGlobalReward;
            poolAltState.lastRewardBlock = block.number;
        }
    }

    /// @notice Use to stop staking NFT(s) in contract after block limit
    function updateFarmingLimit(uint256 _blockNumber) external onlyGovernance {
        emit UpdateFarmingLimit(
            farmingGrowthBlockLimit,
            farmingGrowthBlockLimit = _blockNumber
        );
    }

    /// @notice toggle booster status of token Id
    function toggleBooster(uint256 tokenId) external onlyStake {
        emit ToggleBooster(
            tokenId,
            userInfo[tokenId].boosterActive,
            userInfo[tokenId].boosterActive = !userInfo[tokenId].boosterActive
        );
    }

    /// @notice set stake contract address
    function setStake(address _stakeContract) external onlyGovernance {
        emit Stake(stakeContract, stakeContract = _stakeContract);
    }

    /// @notice toggle backward compayibility status of FarmingV1
    function toggleBackwardCompatibility() external onlyGovernance {
        emit BackwardCompatible(
            backwardCompatible,
            backwardCompatible = !backwardCompatible
        );
    }

    /// @notice governance can update new address of governance
    function updateGovernance(address _governance) external onlyGovernance {
        emit GovernanceUpdated(governance, governance = _governance);
    }

    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    receive() external payable {
        //payable
    }
}

File 2 of 17 : IUnipilotFarm.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma experimental ABIEncoderV2;

interface IUnipilotFarm {
    struct PoolInfo {
        uint256 startBlock;
        uint256 globalReward;
        uint256 lastRewardBlock;
        uint256 totalLockedLiquidity;
        uint256 rewardMultiplier;
        bool isRewardActive;
        bool isAltActive;
    }

    struct PoolAltInfo {
        address altToken;
        uint256 startBlock;
        uint256 globalReward;
        uint256 lastRewardBlock;
    }

    struct UserInfo {
        bool boosterActive;
        address pool;
        address user;
        uint256 reward;
        uint256 altReward;
        uint256 liquidity;
    }

    struct TempInfo {
        uint256 globalReward;
        uint256 lastRewardBlock;
        uint256 rewardMultiplier;
    }

    enum DirectTo {
        GRforPilot,
        GRforAlt
    }

    event Deposit(
        address pool,
        uint256 tokenId,
        uint256 liquidity,
        uint256 totalSupply,
        uint256 globalReward,
        uint256 rewardMultiplier,
        uint256 rewardPerBlock
    );
    event WithdrawReward(
        address pool,
        uint256 tokenId,
        uint256 liquidity,
        uint256 reward,
        uint256 globalReward,
        uint256 totalSupply,
        uint256 lastRewardTransferred
    );
    event WithdrawNFT(
        address pool,
        address userAddress,
        uint256 tokenId,
        uint256 totalSupply
    );

    event NewPool(
        address pool,
        uint256 rewardPerBlock,
        uint256 rewardMultiplier,
        uint256 lastRewardBlock,
        bool status
    );

    event BlacklistPool(address pool, bool status, uint256 time);

    event UpdateULM(address oldAddress, address newAddress, uint256 time);

    event UpdatePilotPerBlock(address pool, uint256 updated);

    event UpdateMultiplier(address pool, uint256 old, uint256 updated);

    event UpdateActiveAlt(address old, address updated, address pool);

    event UpdateAltState(bool old, bool updated, address pool);

    event UpdateFarmingLimit(uint256 old, uint256 updated);

    event RewardStatus(address pool, bool old, bool updated);

    event MigrateFunds(address account, address token, uint256 amount);

    event FarmingStatus(bool old, bool updated, uint256 time);

    event Stake(address old, address updated);

    event ToggleBooster(uint256 tokenId, bool old, bool updated);

    event UserBooster(uint256 tokenId, uint256 booster);

    event BackwardCompatible(bool old, bool updated);

    event GovernanceUpdated(address old, address updated);

    function initializer(address[] memory pools, uint256[] memory _multipliers) external;

    function blacklistPools(address[] memory pools) external;

    function updatePilotPerBlock(uint256 value) external;

    function updateMultiplier(address pool, uint256 value) external;

    function updateULM(address _ULM) external;

    function totalUserNftWRTPool(address userAddress, address pool)
        external
        view
        returns (uint256 tokenCount, uint256[] memory tokenIds);

    function nftStatus(uint256 tokenId) external view returns (bool);

    function depositNFT(uint256 tokenId) external returns (bool);

    function withdrawNFT(uint256 tokenId) external;

    function withdrawReward(uint256 tokenId) external;

    function currentReward(uint256 _tokenId)
        external
        view
        returns (
            uint256 pilotReward,
            uint256 globalReward,
            uint256 globalAltReward,
            uint256 altReward
        );

    function toggleRewardStatus(address pool) external;

    function toggleFarmingActive() external;
}

File 3 of 17 : IUniswapLiquidityManager.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.6;
pragma abicoder v2;

import "./IULMEvents.sol";

interface IUniswapLiquidityManager is IULMEvents {
    struct LiquidityPosition {
        // base order position
        int24 baseTickLower;
        int24 baseTickUpper;
        uint128 baseLiquidity;
        // range order position
        int24 rangeTickLower;
        int24 rangeTickUpper;
        uint128 rangeLiquidity;
        // accumulated fees
        uint256 fees0;
        uint256 fees1;
        uint256 feeGrowthGlobal0;
        uint256 feeGrowthGlobal1;
        // total liquidity
        uint256 totalLiquidity;
        // pool premiums
        bool feesInPilot;
        // oracle address for tokens to fetch prices from
        address oracle0;
        address oracle1;
        // rebase
        uint256 timestamp;
        uint8 counter;
        bool status;
        bool managed;
    }

    struct Position {
        uint256 nonce;
        address pool;
        uint256 liquidity;
        uint256 feeGrowth0;
        uint256 feeGrowth1;
        uint256 tokensOwed0;
        uint256 tokensOwed1;
    }

    struct ReadjustVars {
        bool zeroForOne;
        address poolAddress;
        int24 currentTick;
        uint160 sqrtPriceX96;
        uint160 exactSqrtPriceImpact;
        uint160 sqrtPriceLimitX96;
        uint128 baseLiquidity;
        uint256 amount0;
        uint256 amount1;
        uint256 amountIn;
        uint256 amount0Added;
        uint256 amount1Added;
        uint256 amount0Range;
        uint256 amount1Range;
        uint256 currentTimestamp;
        uint256 gasUsed;
        uint256 pilotAmount;
    }

    struct VarsEmerency {
        address token;
        address pool;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
    }

    struct WithdrawVars {
        address recipient;
        uint256 amount0Removed;
        uint256 amount1Removed;
        uint256 userAmount0;
        uint256 userAmount1;
        uint256 pilotAmount;
    }

    struct WithdrawTokenOwedParams {
        address token0;
        address token1;
        uint256 tokensOwed0;
        uint256 tokensOwed1;
    }

    struct MintCallbackData {
        address payer;
        address token0;
        address token1;
        uint24 fee;
    }

    struct UnipilotProtocolDetails {
        uint8 swapPercentage;
        uint24 swapPriceThreshold;
        uint256 premium;
        uint256 gasPriceLimit;
        uint256 userPilotPercentage;
        uint256 feesPercentageIndexFund;
        uint24 readjustFrequencyTime;
        uint16 poolCardinalityDesired;
        address pilotWethPair;
        address oracle;
        address indexFund; // 10%
        address uniStrategy;
        address unipilot;
    }

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

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

    struct RemoveLiquidity {
        uint256 amount0;
        uint256 amount1;
        uint128 liquidityRemoved;
        uint256 feesCollected0;
        uint256 feesCollected1;
    }

    struct Tick {
        int24 baseTickLower;
        int24 baseTickUpper;
        int24 bidTickLower;
        int24 bidTickUpper;
        int24 rangeTickLower;
        int24 rangeTickUpper;
    }

    struct TokenDetails {
        address token0;
        address token1;
        uint24 fee;
        int24 currentTick;
        uint16 poolCardinality;
        uint128 baseLiquidity;
        uint128 bidLiquidity;
        uint128 rangeLiquidity;
        uint256 amount0Added;
        uint256 amount1Added;
    }

    struct DistributeFeesParams {
        bool pilotToken;
        bool wethToken;
        address pool;
        address recipient;
        uint256 tokenId;
        uint256 liquidity;
        uint256 amount0Removed;
        uint256 amount1Removed;
    }

    struct AddLiquidityManagerParams {
        address pool;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 shares;
    }

    struct DepositVars {
        uint24 fee;
        address pool;
        uint256 amount0Base;
        uint256 amount1Base;
        uint256 amount0Range;
        uint256 amount1Range;
    }

    struct RangeLiquidityVars {
        address token0;
        address token1;
        uint24 fee;
        uint128 rangeLiquidity;
        uint256 amount0Range;
        uint256 amount1Range;
    }

    struct IncreaseParams {
        address token0;
        address token1;
        uint24 fee;
        int24 currentTick;
        uint128 baseLiquidity;
        uint256 baseAmount0;
        uint256 baseAmount1;
        uint128 rangeLiquidity;
        uint256 rangeAmount0;
        uint256 rangeAmount1;
    }

    /// @notice Pull in tokens from sender. Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.
    /// @dev In the implementation you must pay to the pool for the minted liquidity.
    /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity
    /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call
    function uniswapV3MintCallback(
        uint256 amount0Owed,
        uint256 amount1Owed,
        bytes calldata data
    ) external;

    /// @notice Called to `msg.sender` after minting swaping from IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay to the pool for swap.
    /// @param amount0Delta The amount of token0 due to the pool for the swap
    /// @param amount1Delta The amount of token1 due to the pool for the swap
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;

    /// @notice Returns the user position information associated with a given token ID.
    /// @param tokenId The ID of the token that represents the position
    /// @return Position
    /// - nonce The nonce for permits
    /// - pool Address of the uniswap V3 pool
    /// - liquidity The liquidity of the position
    /// - feeGrowth0 The fee growth of token0 as of the last action on the individual position
    /// - feeGrowth1 The fee growth of token1 as of the last action on the individual position
    /// - tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation
    /// - tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation
    function userPositions(uint256 tokenId) external view returns (Position memory);

    /// @notice Returns the vault information of unipilot base & range orders
    /// @param pool Address of the Uniswap pool
    /// @return LiquidityPosition
    /// - baseTickLower The lower tick of the base position
    /// - baseTickUpper The upper tick of the base position
    /// - baseLiquidity The total liquidity of the base position
    /// - rangeTickLower The lower tick of the range position
    /// - rangeTickUpper The upper tick of the range position
    /// - rangeLiquidity The total liquidity of the range position
    /// - fees0 Total amount of fees collected by unipilot positions in terms of token0
    /// - fees1 Total amount of fees collected by unipilot positions in terms of token1
    /// - feeGrowthGlobal0 The fee growth of token0 collected per unit of liquidity for
    /// the entire life of the unipilot vault
    /// - feeGrowthGlobal1 The fee growth of token1 collected per unit of liquidity for
    /// the entire life of the unipilot vault
    /// - totalLiquidity Total amount of liquidity of vault including base & range orders
    function poolPositions(address pool) external view returns (LiquidityPosition memory);

    /// @notice Calculates the vault's total holdings of token0 and token1 - in
    /// other words, how much of each token the vault would hold if it withdrew
    /// all its liquidity from Uniswap.
    /// @param _pool Address of the uniswap pool
    /// @return amount0 Total amount of token0 in vault
    /// @return amount1 Total amount of token1 in vault
    /// @return totalLiquidity Total liquidity of the vault
    function updatePositionTotalAmounts(address _pool)
        external
        view
        returns (
            uint256 amount0,
            uint256 amount1,
            uint256 totalLiquidity
        );

    /// @notice Calculates the vault's total holdings of TOKEN0 and TOKEN1 - in
    /// other words, how much of each token the vault would hold if it withdrew
    /// all its liquidity from Uniswap.
    /// @dev Updates the position and return the latest reserves & liquidity.
    /// @param token0 token0 of the pool
    /// @param token0 token1 of the pool
    /// @param data any necessary data needed to get reserves
    /// @return totalAmount0 Amount of token0 in the pool of unipilot
    /// @return totalAmount1 Amount of token1 in the pool of unipilot
    /// @return totalLiquidity Total liquidity available in unipilot pool
    function getReserves(
        address token0,
        address token1,
        bytes calldata data
    )
        external
        returns (
            uint256 totalAmount0,
            uint256 totalAmount1,
            uint256 totalLiquidity
        );

    /// @notice Creates a new pool & then initializes the pool
    /// @param _token0 The contract address of token0 of the pool
    /// @param _token1 The contract address of token1 of the pool
    /// @param data Necessary data needed to create pool
    /// In data we will provide the `fee` amount of the v3 pool for the specified token pair,
    /// also `sqrtPriceX96` The initial square root price of the pool
    /// @return _pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address
    function createPair(
        address _token0,
        address _token1,
        bytes memory data
    ) external returns (address _pool);

    /// @notice Deposits tokens in proportion to the Unipilot's current ticks, mints them
    /// `Unipilot`s NFT.
    /// @param token0 The first of the two tokens of the pool, sorted by address
    /// @param token1 The second of the two tokens of the pool, sorted by address
    /// @param amount0Desired Max amount of token0 to deposit
    /// @param amount1Desired Max amount of token1 to deposit
    /// @param shares Number of shares minted
    /// @param tokenId Token Id of Unipilot
    /// @param isTokenMinted Boolean to check the minting of new tokenId of Unipilot
    /// @param data Necessary data needed to deposit
    function deposit(
        address token0,
        address token1,
        uint256 amount0Desired,
        uint256 amount1Desired,
        uint256 shares,
        uint256 tokenId,
        bool isTokenMinted,
        bytes memory data
    ) external payable;

    /// @notice withdraws the desired shares from the vault with accumulated user fees and transfers to recipient.
    /// @param pilotToken whether to recieve fees in PILOT or not (valid if user is not reciving fees in token0, token1)
    /// @param wethToken whether to recieve fees in WETH or ETH (only valid for WETH/ALT pairs)
    /// @param liquidity The amount by which liquidity will be withdrawn
    /// @param tokenId The ID of the token for which liquidity is being withdrawn
    /// @param data Necessary data needed to withdraw liquidity from Unipilot
    function withdraw(
        bool pilotToken,
        bool wethToken,
        uint256 liquidity,
        uint256 tokenId,
        bytes memory data
    ) external payable;

    /// @notice Collects up to a maximum amount of fees owed to a specific user position to the recipient
    /// @dev User have both options whether to recieve fees in PILOT or in pool token0 & token1
    /// @param pilotToken whether to recieve fees in PILOT or not (valid if user is not reciving fees in token0, token1)
    /// @param wethToken whether to recieve fees in WETH or ETH (only valid for WETH/ALT pairs)
    /// @param tokenId The ID of the Unpilot NFT for which tokens will be collected
    /// @param data Necessary data needed to collect fees from Unipilot
    function collect(
        bool pilotToken,
        bool wethToken,
        uint256 tokenId,
        bytes memory data
    ) external payable;
}

File 4 of 17 : IUnipilot.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma abicoder v2;

import "./IHandler.sol";

interface IUnipilot {
    struct DepositVars {
        uint256 totalAmount0;
        uint256 totalAmount1;
        uint256 totalLiquidity;
        uint256 shares;
        uint256 amount0;
        uint256 amount1;
    }

    function governance() external view returns (address);

    function mintPilot(address recipient, uint256 amount) external;

    function mintUnipilotNFT(address sender) external returns (uint256 mintedTokenId);

    function deposit(IHandler.DepositParams memory params, bytes memory data)
        external
        payable
        returns (
            uint256 amount0Base,
            uint256 amount1Base,
            uint256 amount0Range,
            uint256 amount1Range,
            uint256 mintedTokenId
        );

    function createPoolAndDeposit(
        IHandler.DepositParams memory params,
        bytes[2] calldata data
    )
        external
        payable
        returns (
            uint256 amount0Base,
            uint256 amount1Base,
            uint256 amount0Range,
            uint256 amount1Range,
            uint256 mintedTokenId
        );
}

File 5 of 17 : IFarmV1.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma abicoder v2;

interface IUnipilotFarmV1 {
    struct PoolInfo {
        uint256 startBlock;
        uint256 globalReward;
        uint256 lastRewardBlock;
        uint256 totalLockedLiquidity;
        uint256 rewardMultiplier;
        bool isRewardActive;
        bool isAltActive;
    }
    function poolInfo(address pool) external view returns (PoolInfo memory);
}

File 6 of 17 : IUnipilotStake.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;

interface IUnipilotStake {
    function getBoostMultiplier(
        address userAddress,
        address poolAddress,
        uint256 tokenId
    ) external view returns (uint256);

    function userMultiplier(address userAddress, address poolAddress)
        external
        view
        returns (uint256);
}

File 7 of 17 : FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.0;

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

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

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

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

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

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

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

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

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

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

File 8 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 17 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

File 10 of 17 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

File 11 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

File 12 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

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

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

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

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 13 of 17 : ReentrancyGuard.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

abstract contract ReentrancyGuard {
    uint8 private _unlocked = 1;

    modifier nonReentrant() {
        require(_unlocked == 1, "ReentrancyGuard: reentrant call");
        _unlocked = 0;
        _;
        _unlocked = 1;
    }
}

File 14 of 17 : IULMEvents.sol
//SPDX-License-Identifier: MIT

pragma solidity >=0.7.6;

interface IULMEvents {
    event PoolCreated(
        address indexed token0,
        address indexed token1,
        address indexed pool,
        uint24 fee,
        uint160 sqrtPriceX96
    );

    event PoolReajusted(
        address pool,
        uint128 baseLiquidity,
        uint128 rangeLiquidity,
        int24 newBaseTickLower,
        int24 newBaseTickUpper,
        int24 newRangeTickLower,
        int24 newRangeTickUpper
    );

    event Deposited(
        address indexed pool,
        uint256 tokenId,
        uint256 amount0,
        uint256 amount1,
        uint256 liquidity
    );

    event Collect(
        uint256 tokenId,
        uint256 userAmount0,
        uint256 userAmount1,
        uint256 pilotAmount,
        address pool,
        address recipient
    );

    event Withdrawn(
        address indexed pool,
        address indexed recipient,
        uint256 tokenId,
        uint256 amount0,
        uint256 amount1
    );
}

File 15 of 17 : IHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.6;
pragma abicoder v2;

/// @notice IHandler is a generalized interface for all the liquidity managers
/// @dev Contains all necessary methods that should be available in liquidity manager contracts
interface IHandler {
    struct DepositParams {
        address sender;
        address exchangeAddress;
        address token0;
        address token1;
        uint256 amount0Desired;
        uint256 amount1Desired;
    }

    struct WithdrawParams {
        bool pilotToken;
        bool wethToken;
        address exchangeAddress;
        uint256 liquidity;
        uint256 tokenId;
    }

    struct CollectParams {
        bool pilotToken;
        bool wethToken;
        address exchangeAddress;
        uint256 tokenId;
    }

    function createPair(
        address _token0,
        address _token1,
        bytes calldata data
    ) external;

    function deposit(
        address token0,
        address token1,
        address sender,
        uint256 amount0,
        uint256 amount1,
        uint256 shares,
        bytes calldata data
    )
        external
        returns (
            uint256 amount0Base,
            uint256 amount1Base,
            uint256 amount0Range,
            uint256 amount1Range,
            uint256 mintedTokenId
        );

    function withdraw(
        bool pilotToken,
        bool wethToken,
        uint256 liquidity,
        uint256 tokenId,
        bytes calldata data
    ) external;

    function getReserves(
        address token0,
        address token1,
        bytes calldata data
    )
        external
        returns (
            uint256 shares,
            uint256 amount0,
            uint256 amount1
        );

    function collect(
        bool pilotToken,
        bool wethToken,
        uint256 tokenId,
        bytes calldata data
    ) external payable;
}

File 16 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

pragma solidity ^0.7.0;

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

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

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

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

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

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

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

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

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

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 1200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_ulm","type":"address"},{"internalType":"address","name":"_governance","type":"address"},{"internalType":"address[2]","name":"_deprecated","type":"address[2]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"old","type":"bool"},{"indexed":false,"internalType":"bool","name":"updated","type":"bool"}],"name":"BackwardCompatible","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"BlacklistPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"globalReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardMultiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"old","type":"bool"},{"indexed":false,"internalType":"bool","name":"updated","type":"bool"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"FarmingStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"old","type":"address"},{"indexed":false,"internalType":"address","name":"updated","type":"address"}],"name":"GovernanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MigrateFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardPerBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardMultiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"NewPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"bool","name":"old","type":"bool"},{"indexed":false,"internalType":"bool","name":"updated","type":"bool"}],"name":"RewardStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"old","type":"address"},{"indexed":false,"internalType":"address","name":"updated","type":"address"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"old","type":"bool"},{"indexed":false,"internalType":"bool","name":"updated","type":"bool"}],"name":"ToggleBooster","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"old","type":"address"},{"indexed":false,"internalType":"address","name":"updated","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"UpdateActiveAlt","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"old","type":"bool"},{"indexed":false,"internalType":"bool","name":"updated","type":"bool"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"UpdateAltState","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"old","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updated","type":"uint256"}],"name":"UpdateFarmingLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"old","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updated","type":"uint256"}],"name":"UpdateMultiplier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"updated","type":"uint256"}],"name":"UpdatePilotPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":false,"internalType":"address","name":"newAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"time","type":"uint256"}],"name":"UpdateULM","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"booster","type":"uint256"}],"name":"UserBooster","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"WithdrawNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"globalReward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardTransferred","type":"uint256"}],"name":"WithdrawReward","type":"event"},{"inputs":[],"name":"backwardCompatible","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"}],"name":"blacklistPools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"currentReward","outputs":[{"internalType":"uint256","name":"pilotReward","type":"uint256"},{"internalType":"uint256","name":"globalReward","type":"uint256"},{"internalType":"uint256","name":"globalAltReward","type":"uint256"},{"internalType":"uint256","name":"altReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"depositNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"emergencyNFTWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"farmingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"farmingGrowthBlockLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256","name":"blockDifference","type":"uint256"},{"internalType":"uint256","name":"rewardPerBlock","type":"uint256"},{"internalType":"uint256","name":"multiplier","type":"uint256"},{"internalType":"uint256","name":"_globalReward","type":"uint256"}],"name":"getGlobalReward","outputs":[{"internalType":"uint256","name":"globalReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_pools","type":"address[]"},{"internalType":"uint256[]","name":"_multipliers","type":"uint256[]"}],"name":"initializer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isFarmingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newContract","type":"address"},{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"migrateFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"nftStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pilotPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolAltInfo","outputs":[{"internalType":"address","name":"altToken","type":"address"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"globalReward","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolInfo","outputs":[{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"globalReward","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"totalLockedLiquidity","type":"uint256"},{"internalType":"uint256","name":"rewardMultiplier","type":"uint256"},{"internalType":"bool","name":"isRewardActive","type":"bool"},{"internalType":"bool","name":"isAltActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolListed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakeContract","type":"address"}],"name":"setStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"toggleActiveAlt","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleBackwardCompatibility","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"toggleBooster","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleFarmingActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"}],"name":"toggleRewardStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalRewardSent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_pool","type":"address"}],"name":"totalUserNftWRTPool","outputs":[{"internalType":"uint256","name":"tokenCount","type":"uint256"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"address","name":"_altToken","type":"address"}],"name":"updateAltToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"updateFarmingLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"updateGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pool","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updateMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"updatePilotPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ulm","type":"address"}],"name":"updateULM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"userInfo","outputs":[{"internalType":"bool","name":"boosterActive","type":"bool"},{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"altReward","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userToPoolToTokenIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"withdrawReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040526000805460ff19166001908117909155670de0b6b3a764000090553480156200002c57600080fd5b506040516200452a3803806200452a8339810160408190526200004f9162000156565b60008054600480546001600160a01b0319166001600160a01b03878116919091179091556101006301000000600160b81b03199092166301000000918616919091021761ff001916179055620000a96006826002620000c5565b50506000805462ff000019166201000017905550620002089050565b826002810192821562000110579160200282015b828111156200011057825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620000d9565b506200011e92915062000122565b5090565b5b808211156200011e576000815560010162000123565b80516001600160a01b03811681146200015157600080fd5b919050565b6000806000608084860312156200016b578283fd5b620001768462000139565b925060206200018781860162000139565b925085605f86011262000198578182fd5b604080519081016001600160401b0381118282101715620001b557fe5b8060405250806040870188608089011115620001cf578485fd5b845b6002811015620001f957620001e68262000139565b83529184019190840190600101620001d1565b50505080925050509250925092565b61431280620002186000396000f3fe60806040526004361061026e5760003560e01c80638a46311b11610153578063de036186116100cb578063e6d1c4281161007f578063ef0b0a9311610064578063ef0b0a93146106ff578063f681581014610714578063fe78434a1461073457610275565b8063e6d1c428146106ca578063e91a7ca6146106df57610275565b8063e114d9bd116100b0578063e114d9bd14610675578063e187988f14610695578063e2ea1319146106aa57610275565b8063de03618614610627578063e0059c3d1461065557610275565b8063a48f394711610122578063b2eb009711610107578063b2eb0097146105d2578063d2f9345f146105f2578063d980811b1461061257610275565b8063a48f394714610592578063b2561263146105b257610275565b80638a46311b146104ff5780639a7b5f111461051f5780639b26acca146105525780639eb85b701461057257610275565b80634e046fec116101e6578063654bea07116101b55780636a1af1371161019a5780636a1af137146104aa57806376894f4c146104ca57806380179209146104df57610275565b8063654bea071461046a57806369f345501461048a57610275565b80634e046fec146103e157806351d70bc4146103f6578063523a3f08146104285780635aa6e6751461044857610275565b8063260256741161023d5780633e2fff63116102225780633e2fff631461037f57806349453e3e146103945780634c70179d146103b457610275565b8063260256741461032f5780632b09b4fd1461034f57610275565b8063023245d71461027a5780630e39aac91461029c578063150b7a02146102d2578063162c6358146102ff57610275565b3661027557005b600080fd5b34801561028657600080fd5b5061029a610295366004613be4565b610754565b005b3480156102a857600080fd5b506102bc6102b7366004613759565b610962565b6040516102c9919061417c565b60405180910390f35b3480156102de57600080fd5b506102f26102ed366004613799565b6109a0565b6040516102c99190613e4d565b34801561030b57600080fd5b5061031f61031a3660046136e9565b6109c9565b6040516102c99493929190613d30565b34801561033b57600080fd5b5061029a61034a3660046136e9565b6109fa565b34801561035b57600080fd5b5061036f61036a366004613be4565b610a9e565b6040516102c994939291906141eb565b34801561038b57600080fd5b5061029a610e44565b3480156103a057600080fd5b5061029a6103af3660046138bd565b610ed1565b3480156103c057600080fd5b506103d46103cf3660046136e9565b611031565b6040516102c99190613dc1565b3480156103ed57600080fd5b506103d4611046565b34801561040257600080fd5b50610416610411366004613be4565b611054565b6040516102c996959493929190613dcc565b34801561043457600080fd5b5061029a610443366004613be4565b611097565b34801561045457600080fd5b5061045d611349565b6040516102c99190613c14565b34801561047657600080fd5b5061029a610485366004613be4565b61135f565b34801561049657600080fd5b5061029a6104a5366004613721565b6113de565b3480156104b657600080fd5b5061029a6104c5366004613be4565b611529565b3480156104d657600080fd5b506102bc6116c3565b3480156104eb57600080fd5b506103d46104fa366004613be4565b6116c9565b34801561050b57600080fd5b506103d461051a3660046136e9565b6116de565b34801561052b57600080fd5b5061053f61053a3660046136e9565b61183c565b6040516102c99796959493929190614206565b34801561055e57600080fd5b5061029a61056d366004613759565b61187d565b34801561057e57600080fd5b506103d461058d366004613be4565b611928565b34801561059e57600080fd5b5061029a6105ad3660046138f0565b61193d565b3480156105be57600080fd5b5061029a6105cd3660046136e9565b611b01565b3480156105de57600080fd5b5061045d6105ed366004613be4565b611ba6565b3480156105fe57600080fd5b5061029a61060d3660046136e9565b611bd0565b34801561061e57600080fd5b506102bc611cb5565b34801561063357600080fd5b50610647610642366004613721565b611cbb565b6040516102c9929190614185565b34801561066157600080fd5b5061029a61067036600461384f565b611d3a565b34801561068157600080fd5b506102bc61069036600461387a565b611dd5565b3480156106a157600080fd5b506103d4611f4d565b3480156106b657600080fd5b5061029a6106c53660046136e9565b611f5c565b3480156106d657600080fd5b5061029a611fea565b3480156106eb57600080fd5b506103d46106fa366004613be4565b61206d565b34801561070b57600080fd5b506102bc61266c565b34801561072057600080fd5b5061029a61072f366004613be4565b612672565b34801561074057600080fd5b5061029a61074f366004613be4565b6126db565b6000818152600d60209081526040808320805461010090046001600160a01b03168452600b8352818420600c909352922061078e84611097565b600483015460038301546107a191612821565b6003830155604051632142170760e11b815273de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c906342842e0e906107e190309033908990600401613c28565b600060405180830381600087803b1580156107fb57600080fd5b505af115801561080f573d6000803e3d6000fd5b50505060008581526009602052604090819020805460ff1916905584546001860154600386015492517f0127a8d3f57942833f6930572bce52ad882683e36eeb5830d199d3fa4bfa9467945061087b936101009093046001600160a01b03908116939216918991613c89565b60405180910390a160038201546108b35743808355600280840182905560006001808601829055840183905560038401929092558201555b82546000906108d09061010090046001600160a01b031686612883565b600185015485549192506108f79183916001600160a01b0390811691610100900416612953565b505050600091825250600d6020526040812080547fffffffffffffffffffffff00000000000000000000000000000000000000000016815560018101805473ffffffffffffffffffffffffffffffffffffffff19169055600281018290556003810182905560040155565b600e602052826000526040600020602052816000526040600020818154811061098a57600080fd5b9060005260206000200160009250925050505481565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b600c6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b600054630100000090046001600160a01b03163314610a345760405162461bcd60e51b8152600401610a2b906140a0565b60405180910390fd5b600480546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff198316179092556040517fa4e6f4790d4cd79f956a51c215b32692961c2b48ee9ad20ecdedc83896ec092492610a9392169084904290613c28565b60405180910390a150565b6000806000806000600d60008781526020019081526020016000206040518060c00160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001600282015481526020016003820154815260200160048201548152505090506000600b600083602001516001600160a01b03166001600160a01b031681526020019081526020016000206040518060e001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff16151515158152505090506000600c600084602001516001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820154815260200160028201548152602001600382015481525050905060008060019054906101000a900460ff1615610ccf57610ca28982612a67565b96508260c0015115610cc257506001610cbb8982612a67565b9550610cca565b816040015195505b610cde565b82602001519650816040015195505b6000610cf785606001518961282190919063ffffffff16565b90506000610d24670de0b6b3a7640000610d1e8860a0015185612bf790919063ffffffff16565b90612c57565b865190915015610dfc576000600560009054906101000a90046001600160a01b03166001600160a01b031663f1c7ead5886040015189602001518f6040518463ffffffff1660e01b8152600401610d7d93929190613c28565b60206040518083038186803b158015610d9557600080fd5b505afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd9190613bfc565b90506000610de7670de0b6b3a7640000610d1e8585612bf7565b9050610df38382612cbe565b9b505050610e00565b8099505b6080860151610e10908990612821565b9050610e35670de0b6b3a7640000610d1e8860a0015184612bf790919063ffffffff16565b96505050505050509193509193565b600054630100000090046001600160a01b03163314610e755760405162461bcd60e51b8152600401610a2b906140a0565b6000805462ff0000198116620100009182900460ff168015928302919091179092556040517f1941feea2dd9873c605b1a8ef66cd44c6b1291053844fc17ef85705f7ac893ed92610ec7929091613e02565b60405180910390a1565b600054630100000090046001600160a01b03163314610f025760405162461bcd60e51b8152600401610a2b906140a0565b60005b815181101561102d576000600a6000848481518110610f2057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600b6000848481518110610f7157fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055507f2e365bdf4a1a6d9b98e84b7ccacb5f206df07655ede46e439a9c224e7e2204cb828281518110610fcd57fe5b6020026020010151600a6000858581518110610fe557fe5b6020908102919091018101516001600160a01b03168252810191909152604090810160002054905161101d929160ff16904290613cd5565b60405180910390a1600101610f05565b5050565b600a6020526000908152604090205460ff1681565b600054610100900460ff1681565b600d602052600090815260409020805460018201546002830154600384015460049094015460ff8416946101009094046001600160a01b03908116949316929086565b60005460ff166001146110f1576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6000805460ff19168155818152600d602090815260408083205461010090046001600160a01b0316808452600b9092529091206005015460ff166111475760405162461bcd60e51b8152600401610a2b90613f56565b6000828152600d6020908152604080832080546001600160a01b0361010090910481168552600b9093529220600183015490911633146111995760405162461bcd60e51b8152600401610a2b90613e7a565b6000806000806111a888610a9e565b6040516370a0823160e01b81529397509195509350915084907337c997b35c619c21323f3518b9357914e8b99525906370a08231906111eb903090600401613c14565b60206040518083038186803b15801561120357600080fd5b505afa158015611217573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123b9190613bfc565b10156112595760405162461bcd60e51b8152600401610a2b90613f8d565b600180860184905543600280880191909155870184905560038054860190556000898152600d6020526040902001546112b1907337c997b35c619c21323f3518b9357914e8b99525906001600160a01b031686612d18565b6005850154610100900460ff16156112ce576112ce888383612d98565b855460048701546002880154600188015460038901546040517f9b9d8da5d27dfe5549281e1b4073cb0efb18290496c0a8a02f79bb6f78b949f89561132a956101009091046001600160a01b0316948f94919390928c90613d86565b60405180910390a150506000805460ff19166001179055505050505050565b600054630100000090046001600160a01b031681565b6005546001600160a01b031633146113895760405162461bcd60e51b8152600401610a2b90613fc4565b6000818152600d602052604090819020805460ff8116801560ff19909216821790925591517ff5fbd91e709188c9f5b84b7659734442a7ed59e8453479681b9112e978911f7192610a939285929091906141c5565b600054630100000090046001600160a01b0316331461140f5760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b038083166000908152600c602052604090819020805484841673ffffffffffffffffffffffffffffffffffffffff1982161790915590517fa0e4b2e70e75682ac0a14798ed92d56cdfc25f23b3a1a4868b6a89ebf89776a49261147e92169084908690613c66565b60405180910390a1506001600160a01b039081166000818152600c602081815260408084208151608080820184528254808a1680845260018501805485890152600286018054868901526003870180546060978801528851958601895292855243858a018181529886018c81529686019081529b909a5297909652905173ffffffffffffffffffffffffffffffffffffffff1990911698169790971790555190915592519055519055565b600054630100000090046001600160a01b0316331461155a5760405162461bcd60e51b8152600401610a2b906140a0565b600060088054806020026020016040519081016040528092919081815260200182805480156115b257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611594575b505050505090508160018190555060005b81518110156116be57600a60008383815181106115dc57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16156116b657600b600083838151811061161857fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600301546000146116675761166782828151811061165a57fe5b6020026020010151612ea3565b7f0756a8fb33d6a153eb3423590c4d7dc627b5be8291070abc6f198434edc2ad1f82828151811061169457fe5b60200260200101516001546040516116ad929190613cf6565b60405180910390a15b6001016115c3565b505050565b60035481565b60096020526000908152604090205460ff1681565b60008054630100000090046001600160a01b031633146117105760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b038281166000908152600c6020526040902054166117475760405162461bcd60e51b8152600401610a2b90613f1f565b6001600160a01b0382166000908152600b602052604090819020600501805461ff001981166101009182900460ff1680159283029190911790925591517f9428b14715fa506a37634b78e263b6993d22ed1389aead8ae8edcbfd77b125ca926117b292918690613e14565b60405180910390a16001600160a01b0382166000908152600b6020526040902060050154610100900460ff16156117f1576117ec82612f04565b611811565b6001600160a01b0382166000908152600c60205260409020436003909101555b506001600160a01b0381166000908152600b6020526040902060050154610100900460ff165b919050565b600b60205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909160ff8082169161010090041687565b600054630100000090046001600160a01b031633146118ae5760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b0383166118d45760405162461bcd60e51b8152600401610a2b90613eb1565b6118e86001600160a01b0383168483612d18565b7f77e495c0e82622b2e795fb14f2a956e1dd14664ea8dbc629c12f4859b416aaea83838360405161191b93929190613c28565b60405180910390a1505050565b60009081526009602052604090205460ff1690565b600054630100000090046001600160a01b0316331461196e5760405162461bcd60e51b8152600401610a2b906140a0565b805182511461198f5760405162461bcd60e51b8152600401610a2b90614069565b60005b82518110156116be57600a60008483815181106119ab57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16158015611a1a5750600b60008483815181106119ea57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600001546000145b15611a5457611a4f838281518110611a2e57fe5b6020026020010151838381518110611a4257fe5b6020026020010151612f86565b611af9565b6001600a6000858481518110611a6657fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550818181518110611ab157fe5b6020026020010151600b6000858481518110611ac957fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055505b600101611992565b600054630100000090046001600160a01b03163314611b325760405162461bcd60e51b8152600401610a2b906140a0565b600080546001600160a01b0383811663010000009081027fffffffffffffffffff0000000000000000000000000000000000000000ffffff8416179093556040517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d93610a93930491909116908490613c4c565b60088181548110611bb657600080fd5b6000918252602090912001546001600160a01b0316905081565b600054630100000090046001600160a01b03163314611c015760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b0381166000908152600b602052604090206005015460ff1615611c3357611c2e81612ea3565b611c53565b6001600160a01b0381166000908152600b60205260409020436002909101555b6001600160a01b0381166000908152600b602052604090819020600501805460ff8116801560ff19909216821790925591517f7d12eea0e5cab2f6a32b807301c1caffeb338666dbde5f1810ab8c4f85e32f8e92610a93928592909190613cb2565b60015481565b6001600160a01b038281166000908152600e602090815260408083209385168352928152908290208054835181840281018401909452808452926060929091908490830182828015611d2c57602002820191906000526020600020905b815481526020019060010190808311611d18575b505050505090509250929050565b600054630100000090046001600160a01b03163314611d6b5760405162461bcd60e51b8152600401610a2b906140a0565b611d7482612ea3565b6001600160a01b0382166000908152600b60205260409081902060040180549083905590517fe346bcf94febb1a9b3532044446578f42556fca15e448581e3cceebef069ec4891611dc9918591908590613d0f565b60405180910390a15050565b60008054819062010000900460ff1615611ee65760005b6002811015611eb757600060068260028110611e0457fe5b01546040517f9a7b5f110000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690639a7b5f1190611e4c908c90600401613c14565b60e06040518083038186803b158015611e6457600080fd5b505afa158015611e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9c9190613ada565b606001519050611eac8382612cbe565b925050600101611dec565b506001600160a01b0387166000908152600b6020526040902060030154611edf908290612cbe565b9050611f04565b506001600160a01b0386166000908152600b60205260409020600301545b6000611f198686670de0b6b3a76400006131d1565b9050611f4184611f3b611f2c8a85612bf7565b670de0b6b3a7640000866131d1565b90612cbe565b98975050505050505050565b60005462010000900460ff1681565b600054630100000090046001600160a01b03163314611f8d5760405162461bcd60e51b8152600401610a2b906140a0565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff198316179092556040517f72b356fd889b9abd3530accd2c9f4aecbce67d70757181f9f862ac91464ce19292610a939216908490613c4c565b600054630100000090046001600160a01b0316331461201b5760405162461bcd60e51b8152600401610a2b906140a0565b6000805461ff001981166101009182900460ff168015928302919091179092556040517fe3124efa4603876b183777db0e9f8f4e39b40c6bb3fc4d52e3bb6775e749b1f992610ec79290914290613e35565b60008054610100900460ff166120955760405162461bcd60e51b8152600401610a2b9061410e565b600254156120b55760405162461bcd60e51b8152600401610a2b906140d7565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081528290339073de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c90636352211e9061210990859060040161417c565b60206040518083038186803b15801561212157600080fd5b505afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121599190613705565b6001600160a01b03161461217f5760405162461bcd60e51b8152600401610a2b90613e7a565b600480546040517f1e7f137000000000000000000000000000000000000000000000000000000000815233926000926001600160a01b031691631e7f1370916121ca9189910161417c565b60e06040518083038186803b1580156121e257600080fd5b505afa1580156121f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221a9190613b62565b6020808201516040808401516001600160a01b0383166000908152600a9094529220549293509160ff166122605760405162461bcd60e51b8152600401610a2b90613ffb565b600480546040517f35dca7030000000000000000000000000000000000000000000000000000000081526000926001600160a01b03909216916335dca703916122ab91879101613c14565b6102406040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc91906139a9565b6101408101519091508281108015906123155750600083115b6123315760405162461bcd60e51b8152600401610a2b90614145565b6001600160a01b0384166000908152600b60205260409020805460028201541461238e57600061236e82600201544361282190919063ffffffff16565b9050612387868260015485600401548660010154611dd5565b6001830155505b600381015461239d9085612cbe565b81600301819055506040518060c00160405280600015158152602001866001600160a01b03168152602001886001600160a01b0316815260200182600101548152602001600d60008d815260200190815260200160002060030154815260200185815250600d60008c815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a08201518160040155905050600e6000886001600160a01b03166001600160a01b031681526020019081526020016000206000866001600160a01b03166001600160a01b031681526020019081526020016000208a90806001815401808255809150506001900390600052602060002001600090919091909150556001600960008c815260200190815260200160002060006101000a81548160ff02191690831515021790555073de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c6001600160a01b03166342842e0e88308d6040518463ffffffff1660e01b815260040161258e93929190613c28565b600060405180830381600087803b1580156125a857600080fd5b505af11580156125bc573d6000803e3d6000fd5b505050506005810154610100900460ff16156125dc576125dc858b613280565b4381600201819055507f55e1b84deec6eefe49c2c96afe1d5b43ca37768907f7388696c6009e7bbe3b54858b600d60008e8152602001908152602001600020600401548460030154856001015486600401546001546040516126449796959493929190613d86565b60405180910390a1505050600096875250506009602052505060409092205460ff1692915050565b60025481565b600054630100000090046001600160a01b031633146126a35760405162461bcd60e51b8152600401610a2b906140a0565b7fd92c3464a10ecea59217f3d2d1a916160b75f798612beba0674f7d15572d1fdd600254826002819055604051610a939291906141dd565b6000818152600d6020526040902060018101546001600160a01b031633146127155760405162461bcd60e51b8152600401610a2b90613ee8565b805461010090046001600160a01b03166000908152600b60209081526040808320600c9092529091206004830154600383015461275191612821565b60038301556001830154604051632142170760e11b815273de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c916342842e0e916127a09130916001600160a01b03909116908990600401613c28565b600060405180830381600087803b1580156127ba57600080fd5b505af11580156127ce573d6000803e3d6000fd5b505050508160030154600014156108b3574380835560028084018290556000600180860182905584018390556003840192909255820181905583546108d09061010090046001600160a01b031686612883565b600082821115612878576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b336000908152600e602090815260408083206001600160a01b03861684528252808320805482518185028101850190935280835284938301828280156128e857602002820191906000526020600020905b8154815260200190600101908083116128d4575b5050505050905060005b8151811161294b57336000908152600e602090815260408083206001600160a01b0389168452909152902080548290811061292957fe5b90600052602060002001548414156129435780925061294b565b6001016128f2565b505092915050565b6001600160a01b038083166000908152600e602090815260408083209385168352929052205483106129975760405162461bcd60e51b8152600401610a2b90614032565b6001600160a01b038281166000908152600e60209081526040808320938516835292905290812080546129cb906001612821565b815481106129d557fe5b60009182526020808320909101546001600160a01b038087168452600e835260408085209187168552925291208054919250829186908110612a1357fe5b60009182526020808320909101929092556001600160a01b038086168252600e835260408083209186168352925220805480612a4b57fe5b6001900381819060005260206000200160009055905550505050565b6000828152600d602052604081205461010090046001600160a01b0316612a8c6135f5565b6000846001811115612a9a57fe5b1415612aea5750604080516060810182526001600160a01b0383166000818152600b6020818152858320600181015486526002810154828701529390925290526004015491810191909152612b48565b6001846001811115612af857fe5b1415612b485750604080516060810182526001600160a01b0383166000818152600c6020908152848220600281015485526003015481850152918152600b90915282902060040154918101919091525b6002548160200151108015612b5e575060025443115b15612b9657612b8f82612b80836020015160025461282190919063ffffffff16565b60015460408501518551611dd5565b925061294b565b6002548160200151118015612bad57506000600254115b15612bbb578051925061294b565b6000612bd482602001514361282190919063ffffffff16565b9050612bed838260015485604001518660000151611dd5565b9695505050505050565b600082612c065750600061287d565b82820282848281612c1357fe5b0414612c505760405162461bcd60e51b81526004018080602001828103825260218152602001806142bb6021913960400191505060405180910390fd5b9392505050565b6000808211612cad576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612cb657fe5b049392505050565b600082820183811015612c50576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526116be908490613328565b6000838152600d60209081526040808320546001600160a01b0361010090910481168452600c90925291829020805492516370a0823160e01b81529092849216906370a0823190612ded903090600401613c14565b60206040518083038186803b158015612e0557600080fd5b505afa158015612e19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3d9190613bfc565b1015612e5b5760405162461bcd60e51b8152600401610a2b90613f8d565b43600380830191909155600282018490556000858152600d60205260409020908101849055600101548154612e9d916001600160a01b03918216911684612d18565b50505050565b6001600160a01b0381166000908152600b6020526040902060038101541561102d576000612ef483612ee284600201544361282190919063ffffffff16565b60015485600401548660010154611dd5565b6001830155504360028201555050565b6001600160a01b0381166000908152600c60209081526040808320600b909252909120600301541561102d576000612f7683612f4d84600301544361282190919063ffffffff16565b6001546001600160a01b0387166000908152600b60205260409020600401546002870154611dd5565b6002830155504360038201555050565b6001600a6000846001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506008829080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055506040518060e001604052804381526020016000815260200143815260200160008152602001828152602001600115158152602001600b6000856001600160a01b03166001600160a01b0316815260200190815260200160002060050160019054906101000a900460ff161515815250600b6000846001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff0219169083151502179055509050507f0314a127947f2a3f74d5ee6c05752242c48803b68534b577cfd35c81d06fccfb82600154600b6000866001600160a01b03166001600160a01b0316815260200190815260200160002060040154600b6000876001600160a01b03166001600160a01b0316815260200190815260200160002060020154600a6000886001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff16604051611dc9959493929190613d56565b600080806000198587098686029250828110908390030390508061320757600084116131fc57600080fd5b508290049050612c50565b80841161321357600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6001600160a01b0382166000908152600c6020526040902060018101546003820154146133045760006132c082600301544361282190919063ffffffff16565b90506132fd8482600154600b6000896001600160a01b03166001600160a01b03168152602001908152602001600020600401548660020154611dd5565b6002830155505b436003808301919091556002909101546000928352600d6020526040909220015550565b600061337d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133d99092919063ffffffff16565b8051909150156116be5780806020019051602081101561339c57600080fd5b50516116be5760405162461bcd60e51b815260040180806020018281038252602a8152602001806142dc602a913960400191505060405180910390fd5b60606133e884846000856133f0565b949350505050565b6060824710156134315760405162461bcd60e51b81526004018080602001828103825260268152602001806142956026913960400191505060405180910390fd5b61343a8561354b565b61348b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106134c95780518252601f1990920191602091820191016134aa565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461352b576040519150601f19603f3d011682016040523d82523d6000602084013e613530565b606091505b5091509150613540828286613551565b979650505050505050565b3b151590565b60608315613560575081612c50565b8251156135705782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156135ba5781810151838201526020016135a2565b50505050905090810190601f1680156135e75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60405180606001604052806000815260200160008152602001600081525090565b80516118378161427c565b600082601f830112613631578081fd5b813560206136466136418361425e565b61423a565b8281528181019085830183850287018401881015613662578586fd5b855b858110156136895781356136778161427c565b84529284019290840190600101613664565b5090979650505050505050565b8051801515811461183757600080fd5b8051600281900b811461183757600080fd5b80516fffffffffffffffffffffffffffffffff8116811461183757600080fd5b805160ff8116811461183757600080fd5b6000602082840312156136fa578081fd5b8135612c508161427c565b600060208284031215613716578081fd5b8151612c508161427c565b60008060408385031215613733578081fd5b823561373e8161427c565b9150602083013561374e8161427c565b809150509250929050565b60008060006060848603121561376d578081fd5b83356137788161427c565b925060208401356137888161427c565b929592945050506040919091013590565b600080600080608085870312156137ae578182fd5b84356137b98161427c565b93506020858101356137ca8161427c565b935060408601359250606086013567ffffffffffffffff808211156137ed578384fd5b818801915088601f830112613800578384fd5b81358181111561380c57fe5b61381e601f8201601f1916850161423a565b91508082528984828501011115613833578485fd5b8084840185840137810190920192909252939692955090935050565b60008060408385031215613861578182fd5b823561386c8161427c565b946020939093013593505050565b600080600080600060a08688031215613891578283fd5b853561389c8161427c565b97602087013597506040870135966060810135965060800135945092505050565b6000602082840312156138ce578081fd5b813567ffffffffffffffff8111156138e4578182fd5b6133e884828501613621565b60008060408385031215613902578182fd5b823567ffffffffffffffff80821115613919578384fd5b61392586838701613621565b935060209150818501358181111561393b578384fd5b85019050601f8101861361394d578283fd5b803561395b6136418261425e565b81815283810190838501858402850186018a1015613977578687fd5b8694505b8385101561399957803583526001949094019391850191850161397b565b5080955050505050509250929050565b60006102408083850312156139bc578182fd5b6139c58161423a565b90506139d0836136a6565b81526139de602084016136a6565b60208201526139ef604084016136b8565b6040820152613a00606084016136a6565b6060820152613a11608084016136a6565b6080820152613a2260a084016136b8565b60a082015260c0838101519082015260e08084015190820152610100808401519082015261012080840151908201526101408084015190820152610160613a6a818501613696565b90820152610180613a7c848201613616565b908201526101a0613a8e848201613616565b908201526101c083810151908201526101e0613aab8185016136d8565b90820152610200613abd848201613696565b90820152610220613acf848201613696565b908201529392505050565b600060e08284031215613aeb578081fd5b60405160e0810181811067ffffffffffffffff82111715613b0857fe5b80604052508251815260208301516020820152604083015160408201526060830151606082015260808301516080820152613b4560a08401613696565b60a0820152613b5660c08401613696565b60c08201529392505050565b600060e08284031215613b73578081fd5b60405160e0810181811067ffffffffffffffff82111715613b9057fe5b60405282518152613ba360208401613616565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600060208284031215613bf5578081fd5b5035919050565b600060208284031215613c0d578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b0393909316835290151560208301521515604082015260600190565b6001600160a01b039390931683529015156020830152604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6001600160a01b039590951685526020850193909352604084019190915260608301521515608082015260a00190565b6001600160a01b03979097168752602087019590955260408601939093526060850191909152608084015260a083015260c082015260e00190565b901515815260200190565b95151586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b91151582521515602082015260400190565b921515835290151560208301526001600160a01b0316604082015260600190565b92151583529015156020830152604082015260600190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b60208082526002908201527f4e4f000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f434e450000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f4e4f4f0000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f544e450000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f524e410000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4946000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4e53000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f504e570000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f494f420000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f4c4e530000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4e41000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4c41000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f464e410000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f494c000000000000000000000000000000000000000000000000000000000000604082015260600190565b90815260200190565b60006040820184835260206040818501528185518084526060860191508287019350845b81811015613689578451835293830193918301916001016141a9565b92835290151560208301521515604082015260600190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b9687526020870195909552604086019390935260608501919091526080840152151560a0830152151560c082015260e00190565b60405181810167ffffffffffffffff8111828210171561425657fe5b604052919050565b600067ffffffffffffffff82111561427257fe5b5060209081020190565b6001600160a01b038116811461429157600080fd5b5056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a164736f6c6343000706000a000000000000000000000000a7979d0592ecfc59b082552828ff36209ec94b11000000000000000000000000c36d07ecd1c562ce09dcb63b4d51ce2d5baf45630000000000000000000000006e665791f0219a10a4d52ac0915931cf045220b80000000000000000000000008fddc464ee63575463afd214586344a09b309102

Deployed Bytecode

0x60806040526004361061026e5760003560e01c80638a46311b11610153578063de036186116100cb578063e6d1c4281161007f578063ef0b0a9311610064578063ef0b0a93146106ff578063f681581014610714578063fe78434a1461073457610275565b8063e6d1c428146106ca578063e91a7ca6146106df57610275565b8063e114d9bd116100b0578063e114d9bd14610675578063e187988f14610695578063e2ea1319146106aa57610275565b8063de03618614610627578063e0059c3d1461065557610275565b8063a48f394711610122578063b2eb009711610107578063b2eb0097146105d2578063d2f9345f146105f2578063d980811b1461061257610275565b8063a48f394714610592578063b2561263146105b257610275565b80638a46311b146104ff5780639a7b5f111461051f5780639b26acca146105525780639eb85b701461057257610275565b80634e046fec116101e6578063654bea07116101b55780636a1af1371161019a5780636a1af137146104aa57806376894f4c146104ca57806380179209146104df57610275565b8063654bea071461046a57806369f345501461048a57610275565b80634e046fec146103e157806351d70bc4146103f6578063523a3f08146104285780635aa6e6751461044857610275565b8063260256741161023d5780633e2fff63116102225780633e2fff631461037f57806349453e3e146103945780634c70179d146103b457610275565b8063260256741461032f5780632b09b4fd1461034f57610275565b8063023245d71461027a5780630e39aac91461029c578063150b7a02146102d2578063162c6358146102ff57610275565b3661027557005b600080fd5b34801561028657600080fd5b5061029a610295366004613be4565b610754565b005b3480156102a857600080fd5b506102bc6102b7366004613759565b610962565b6040516102c9919061417c565b60405180910390f35b3480156102de57600080fd5b506102f26102ed366004613799565b6109a0565b6040516102c99190613e4d565b34801561030b57600080fd5b5061031f61031a3660046136e9565b6109c9565b6040516102c99493929190613d30565b34801561033b57600080fd5b5061029a61034a3660046136e9565b6109fa565b34801561035b57600080fd5b5061036f61036a366004613be4565b610a9e565b6040516102c994939291906141eb565b34801561038b57600080fd5b5061029a610e44565b3480156103a057600080fd5b5061029a6103af3660046138bd565b610ed1565b3480156103c057600080fd5b506103d46103cf3660046136e9565b611031565b6040516102c99190613dc1565b3480156103ed57600080fd5b506103d4611046565b34801561040257600080fd5b50610416610411366004613be4565b611054565b6040516102c996959493929190613dcc565b34801561043457600080fd5b5061029a610443366004613be4565b611097565b34801561045457600080fd5b5061045d611349565b6040516102c99190613c14565b34801561047657600080fd5b5061029a610485366004613be4565b61135f565b34801561049657600080fd5b5061029a6104a5366004613721565b6113de565b3480156104b657600080fd5b5061029a6104c5366004613be4565b611529565b3480156104d657600080fd5b506102bc6116c3565b3480156104eb57600080fd5b506103d46104fa366004613be4565b6116c9565b34801561050b57600080fd5b506103d461051a3660046136e9565b6116de565b34801561052b57600080fd5b5061053f61053a3660046136e9565b61183c565b6040516102c99796959493929190614206565b34801561055e57600080fd5b5061029a61056d366004613759565b61187d565b34801561057e57600080fd5b506103d461058d366004613be4565b611928565b34801561059e57600080fd5b5061029a6105ad3660046138f0565b61193d565b3480156105be57600080fd5b5061029a6105cd3660046136e9565b611b01565b3480156105de57600080fd5b5061045d6105ed366004613be4565b611ba6565b3480156105fe57600080fd5b5061029a61060d3660046136e9565b611bd0565b34801561061e57600080fd5b506102bc611cb5565b34801561063357600080fd5b50610647610642366004613721565b611cbb565b6040516102c9929190614185565b34801561066157600080fd5b5061029a61067036600461384f565b611d3a565b34801561068157600080fd5b506102bc61069036600461387a565b611dd5565b3480156106a157600080fd5b506103d4611f4d565b3480156106b657600080fd5b5061029a6106c53660046136e9565b611f5c565b3480156106d657600080fd5b5061029a611fea565b3480156106eb57600080fd5b506103d46106fa366004613be4565b61206d565b34801561070b57600080fd5b506102bc61266c565b34801561072057600080fd5b5061029a61072f366004613be4565b612672565b34801561074057600080fd5b5061029a61074f366004613be4565b6126db565b6000818152600d60209081526040808320805461010090046001600160a01b03168452600b8352818420600c909352922061078e84611097565b600483015460038301546107a191612821565b6003830155604051632142170760e11b815273de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c906342842e0e906107e190309033908990600401613c28565b600060405180830381600087803b1580156107fb57600080fd5b505af115801561080f573d6000803e3d6000fd5b50505060008581526009602052604090819020805460ff1916905584546001860154600386015492517f0127a8d3f57942833f6930572bce52ad882683e36eeb5830d199d3fa4bfa9467945061087b936101009093046001600160a01b03908116939216918991613c89565b60405180910390a160038201546108b35743808355600280840182905560006001808601829055840183905560038401929092558201555b82546000906108d09061010090046001600160a01b031686612883565b600185015485549192506108f79183916001600160a01b0390811691610100900416612953565b505050600091825250600d6020526040812080547fffffffffffffffffffffff00000000000000000000000000000000000000000016815560018101805473ffffffffffffffffffffffffffffffffffffffff19169055600281018290556003810182905560040155565b600e602052826000526040600020602052816000526040600020818154811061098a57600080fd5b9060005260206000200160009250925050505481565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b600c6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b600054630100000090046001600160a01b03163314610a345760405162461bcd60e51b8152600401610a2b906140a0565b60405180910390fd5b600480546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff198316179092556040517fa4e6f4790d4cd79f956a51c215b32692961c2b48ee9ad20ecdedc83896ec092492610a9392169084904290613c28565b60405180910390a150565b6000806000806000600d60008781526020019081526020016000206040518060c00160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001600282015481526020016003820154815260200160048201548152505090506000600b600083602001516001600160a01b03166001600160a01b031681526020019081526020016000206040518060e001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900460ff161515151581526020016005820160019054906101000a900460ff16151515158152505090506000600c600084602001516001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820154815260200160028201548152602001600382015481525050905060008060019054906101000a900460ff1615610ccf57610ca28982612a67565b96508260c0015115610cc257506001610cbb8982612a67565b9550610cca565b816040015195505b610cde565b82602001519650816040015195505b6000610cf785606001518961282190919063ffffffff16565b90506000610d24670de0b6b3a7640000610d1e8860a0015185612bf790919063ffffffff16565b90612c57565b865190915015610dfc576000600560009054906101000a90046001600160a01b03166001600160a01b031663f1c7ead5886040015189602001518f6040518463ffffffff1660e01b8152600401610d7d93929190613c28565b60206040518083038186803b158015610d9557600080fd5b505afa158015610da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcd9190613bfc565b90506000610de7670de0b6b3a7640000610d1e8585612bf7565b9050610df38382612cbe565b9b505050610e00565b8099505b6080860151610e10908990612821565b9050610e35670de0b6b3a7640000610d1e8860a0015184612bf790919063ffffffff16565b96505050505050509193509193565b600054630100000090046001600160a01b03163314610e755760405162461bcd60e51b8152600401610a2b906140a0565b6000805462ff0000198116620100009182900460ff168015928302919091179092556040517f1941feea2dd9873c605b1a8ef66cd44c6b1291053844fc17ef85705f7ac893ed92610ec7929091613e02565b60405180910390a1565b600054630100000090046001600160a01b03163314610f025760405162461bcd60e51b8152600401610a2b906140a0565b60005b815181101561102d576000600a6000848481518110610f2057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600b6000848481518110610f7157fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055507f2e365bdf4a1a6d9b98e84b7ccacb5f206df07655ede46e439a9c224e7e2204cb828281518110610fcd57fe5b6020026020010151600a6000858581518110610fe557fe5b6020908102919091018101516001600160a01b03168252810191909152604090810160002054905161101d929160ff16904290613cd5565b60405180910390a1600101610f05565b5050565b600a6020526000908152604090205460ff1681565b600054610100900460ff1681565b600d602052600090815260409020805460018201546002830154600384015460049094015460ff8416946101009094046001600160a01b03908116949316929086565b60005460ff166001146110f1576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6000805460ff19168155818152600d602090815260408083205461010090046001600160a01b0316808452600b9092529091206005015460ff166111475760405162461bcd60e51b8152600401610a2b90613f56565b6000828152600d6020908152604080832080546001600160a01b0361010090910481168552600b9093529220600183015490911633146111995760405162461bcd60e51b8152600401610a2b90613e7a565b6000806000806111a888610a9e565b6040516370a0823160e01b81529397509195509350915084907337c997b35c619c21323f3518b9357914e8b99525906370a08231906111eb903090600401613c14565b60206040518083038186803b15801561120357600080fd5b505afa158015611217573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123b9190613bfc565b10156112595760405162461bcd60e51b8152600401610a2b90613f8d565b600180860184905543600280880191909155870184905560038054860190556000898152600d6020526040902001546112b1907337c997b35c619c21323f3518b9357914e8b99525906001600160a01b031686612d18565b6005850154610100900460ff16156112ce576112ce888383612d98565b855460048701546002880154600188015460038901546040517f9b9d8da5d27dfe5549281e1b4073cb0efb18290496c0a8a02f79bb6f78b949f89561132a956101009091046001600160a01b0316948f94919390928c90613d86565b60405180910390a150506000805460ff19166001179055505050505050565b600054630100000090046001600160a01b031681565b6005546001600160a01b031633146113895760405162461bcd60e51b8152600401610a2b90613fc4565b6000818152600d602052604090819020805460ff8116801560ff19909216821790925591517ff5fbd91e709188c9f5b84b7659734442a7ed59e8453479681b9112e978911f7192610a939285929091906141c5565b600054630100000090046001600160a01b0316331461140f5760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b038083166000908152600c602052604090819020805484841673ffffffffffffffffffffffffffffffffffffffff1982161790915590517fa0e4b2e70e75682ac0a14798ed92d56cdfc25f23b3a1a4868b6a89ebf89776a49261147e92169084908690613c66565b60405180910390a1506001600160a01b039081166000818152600c602081815260408084208151608080820184528254808a1680845260018501805485890152600286018054868901526003870180546060978801528851958601895292855243858a018181529886018c81529686019081529b909a5297909652905173ffffffffffffffffffffffffffffffffffffffff1990911698169790971790555190915592519055519055565b600054630100000090046001600160a01b0316331461155a5760405162461bcd60e51b8152600401610a2b906140a0565b600060088054806020026020016040519081016040528092919081815260200182805480156115b257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611594575b505050505090508160018190555060005b81518110156116be57600a60008383815181106115dc57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16156116b657600b600083838151811061161857fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600301546000146116675761166782828151811061165a57fe5b6020026020010151612ea3565b7f0756a8fb33d6a153eb3423590c4d7dc627b5be8291070abc6f198434edc2ad1f82828151811061169457fe5b60200260200101516001546040516116ad929190613cf6565b60405180910390a15b6001016115c3565b505050565b60035481565b60096020526000908152604090205460ff1681565b60008054630100000090046001600160a01b031633146117105760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b038281166000908152600c6020526040902054166117475760405162461bcd60e51b8152600401610a2b90613f1f565b6001600160a01b0382166000908152600b602052604090819020600501805461ff001981166101009182900460ff1680159283029190911790925591517f9428b14715fa506a37634b78e263b6993d22ed1389aead8ae8edcbfd77b125ca926117b292918690613e14565b60405180910390a16001600160a01b0382166000908152600b6020526040902060050154610100900460ff16156117f1576117ec82612f04565b611811565b6001600160a01b0382166000908152600c60205260409020436003909101555b506001600160a01b0381166000908152600b6020526040902060050154610100900460ff165b919050565b600b60205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909160ff8082169161010090041687565b600054630100000090046001600160a01b031633146118ae5760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b0383166118d45760405162461bcd60e51b8152600401610a2b90613eb1565b6118e86001600160a01b0383168483612d18565b7f77e495c0e82622b2e795fb14f2a956e1dd14664ea8dbc629c12f4859b416aaea83838360405161191b93929190613c28565b60405180910390a1505050565b60009081526009602052604090205460ff1690565b600054630100000090046001600160a01b0316331461196e5760405162461bcd60e51b8152600401610a2b906140a0565b805182511461198f5760405162461bcd60e51b8152600401610a2b90614069565b60005b82518110156116be57600a60008483815181106119ab57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16158015611a1a5750600b60008483815181106119ea57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600001546000145b15611a5457611a4f838281518110611a2e57fe5b6020026020010151838381518110611a4257fe5b6020026020010151612f86565b611af9565b6001600a6000858481518110611a6657fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550818181518110611ab157fe5b6020026020010151600b6000858481518110611ac957fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600401819055505b600101611992565b600054630100000090046001600160a01b03163314611b325760405162461bcd60e51b8152600401610a2b906140a0565b600080546001600160a01b0383811663010000009081027fffffffffffffffffff0000000000000000000000000000000000000000ffffff8416179093556040517f434a2db650703b36c824e745330d6397cdaa9ee2cc891a4938ae853e1c50b68d93610a93930491909116908490613c4c565b60088181548110611bb657600080fd5b6000918252602090912001546001600160a01b0316905081565b600054630100000090046001600160a01b03163314611c015760405162461bcd60e51b8152600401610a2b906140a0565b6001600160a01b0381166000908152600b602052604090206005015460ff1615611c3357611c2e81612ea3565b611c53565b6001600160a01b0381166000908152600b60205260409020436002909101555b6001600160a01b0381166000908152600b602052604090819020600501805460ff8116801560ff19909216821790925591517f7d12eea0e5cab2f6a32b807301c1caffeb338666dbde5f1810ab8c4f85e32f8e92610a93928592909190613cb2565b60015481565b6001600160a01b038281166000908152600e602090815260408083209385168352928152908290208054835181840281018401909452808452926060929091908490830182828015611d2c57602002820191906000526020600020905b815481526020019060010190808311611d18575b505050505090509250929050565b600054630100000090046001600160a01b03163314611d6b5760405162461bcd60e51b8152600401610a2b906140a0565b611d7482612ea3565b6001600160a01b0382166000908152600b60205260409081902060040180549083905590517fe346bcf94febb1a9b3532044446578f42556fca15e448581e3cceebef069ec4891611dc9918591908590613d0f565b60405180910390a15050565b60008054819062010000900460ff1615611ee65760005b6002811015611eb757600060068260028110611e0457fe5b01546040517f9a7b5f110000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690639a7b5f1190611e4c908c90600401613c14565b60e06040518083038186803b158015611e6457600080fd5b505afa158015611e78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e9c9190613ada565b606001519050611eac8382612cbe565b925050600101611dec565b506001600160a01b0387166000908152600b6020526040902060030154611edf908290612cbe565b9050611f04565b506001600160a01b0386166000908152600b60205260409020600301545b6000611f198686670de0b6b3a76400006131d1565b9050611f4184611f3b611f2c8a85612bf7565b670de0b6b3a7640000866131d1565b90612cbe565b98975050505050505050565b60005462010000900460ff1681565b600054630100000090046001600160a01b03163314611f8d5760405162461bcd60e51b8152600401610a2b906140a0565b600580546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff198316179092556040517f72b356fd889b9abd3530accd2c9f4aecbce67d70757181f9f862ac91464ce19292610a939216908490613c4c565b600054630100000090046001600160a01b0316331461201b5760405162461bcd60e51b8152600401610a2b906140a0565b6000805461ff001981166101009182900460ff168015928302919091179092556040517fe3124efa4603876b183777db0e9f8f4e39b40c6bb3fc4d52e3bb6775e749b1f992610ec79290914290613e35565b60008054610100900460ff166120955760405162461bcd60e51b8152600401610a2b9061410e565b600254156120b55760405162461bcd60e51b8152600401610a2b906140d7565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081528290339073de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c90636352211e9061210990859060040161417c565b60206040518083038186803b15801561212157600080fd5b505afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121599190613705565b6001600160a01b03161461217f5760405162461bcd60e51b8152600401610a2b90613e7a565b600480546040517f1e7f137000000000000000000000000000000000000000000000000000000000815233926000926001600160a01b031691631e7f1370916121ca9189910161417c565b60e06040518083038186803b1580156121e257600080fd5b505afa1580156121f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221a9190613b62565b6020808201516040808401516001600160a01b0383166000908152600a9094529220549293509160ff166122605760405162461bcd60e51b8152600401610a2b90613ffb565b600480546040517f35dca7030000000000000000000000000000000000000000000000000000000081526000926001600160a01b03909216916335dca703916122ab91879101613c14565b6102406040518083038186803b1580156122c457600080fd5b505afa1580156122d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122fc91906139a9565b6101408101519091508281108015906123155750600083115b6123315760405162461bcd60e51b8152600401610a2b90614145565b6001600160a01b0384166000908152600b60205260409020805460028201541461238e57600061236e82600201544361282190919063ffffffff16565b9050612387868260015485600401548660010154611dd5565b6001830155505b600381015461239d9085612cbe565b81600301819055506040518060c00160405280600015158152602001866001600160a01b03168152602001886001600160a01b0316815260200182600101548152602001600d60008d815260200190815260200160002060030154815260200185815250600d60008c815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600201556080820151816003015560a08201518160040155905050600e6000886001600160a01b03166001600160a01b031681526020019081526020016000206000866001600160a01b03166001600160a01b031681526020019081526020016000208a90806001815401808255809150506001900390600052602060002001600090919091909150556001600960008c815260200190815260200160002060006101000a81548160ff02191690831515021790555073de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c6001600160a01b03166342842e0e88308d6040518463ffffffff1660e01b815260040161258e93929190613c28565b600060405180830381600087803b1580156125a857600080fd5b505af11580156125bc573d6000803e3d6000fd5b505050506005810154610100900460ff16156125dc576125dc858b613280565b4381600201819055507f55e1b84deec6eefe49c2c96afe1d5b43ca37768907f7388696c6009e7bbe3b54858b600d60008e8152602001908152602001600020600401548460030154856001015486600401546001546040516126449796959493929190613d86565b60405180910390a1505050600096875250506009602052505060409092205460ff1692915050565b60025481565b600054630100000090046001600160a01b031633146126a35760405162461bcd60e51b8152600401610a2b906140a0565b7fd92c3464a10ecea59217f3d2d1a916160b75f798612beba0674f7d15572d1fdd600254826002819055604051610a939291906141dd565b6000818152600d6020526040902060018101546001600160a01b031633146127155760405162461bcd60e51b8152600401610a2b90613ee8565b805461010090046001600160a01b03166000908152600b60209081526040808320600c9092529091206004830154600383015461275191612821565b60038301556001830154604051632142170760e11b815273de5bf92e3372aa59c73ca7dfc6cec599e1b2b08c916342842e0e916127a09130916001600160a01b03909116908990600401613c28565b600060405180830381600087803b1580156127ba57600080fd5b505af11580156127ce573d6000803e3d6000fd5b505050508160030154600014156108b3574380835560028084018290556000600180860182905584018390556003840192909255820181905583546108d09061010090046001600160a01b031686612883565b600082821115612878576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b508082035b92915050565b336000908152600e602090815260408083206001600160a01b03861684528252808320805482518185028101850190935280835284938301828280156128e857602002820191906000526020600020905b8154815260200190600101908083116128d4575b5050505050905060005b8151811161294b57336000908152600e602090815260408083206001600160a01b0389168452909152902080548290811061292957fe5b90600052602060002001548414156129435780925061294b565b6001016128f2565b505092915050565b6001600160a01b038083166000908152600e602090815260408083209385168352929052205483106129975760405162461bcd60e51b8152600401610a2b90614032565b6001600160a01b038281166000908152600e60209081526040808320938516835292905290812080546129cb906001612821565b815481106129d557fe5b60009182526020808320909101546001600160a01b038087168452600e835260408085209187168552925291208054919250829186908110612a1357fe5b60009182526020808320909101929092556001600160a01b038086168252600e835260408083209186168352925220805480612a4b57fe5b6001900381819060005260206000200160009055905550505050565b6000828152600d602052604081205461010090046001600160a01b0316612a8c6135f5565b6000846001811115612a9a57fe5b1415612aea5750604080516060810182526001600160a01b0383166000818152600b6020818152858320600181015486526002810154828701529390925290526004015491810191909152612b48565b6001846001811115612af857fe5b1415612b485750604080516060810182526001600160a01b0383166000818152600c6020908152848220600281015485526003015481850152918152600b90915282902060040154918101919091525b6002548160200151108015612b5e575060025443115b15612b9657612b8f82612b80836020015160025461282190919063ffffffff16565b60015460408501518551611dd5565b925061294b565b6002548160200151118015612bad57506000600254115b15612bbb578051925061294b565b6000612bd482602001514361282190919063ffffffff16565b9050612bed838260015485604001518660000151611dd5565b9695505050505050565b600082612c065750600061287d565b82820282848281612c1357fe5b0414612c505760405162461bcd60e51b81526004018080602001828103825260218152602001806142bb6021913960400191505060405180910390fd5b9392505050565b6000808211612cad576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612cb657fe5b049392505050565b600082820183811015612c50576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526116be908490613328565b6000838152600d60209081526040808320546001600160a01b0361010090910481168452600c90925291829020805492516370a0823160e01b81529092849216906370a0823190612ded903090600401613c14565b60206040518083038186803b158015612e0557600080fd5b505afa158015612e19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3d9190613bfc565b1015612e5b5760405162461bcd60e51b8152600401610a2b90613f8d565b43600380830191909155600282018490556000858152600d60205260409020908101849055600101548154612e9d916001600160a01b03918216911684612d18565b50505050565b6001600160a01b0381166000908152600b6020526040902060038101541561102d576000612ef483612ee284600201544361282190919063ffffffff16565b60015485600401548660010154611dd5565b6001830155504360028201555050565b6001600160a01b0381166000908152600c60209081526040808320600b909252909120600301541561102d576000612f7683612f4d84600301544361282190919063ffffffff16565b6001546001600160a01b0387166000908152600b60205260409020600401546002870154611dd5565b6002830155504360038201555050565b6001600a6000846001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506008829080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055506040518060e001604052804381526020016000815260200143815260200160008152602001828152602001600115158152602001600b6000856001600160a01b03166001600160a01b0316815260200190815260200160002060050160019054906101000a900460ff161515815250600b6000846001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff0219169083151502179055509050507f0314a127947f2a3f74d5ee6c05752242c48803b68534b577cfd35c81d06fccfb82600154600b6000866001600160a01b03166001600160a01b0316815260200190815260200160002060040154600b6000876001600160a01b03166001600160a01b0316815260200190815260200160002060020154600a6000886001600160a01b03166001600160a01b0316815260200190815260200160002060009054906101000a900460ff16604051611dc9959493929190613d56565b600080806000198587098686029250828110908390030390508061320757600084116131fc57600080fd5b508290049050612c50565b80841161321357600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6001600160a01b0382166000908152600c6020526040902060018101546003820154146133045760006132c082600301544361282190919063ffffffff16565b90506132fd8482600154600b6000896001600160a01b03166001600160a01b03168152602001908152602001600020600401548660020154611dd5565b6002830155505b436003808301919091556002909101546000928352600d6020526040909220015550565b600061337d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133d99092919063ffffffff16565b8051909150156116be5780806020019051602081101561339c57600080fd5b50516116be5760405162461bcd60e51b815260040180806020018281038252602a8152602001806142dc602a913960400191505060405180910390fd5b60606133e884846000856133f0565b949350505050565b6060824710156134315760405162461bcd60e51b81526004018080602001828103825260268152602001806142956026913960400191505060405180910390fd5b61343a8561354b565b61348b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106134c95780518252601f1990920191602091820191016134aa565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461352b576040519150601f19603f3d011682016040523d82523d6000602084013e613530565b606091505b5091509150613540828286613551565b979650505050505050565b3b151590565b60608315613560575081612c50565b8251156135705782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156135ba5781810151838201526020016135a2565b50505050905090810190601f1680156135e75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60405180606001604052806000815260200160008152602001600081525090565b80516118378161427c565b600082601f830112613631578081fd5b813560206136466136418361425e565b61423a565b8281528181019085830183850287018401881015613662578586fd5b855b858110156136895781356136778161427c565b84529284019290840190600101613664565b5090979650505050505050565b8051801515811461183757600080fd5b8051600281900b811461183757600080fd5b80516fffffffffffffffffffffffffffffffff8116811461183757600080fd5b805160ff8116811461183757600080fd5b6000602082840312156136fa578081fd5b8135612c508161427c565b600060208284031215613716578081fd5b8151612c508161427c565b60008060408385031215613733578081fd5b823561373e8161427c565b9150602083013561374e8161427c565b809150509250929050565b60008060006060848603121561376d578081fd5b83356137788161427c565b925060208401356137888161427c565b929592945050506040919091013590565b600080600080608085870312156137ae578182fd5b84356137b98161427c565b93506020858101356137ca8161427c565b935060408601359250606086013567ffffffffffffffff808211156137ed578384fd5b818801915088601f830112613800578384fd5b81358181111561380c57fe5b61381e601f8201601f1916850161423a565b91508082528984828501011115613833578485fd5b8084840185840137810190920192909252939692955090935050565b60008060408385031215613861578182fd5b823561386c8161427c565b946020939093013593505050565b600080600080600060a08688031215613891578283fd5b853561389c8161427c565b97602087013597506040870135966060810135965060800135945092505050565b6000602082840312156138ce578081fd5b813567ffffffffffffffff8111156138e4578182fd5b6133e884828501613621565b60008060408385031215613902578182fd5b823567ffffffffffffffff80821115613919578384fd5b61392586838701613621565b935060209150818501358181111561393b578384fd5b85019050601f8101861361394d578283fd5b803561395b6136418261425e565b81815283810190838501858402850186018a1015613977578687fd5b8694505b8385101561399957803583526001949094019391850191850161397b565b5080955050505050509250929050565b60006102408083850312156139bc578182fd5b6139c58161423a565b90506139d0836136a6565b81526139de602084016136a6565b60208201526139ef604084016136b8565b6040820152613a00606084016136a6565b6060820152613a11608084016136a6565b6080820152613a2260a084016136b8565b60a082015260c0838101519082015260e08084015190820152610100808401519082015261012080840151908201526101408084015190820152610160613a6a818501613696565b90820152610180613a7c848201613616565b908201526101a0613a8e848201613616565b908201526101c083810151908201526101e0613aab8185016136d8565b90820152610200613abd848201613696565b90820152610220613acf848201613696565b908201529392505050565b600060e08284031215613aeb578081fd5b60405160e0810181811067ffffffffffffffff82111715613b0857fe5b80604052508251815260208301516020820152604083015160408201526060830151606082015260808301516080820152613b4560a08401613696565b60a0820152613b5660c08401613696565b60c08201529392505050565b600060e08284031215613b73578081fd5b60405160e0810181811067ffffffffffffffff82111715613b9057fe5b60405282518152613ba360208401613616565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600060208284031215613bf5578081fd5b5035919050565b600060208284031215613c0d578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b0393909316835290151560208301521515604082015260600190565b6001600160a01b039390931683529015156020830152604082015260600190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039390931683526020830191909152604082015260600190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6001600160a01b039590951685526020850193909352604084019190915260608301521515608082015260a00190565b6001600160a01b03979097168752602087019590955260408601939093526060850191909152608084015260a083015260c082015260e00190565b901515815260200190565b95151586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b91151582521515602082015260400190565b921515835290151560208301526001600160a01b0316604082015260600190565b92151583529015156020830152604082015260600190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b60208082526002908201527f4e4f000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f434e450000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f4e4f4f0000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f544e450000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f524e410000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4946000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4e53000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f504e570000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f494f420000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f4c4e530000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4e41000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f4c41000000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526003908201527f464e410000000000000000000000000000000000000000000000000000000000604082015260600190565b60208082526002908201527f494c000000000000000000000000000000000000000000000000000000000000604082015260600190565b90815260200190565b60006040820184835260206040818501528185518084526060860191508287019350845b81811015613689578451835293830193918301916001016141a9565b92835290151560208301521515604082015260600190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b9687526020870195909552604086019390935260608501919091526080840152151560a0830152151560c082015260e00190565b60405181810167ffffffffffffffff8111828210171561425657fe5b604052919050565b600067ffffffffffffffff82111561427257fe5b5060209081020190565b6001600160a01b038116811461429157600080fd5b5056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a164736f6c6343000706000a

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

000000000000000000000000a7979d0592ecfc59b082552828ff36209ec94b11000000000000000000000000c36d07ecd1c562ce09dcb63b4d51ce2d5baf45630000000000000000000000006e665791f0219a10a4d52ac0915931cf045220b80000000000000000000000008fddc464ee63575463afd214586344a09b309102

-----Decoded View---------------
Arg [0] : _ulm (address): 0xA7979d0592ecfC59b082552828FF36209ec94B11
Arg [1] : _governance (address): 0xc36d07Ecd1C562CE09dCb63B4D51ce2D5baF4563
Arg [2] : _deprecated (address[2]): 0x6E665791f0219a10A4D52AC0915931Cf045220B8,0x8fdDc464ee63575463AFd214586344a09b309102

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000a7979d0592ecfc59b082552828ff36209ec94b11
Arg [1] : 000000000000000000000000c36d07ecd1c562ce09dcb63b4d51ce2d5baf4563
Arg [2] : 0000000000000000000000006e665791f0219a10a4d52ac0915931cf045220b8
Arg [3] : 0000000000000000000000008fddc464ee63575463afd214586344a09b309102


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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.