ETH Price: $2,489.97 (-1.99%)

Contract

0x9f58193b717449d00c7dcaf5d9F6f5AF48a09894
 

Multichain Info

Transaction Hash
Method
Block
From
To
Emergence Withdr...188624112023-12-25 11:19:59304 days ago1703503199IN
0x9f58193b...F48a09894
0 ETH0.0018054216.40628481
Modify End Block154511882022-09-01 6:00:50785 days ago1662012050IN
0x9f58193b...F48a09894
0 ETH0.0005335711.2061679
Modify End Block150676712022-07-03 5:29:49845 days ago1656826189IN
0x9f58193b...F48a09894
0 ETH0.0005249611.02543951
Modify End Block148719272022-05-30 9:58:13878 days ago1653904693IN
0x9f58193b...F48a09894
0 ETH0.001526923.59945071
Deposit146645672022-04-27 5:11:24912 days ago1651036284IN
0x9f58193b...F48a09894
0 ETH0.0091424226.97056414
Deposit146612792022-04-26 16:48:37912 days ago1650991717IN
0x9f58193b...F48a09894
0 ETH0.0145238339.42645529
0x60806040146595582022-04-26 10:11:47912 days ago1650967907IN
 Create: MiningFixRangeBoostV2
0 ETH0.0884370225

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MiningFixRangeBoostV2

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : MiningFixRangeBoostV2.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;

// Uncomment if needed.
// import "hardhat/console.sol";

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

import "../multicall.sol";
import "../libraries/Math.sol";
import "../libraries/UniswapCallingParams.sol";

import "../base/MiningBase.sol";


/// @title Uniswap V3 Liquidity Mining Main Contract
contract MiningFixRangeBoostV2 is MiningBase, IERC721Receiver {
    using Math for int24;
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.UintSet;

    /// @dev Contract of the uniV3 Nonfungible Position Manager.
    address uniV3NFTManager;

    /// @dev The reward range of this mining contract.
    int24 rewardUpperTick;
    int24 rewardLowerTick;

    /// @dev Record the status for a certain token for the last touched time.
    struct TokenStatus {
        uint256 vLiquidity;
        uint256 validVLiquidity;
        uint256 nIZI;
        uint256 lastTouchBlock;
        uint256 lastTokensOwed0;
        uint256 lastTokensOwed1;
        uint256[] lastTouchAccRewardPerShare;
    }

    mapping(uint256 => TokenStatus) public tokenStatus;

    // override for mining base
    function getBaseTokenStatus(uint256 tokenId) internal override view returns(BaseTokenStatus memory t) {
        TokenStatus memory ts = tokenStatus[tokenId];
        t = BaseTokenStatus({
            vLiquidity: ts.vLiquidity,
            validVLiquidity: ts.validVLiquidity,
            nIZI: ts.nIZI,
            lastTouchAccRewardPerShare: ts.lastTouchAccRewardPerShare
        });
    }
    struct PoolParams {
        address uniV3NFTManager;
        address token0;
        address token1;
        uint24 fee;
    }

    receive() external payable {}

    constructor(
        PoolParams memory poolParams,
        RewardInfo[] memory _rewardInfos,
        address iziTokenAddr,
        int24 _rewardUpperTick,
        int24 _rewardLowerTick,
        uint256 _startBlock,
        uint256 _endBlock,
        uint24 _feeChargePercent,
        address _chargeReceiver
    ) MiningBase(_feeChargePercent, poolParams.uniV3NFTManager, poolParams.token0, poolParams.token1, poolParams.fee, _chargeReceiver) {
        uniV3NFTManager = poolParams.uniV3NFTManager;

        require(_rewardLowerTick < _rewardUpperTick, "L<U");
        require(poolParams.token0 < poolParams.token1, "TOKEN0 < TOKEN1 NOT MATCH");

        rewardInfosLen = _rewardInfos.length;
        require(rewardInfosLen > 0, "NO REWARD");
        require(rewardInfosLen < 3, "AT MOST 2 REWARDS");

        for (uint256 i = 0; i < rewardInfosLen; i++) {
            rewardInfos[i] = _rewardInfos[i];
            rewardInfos[i].accRewardPerShare = 0;
        }

        // iziTokenAddr == 0 means not boost
        iziToken = IERC20(iziTokenAddr);

        rewardUpperTick = _rewardUpperTick;
        rewardLowerTick = _rewardLowerTick;

        startBlock = _startBlock;
        endBlock = _endBlock;

        lastTouchBlock = startBlock;

        totalVLiquidity = 0;
        totalNIZI = 0;

    }

    /// @notice Used for ERC721 safeTransferFrom
    function onERC721Received(address, address, uint256, bytes memory) 
        public 
        virtual 
        override 
        returns (bytes4) 
    {
        return this.onERC721Received.selector;
    }

    /// @notice Get the overall info for the mining contract.
    function getMiningContractInfo()
        external
        view
        returns (
            address token0_,
            address token1_,
            uint24 fee_,
            RewardInfo[] memory rewardInfos_,
            address iziTokenAddr_,
            int24 rewardUpperTick_,
            int24 rewardLowerTick_,
            uint256 lastTouchBlock_,
            uint256 totalVLiquidity_,
            uint256 startBlock_,
            uint256 endBlock_
        )
    {
        rewardInfos_ = new RewardInfo[](rewardInfosLen);
        for (uint256 i = 0; i < rewardInfosLen; i++) {
            rewardInfos_[i] = rewardInfos[i];
        }
        return (
            rewardPool.token0,
            rewardPool.token1,
            rewardPool.fee,
            rewardInfos_,
            address(iziToken),
            rewardUpperTick,
            rewardLowerTick,
            lastTouchBlock,
            totalVLiquidity,
            startBlock,
            endBlock
        );
    }

    /// @notice Compute the virtual liquidity from a position's parameters.
    /// @param tickLower The lower tick of a position.
    /// @param tickUpper The upper tick of a position.
    /// @param liquidity The liquidity of a a position.
    /// @dev vLiquidity = liquidity * validRange^2 / 1e6, where the validRange is the tick amount of the
    /// intersection between the position and the reward range.
    /// We divided it by 1e6 to keep vLiquidity smaller than Q128 in most cases. This is safe since liqudity is usually a large number.
    function _getVLiquidityForNFT(
        int24 tickLower,
        int24 tickUpper,
        uint128 liquidity
    ) internal view returns (uint256 vLiquidity) {
        // liquidity is roughly equals to sqrt(amountX*amountY)
        require(liquidity >= 1e6, "LIQUIDITY TOO SMALL");
        uint256 validRange = uint24(
            Math.max(
                Math.min(rewardUpperTick, tickUpper) - Math.max(rewardLowerTick, tickLower),
                0
            )
        );
        vLiquidity = (validRange * validRange * uint256(liquidity)) / 1e6;
        return vLiquidity;
    }

    /// @notice new a token status when touched.
    function _newTokenStatus(
        uint256 tokenId,
        uint256 vLiquidity,
        uint256 validVLiquidity,
        uint256 nIZI,
        uint256 lastTokensOwed0,
        uint256 lastTokensOwed1
    ) internal {
        TokenStatus storage t = tokenStatus[tokenId];

        t.vLiquidity = vLiquidity;
        t.validVLiquidity = validVLiquidity;
        t.nIZI = nIZI;

        t.lastTouchBlock = lastTouchBlock;
        t.lastTouchAccRewardPerShare = new uint256[](rewardInfosLen);
        t.lastTokensOwed0 = lastTokensOwed0;
        t.lastTokensOwed1 = lastTokensOwed1;
        for (uint256 i = 0; i < rewardInfosLen; i++) {
            t.lastTouchAccRewardPerShare[i] = rewardInfos[i].accRewardPerShare;
        }
    }

    /// @notice update a token status when touched
    function _updateTokenStatus(
        uint256 tokenId,
        uint256 validVLiquidity,
        uint256 nIZI
    ) internal override {
        TokenStatus storage t = tokenStatus[tokenId];

        // when not boost, validVL == vL
        t.validVLiquidity = validVLiquidity;
        t.nIZI = nIZI;

        t.lastTouchBlock = lastTouchBlock;
        for (uint256 i = 0; i < rewardInfosLen; i++) {
            t.lastTouchAccRewardPerShare[i] = rewardInfos[i].accRewardPerShare;
        }
    }

    function _computeValidVLiquidity(uint256 vLiquidity, uint256 nIZI)
        internal override
        view
        returns (uint256)
    {
        if (totalNIZI == 0) {
            return vLiquidity;
        }
        uint256 iziVLiquidity = (vLiquidity * 4 + (totalVLiquidity * nIZI * 6) / totalNIZI) / 10;
        return Math.min(iziVLiquidity, vLiquidity);
    }

    /// @notice Deposit a single position.
    /// @param tokenId The related position id.
    /// @param nIZI the amount of izi to lock
    function deposit(uint256 tokenId, uint256 nIZI)
        external
        returns (uint256 vLiquidity)
    {
        address owner = INonfungiblePositionManager(uniV3NFTManager).ownerOf(tokenId);
        require(owner == msg.sender, "NOT OWNER");
        INonfungiblePositionManager.Position memory position;

        (
            ,
            ,
            position.token0,
            position.token1,
            position.fee,
            position.tickLower,
            position.tickUpper,
            position.liquidity,
            ,
            ,
            position.tokensOwed0,
            position.tokensOwed1
        ) = INonfungiblePositionManager(uniV3NFTManager).positions(tokenId);

        // alternatively we can compute the pool address with tokens and fee and compare the address directly
        require(position.token0 == rewardPool.token0, "TOEKN0 NOT MATCH");
        require(position.token1 == rewardPool.token1, "TOKEN1 NOT MATCH");
        require(position.fee == rewardPool.fee, "FEE NOT MATCH");

        // require the NFT token has interaction with [rewardLowerTick, rewardUpperTick]
        vLiquidity = _getVLiquidityForNFT(position.tickLower, position.tickUpper, position.liquidity);
        require(vLiquidity > 0, "INVALID TOKEN");

        INonfungiblePositionManager(uniV3NFTManager).safeTransferFrom(msg.sender, address(this), tokenId);
        owners[tokenId] = msg.sender;
        bool res = tokenIds[msg.sender].add(tokenId);
        require(res);

        // the execution order for the next three lines is crutial
        _updateGlobalStatus();
        _updateVLiquidity(vLiquidity, true);
        if (address(iziToken) == address(0)) {
            // boost is not enabled
            nIZI = 0;
        }
        _updateNIZI(nIZI, true);
        uint256 validVLiquidity = _computeValidVLiquidity(vLiquidity, nIZI);
        require(nIZI < FixedPoints.Q128 / 6, "NIZI O");
        _newTokenStatus(tokenId, vLiquidity, validVLiquidity, nIZI, uint256(position.tokensOwed0), uint256(position.tokensOwed1));
        if (nIZI > 0) {
            // lock izi in this contract
            iziToken.safeTransferFrom(msg.sender, address(this), nIZI);
        }

        emit Deposit(msg.sender, tokenId, nIZI);
        return vLiquidity;
    }

    /// @notice withdraw a single position.
    /// @param tokenId The related position id.
    /// @param noReward true if donot collect reward
    function withdraw(uint256 tokenId, bool noReward) external nonReentrant {
        require(owners[tokenId] == msg.sender, "NOT OWNER OR NOT EXIST");

        if (noReward) {
            _updateGlobalStatus();
        } else {
            _collectReward(tokenId);
        }
        uint256 vLiquidity = tokenStatus[tokenId].vLiquidity;
        _updateVLiquidity(vLiquidity, false);
        uint256 nIZI = tokenStatus[tokenId].nIZI;
        if (nIZI > 0) {
            _updateNIZI(nIZI, false);
            // refund iZi to user
            iziToken.safeTransfer(msg.sender, nIZI);
        }

        // charge and refund remain fee to user

        (uint256 amount0, uint256 amount1) = INonfungiblePositionManager(
            uniV3NFTManager
        ).collect(
            UniswapCallingParams.collectParams(tokenId, address(this))
        );

        uint256 lastTokensOwed0 = tokenStatus[tokenId].lastTokensOwed0;
        uint256 lastTokensOwed1 = tokenStatus[tokenId].lastTokensOwed1;

        uint256 refundAmount0 = lastTokensOwed0 + (amount0 - lastTokensOwed0) * feeRemainPercent / 100;
        uint256 refundAmount1 = lastTokensOwed1 + (amount1 - lastTokensOwed1) * feeRemainPercent / 100;
        _safeTransferToken(rewardPool.token0, msg.sender, refundAmount0);
        _safeTransferToken(rewardPool.token1, msg.sender, refundAmount1);
        totalFeeCharged0 += amount0 - refundAmount0;
        totalFeeCharged1 += amount1 - refundAmount1;

        INonfungiblePositionManager(uniV3NFTManager).safeTransferFrom(address(this), msg.sender, tokenId);
        owners[tokenId] = address(0);
        bool res = tokenIds[msg.sender].remove(tokenId);
        require(res);

        emit Withdraw(msg.sender, tokenId);
    }

    /// @notice Collect pending reward for a single position.
    /// @param tokenId The related position id.
    function collectReward(uint256 tokenId) external nonReentrant {
        require(owners[tokenId] == msg.sender, "NOT OWNER OR NOT EXIST");
        _collectReward(tokenId);
    }

    /// @notice Collect all pending rewards.
    function collectRewards() external nonReentrant {
        EnumerableSet.UintSet storage ids = tokenIds[msg.sender];
        for (uint256 i = 0; i < ids.length(); i++) {
            require(owners[ids.at(i)] == msg.sender, "NOT OWNER");
            _collectReward(ids.at(i));
        }
    }

    // Control fuctions for the contract owner and operators.

    /// @notice If something goes wrong, we can send back user's nft and locked iZi
    /// @param tokenId The related position id.
    function emergenceWithdraw(uint256 tokenId) external override onlyOwner {
        address owner = owners[tokenId];
        require(owner != address(0));
        INonfungiblePositionManager(uniV3NFTManager).safeTransferFrom(
            address(this),
            owners[tokenId],
            tokenId
        );
        uint256 nIZI = tokenStatus[tokenId].nIZI;
        if (nIZI > 0) {
            // we should ensure nft refund to user
            // omit the case when transfer() returns false unexpectedly
            iziToken.transfer(owner, nIZI);
        }
        // make sure user cannot withdraw/depositIZI or collect reward on this nft
        owners[tokenId] = address(0);
    }

}

File 2 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 4 of 17 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

File 6 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 7 of 17 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 8 of 17 : multicall.sol
//  SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

/// @title Multicall
/// @notice Enables calling multiple methods in a single call to the contract
abstract contract Multicall {
    function multicall(bytes[] calldata data) external payable returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(data[i]);

            if (!success) {
                // Next 5 lines from https://ethereum.stackexchange.com/a/83577
                if (result.length < 68) revert();
                assembly {
                    result := add(result, 0x04)
                }
                revert(abi.decode(result, (string)));
            }

            results[i] = result;
        }
    }
}

File 9 of 17 : Math.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @title Simple math library for Max and Min.
library Math {
    function max(int24 a, int24 b) internal pure returns (int24) {
        return a >= b ? a : b;
    }

    function min(int24 a, int24 b) internal pure returns (int24) {
        return a < b ? a : b;
    }

    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    function tickFloor(int24 tick, int24 tickSpacing)
        internal
        pure
        returns (int24)
    {
        int24 c = tick / tickSpacing;
        if (tick < 0 && tick % tickSpacing != 0) {
            c = c - 1;
        }
        c = c * tickSpacing;
        return c;
    }

    function tickUpper(int24 tick, int24 tickSpacing)
        internal
        pure
        returns (int24)
    {
        int24 c = tick / tickSpacing;
        if (tick > 0 && tick % tickSpacing != 0) {
            c = c + 1;
        }
        c = c * tickSpacing;
        return c;
    }
}

File 10 of 17 : UniswapCallingParams.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "../uniswap/interfaces.sol";
import "./Math.sol";

library UniswapCallingParams {
    // fill INonfungiblePositionManager.CollectParams struct to call INonfungiblePositionManager.collect(...)
    function collectParams(uint256 uniPositionID, address recipient)
        internal
        pure
        returns (INonfungiblePositionManager.CollectParams memory params)
    {
        params.tokenId = uniPositionID;
        params.recipient = recipient;
        params.amount0Max = 0xffffffffffffffffffffffffffffffff;
        params.amount1Max = 0xffffffffffffffffffffffffffffffff;
    }

    function decreaseLiquidityParams(
        uint256 uniPositionID,
        uint128 liquidity,
        uint256 deadline
    )
        internal
        pure
        returns (
            INonfungiblePositionManager.DecreaseLiquidityParams memory params
        )
    {
        params.tokenId = uniPositionID;
        params.liquidity = liquidity;
        params.amount0Min = 0;
        params.amount1Min = 0;
        params.deadline = deadline;
    }

    /// @dev fill INonfungiblePositionManager.MintParams struct to call INonfungiblePositionManager.mint(...)
    /// @param token0 one of token pair in uniswap pool, note here not necessary to ensure that token0 < token1
    /// @param token1 another token
    /// @param fee fee
    /// @param amount0 amount of token0
    /// @param amount1 amount of token1
    /// @param tickLeft tickLower
    /// @param tickRight tickUpper
    /// @param deadline deadline of mint calling
    /// @return params MintParams
    function mintParams(
        address token0,
        address token1,
        uint24 fee,
        uint256 amount0,
        uint256 amount1,
        int24 tickLeft,
        int24 tickRight,
        uint256 deadline
    )
        internal
        view
        returns (INonfungiblePositionManager.MintParams memory params)
    {
        params.fee = fee;
        params.tickLower = tickLeft;
        params.tickUpper = tickRight;
        params.deadline = deadline;
        params.recipient = address(this);
        params.amount0Min = 0;
        params.amount1Min = 0;
        if (token0 < token1) {
            params.token0 = token0;
            params.token1 = token1;
            params.amount0Desired = amount0;
            params.amount1Desired = amount1;
        } else {
            params.token0 = token1;
            params.token1 = token0;
            params.amount0Desired = amount1;
            params.amount1Desired = amount0;
        }
    }
}

File 11 of 17 : MiningBase.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.4;

// Uncomment if needed.
// import "hardhat/console.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

import "../libraries/FixedPoints.sol";
import "../libraries/Math.sol";
import "../uniswap/interfaces.sol";
import "../multicall.sol";

/// @title Interface for WETH9
interface IWETH9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

abstract contract MiningBase is Ownable, Multicall, ReentrancyGuard {

    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.UintSet;

    /// @dev Last block number that the accRewardRerShare is touched.
    uint256 public lastTouchBlock;

    /// @dev The block number when NFT mining rewards starts/ends.
    uint256 public startBlock;
    uint256 public endBlock;
    struct RewardInfo {
        /// @dev Contract of the reward erc20 token.
        address rewardToken;
        /// @dev who provides reward
        address provider;
        /// @dev Accumulated Reward Tokens per share, times Q128.
        uint256 accRewardPerShare;
        /// @dev Reward amount for each block.
        uint256 rewardPerBlock;
    }

    mapping(uint256 => RewardInfo) public rewardInfos;
    uint256 public rewardInfosLen;

    /// @dev Store the owner of the NFT token
    mapping(uint256 => address) public owners;
    /// @dev The inverse mapping of owners.
    mapping(address => EnumerableSet.UintSet) internal tokenIds;

    /// @dev token to lock, 0 for not boost
    IERC20 public iziToken;
    /// @dev current total nIZI.
    uint256 public totalNIZI;

    /// @notice Current total virtual liquidity.
    uint256 public totalVLiquidity;

    /// @notice (1 - feeRemainPercent/100) is charging rate of uniswap fee
    uint24 public feeRemainPercent;

    uint256 public totalFeeCharged0;
    uint256 public totalFeeCharged1;


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

    PoolInfo public rewardPool;

    address public weth;

    address public chargeReceiver;

    /// @notice emit if user successfully deposit
    /// @param user user
    /// @param tokenId id of mining (same as uniswap nft token id)
    /// @param nIZI amount of boosted iZi
    event Deposit(address indexed user, uint256 tokenId, uint256 nIZI);
    /// @notice emit if user successfully withdraw
    /// @param user user
    /// @param tokenId id of mining (same as uniswap nft token id)
    event Withdraw(address indexed user, uint256 tokenId);
    /// @notice emit if user successfully collect reward
    /// @param user user
    /// @param tokenId id of mining (same as uniswap nft token id)
    /// @param token address of reward erc-20 token
    /// @param amount amount of erc-20 token user received 
    event CollectReward(address indexed user, uint256 tokenId, address token, uint256 amount);
    /// @notice emit if contract owner successfully calls modifyEndBlock(...)
    /// @param endBlock endBlock 
    event ModifyEndBlock(uint256 endBlock);
    /// @notice emit if contract owner successfully calls modifyRewardPerBlock(...)
    /// @param rewardToken address of reward erc20-token
    /// @param rewardPerBlock new reward per block of 'rewardToken'
    event ModifyRewardPerBlock(address indexed rewardToken, uint256 rewardPerBlock);
    /// @notice emit if contract owner successfully calls modifyProvider(...)
    /// @param rewardToken address of reward erc20-token
    /// @param provider New provider
    event ModifyProvider(address indexed rewardToken, address provider);

    function _setRewardPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) internal {
        (rewardPool.token0, rewardPool.token1) = (tokenA < tokenB)? (tokenA, tokenB) : (tokenB, tokenA);
        rewardPool.fee = fee;
        totalFeeCharged0 = 0;
        totalFeeCharged1 = 0;
    }

    constructor(
        uint24 _feeChargePercent, address _uniV3NFTManager, address tokenA, address tokenB, uint24 fee, address _chargeReceiver
    ) {
        require(_feeChargePercent <= 100, "charge percent <= 100");
        feeRemainPercent = 100 - _feeChargePercent;
        // mark weth erc token
        weth = INonfungiblePositionManager(_uniV3NFTManager).WETH9();
        // receiver to receive charged uniswap fee
        chargeReceiver = _chargeReceiver;
        _setRewardPool(tokenA, tokenB, fee);
    }

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

    function _safeTransferToken(address token, address to, uint256 value) internal {
        if (value > 0) {
            if (token == address(weth)) {
                IWETH9(token).withdraw(value);
                _safeTransferETH(to, value);
            } else {
                IERC20(token).safeTransfer(to, value);
            }
        }
    }

    /// @notice Update reward variables to be up-to-date.
    /// @param vLiquidity vLiquidity to add or minus
    /// @param isAdd add or minus
    function _updateVLiquidity(uint256 vLiquidity, bool isAdd) internal {
        if (isAdd) {
            totalVLiquidity = totalVLiquidity + vLiquidity;
        } else {
            totalVLiquidity = totalVLiquidity - vLiquidity;
        }

        // max lockBoostMultiplier is 3
        require(totalVLiquidity <= FixedPoints.Q128 * 3, "TOO MUCH LIQUIDITY STAKED");
    }

    /// @notice Update reward variables to be up-to-date.
    /// @param nIZI amount of boosted iZi to add or minus
    /// @param isAdd add or minus
    function _updateNIZI(uint256 nIZI, bool isAdd) internal {
        if (isAdd) {
            totalNIZI = totalNIZI + nIZI;
        } else {
            totalNIZI = totalNIZI - nIZI;
        }
    }

    /// @notice Update the global status.
    function _updateGlobalStatus() internal {
        if (block.number <= lastTouchBlock) {
            return;
        }
        if (lastTouchBlock >= endBlock) {
            return;
        }
        uint256 currBlockNumber = Math.min(block.number, endBlock);
        if (totalVLiquidity == 0) {
            lastTouchBlock = currBlockNumber;
            return;
        }

        for (uint256 i = 0; i < rewardInfosLen; i++) {
            // tokenReward < 2^25 * 2^64 * 2^10, 15 years, 1000 r/block
            uint256 tokenReward = (currBlockNumber - lastTouchBlock) * rewardInfos[i].rewardPerBlock;
            // tokenReward * Q128 < 2^(25 + 64 + 10 + 128)
            rewardInfos[i].accRewardPerShare = rewardInfos[i].accRewardPerShare + ((tokenReward * FixedPoints.Q128) / totalVLiquidity);
        }
        lastTouchBlock = currBlockNumber;
    }

    /// @notice compute validVLiquidity
    /// @param vLiquidity origin vLiquidity
    /// @param nIZI amount of boosted iZi
    function _computeValidVLiquidity(uint256 vLiquidity, uint256 nIZI)
        internal virtual
        view
        returns (uint256);

    /// @notice update a token status when touched
    /// @param tokenId id of TokenStatus obj in sub-contracts (same with uniswap nft id)
    /// @param validVLiquidity validVLiquidity, can be acquired by _computeValidVLiquidity(...)
    /// @param nIZI latest amount of iZi boost
    function _updateTokenStatus(
        uint256 tokenId,
        uint256 validVLiquidity,
        uint256 nIZI
    ) internal virtual;


    struct BaseTokenStatus {
        uint256 vLiquidity;
        uint256 validVLiquidity;
        uint256 nIZI;
        uint256[] lastTouchAccRewardPerShare;
    }

    /// @notice get base infomation from token status in sub-contracts
    /// @param tokenId id of TokenStatus obj in sub-contracts
    /// @return t contains base infomation (uint256 vLiquidity, uint256 validVLiquidity, uint256 nIZI, uint256[] lastTouchAccRewardPerShare)
    function getBaseTokenStatus(uint256 tokenId) internal virtual view returns(BaseTokenStatus memory t);

    /// @notice deposit iZi to an nft token
    /// @param tokenId nft already deposited
    /// @param deltaNIZI amount of izi to deposit
    function depositIZI(uint256 tokenId, uint256 deltaNIZI)
        external
        nonReentrant
    {
        require(owners[tokenId] == msg.sender, "NOT OWNER or NOT EXIST");
        require(address(iziToken) != address(0), "NOT BOOST");
        require(deltaNIZI > 0, "DEPOSIT IZI MUST BE POSITIVE");
        _collectReward(tokenId);
        BaseTokenStatus memory t = getBaseTokenStatus(tokenId);
        _updateNIZI(deltaNIZI, true);
        uint256 nIZI = t.nIZI + deltaNIZI;
        // update validVLiquidity
        uint256 validVLiquidity = _computeValidVLiquidity(t.vLiquidity, nIZI);
        _updateTokenStatus(tokenId, validVLiquidity, nIZI);

        // transfer iZi from user
        iziToken.safeTransferFrom(msg.sender, address(this), deltaNIZI);
    }

    /// @notice Collect pending reward for a single position. can be called by sub-contracts
    /// @param tokenId The related position id.
    function _collectReward(uint256 tokenId) internal {
        BaseTokenStatus memory t = getBaseTokenStatus(tokenId);

        _updateGlobalStatus();
        for (uint256 i = 0; i < rewardInfosLen; i++) {
            // multiplied by Q128 before
            uint256 _reward = (t.validVLiquidity * (rewardInfos[i].accRewardPerShare - t.lastTouchAccRewardPerShare[i])) / FixedPoints.Q128;
            if (_reward > 0) {
                IERC20(rewardInfos[i].rewardToken).safeTransferFrom(
                    rewardInfos[i].provider,
                    msg.sender,
                    _reward
                );
            }
            emit CollectReward(
                msg.sender,
                tokenId,
                rewardInfos[i].rewardToken,
                _reward
            );
        }

        // update validVLiquidity
        uint256 validVLiquidity = _computeValidVLiquidity(t.vLiquidity, t.nIZI);
        _updateTokenStatus(tokenId, validVLiquidity, t.nIZI);
    }

    /// @notice View function to get position ids staked here for an user.
    /// @param _user The related address.
    /// @return list of tokenId
    function getTokenIds(address _user)
        external
        view
        returns (uint256[] memory)
    {
        EnumerableSet.UintSet storage ids = tokenIds[_user];
        // push could not be used in memory array
        // we set the tokenIdList into a fixed-length array rather than dynamic
        uint256[] memory tokenIdList = new uint256[](ids.length());
        for (uint256 i = 0; i < ids.length(); i++) {
            tokenIdList[i] = ids.at(i);
        }
        return tokenIdList;
    }
    
    /// @notice Return reward multiplier over the given _from to _to block.
    /// @param _from The start block.
    /// @param _to The end block.
    function _getRewardBlockNum(uint256 _from, uint256 _to)
        internal
        view
        returns (uint256)
    {
        if (_from > _to) {
            return 0;
        }
        if (_to <= endBlock) {
            return _to - _from;
        } else if (_from >= endBlock) {
            return 0;
        } else {
            return endBlock - _from;
        }
    }

    /// @notice View function to see pending Reward for a single position.
    /// @param tokenId The related position id.
    /// @return list of pending reward amount for each reward ERC20-token of tokenId
    function pendingReward(uint256 tokenId)
        public
        view
        returns (uint256[] memory)
    {
        BaseTokenStatus memory t = getBaseTokenStatus(tokenId);
        uint256[] memory _reward = new uint256[](rewardInfosLen);
        for (uint256 i = 0; i < rewardInfosLen; i++) {
            uint256 tokenReward = _getRewardBlockNum(
                lastTouchBlock,
                block.number
            ) * rewardInfos[i].rewardPerBlock;
            uint256 rewardPerShare = rewardInfos[i].accRewardPerShare + (tokenReward * FixedPoints.Q128) / totalVLiquidity;
            // l * (currentAcc - lastAcc)
            _reward[i] = (t.validVLiquidity * (rewardPerShare - t.lastTouchAccRewardPerShare[i])) / FixedPoints.Q128;
        }
        return _reward;
    }

    /// @notice View function to see pending Rewards for an address.
    /// @param _user The related address.
    /// @return list of pending reward amount for each reward ERC20-token of this user
    function pendingRewards(address _user)
        external
        view
        returns (uint256[] memory)
    {
        uint256[] memory _reward = new uint256[](rewardInfosLen);
        for (uint256 j = 0; j < rewardInfosLen; j++) {
            _reward[j] = 0;
        }

        for (uint256 i = 0; i < tokenIds[_user].length(); i++) {
            uint256[] memory r = pendingReward(tokenIds[_user].at(i));
            for (uint256 j = 0; j < rewardInfosLen; j++) {
                _reward[j] += r[j];
            }
        }
        return _reward;
    }

    // Control fuctions for the contract owner and operators.

    /// @notice If something goes wrong, we can send back user's nft and locked assets
    /// @param tokenId The related position id.
    function emergenceWithdraw(uint256 tokenId) external virtual;

    /// @notice Set new reward end block.
    /// @param _endBlock New end block.
    function modifyEndBlock(uint256 _endBlock) external onlyOwner {
        require(_endBlock > block.number, "OUT OF DATE");
        _updateGlobalStatus();
        // jump if origin endBlock < block.number
        lastTouchBlock = block.number;
        endBlock = _endBlock;
        emit ModifyEndBlock(endBlock);
    }

    /// @notice Set new reward per block.
    /// @param rewardIdx which rewardInfo to modify
    /// @param _rewardPerBlock new reward per block
    function modifyRewardPerBlock(uint256 rewardIdx, uint256 _rewardPerBlock)
        external
        onlyOwner
    {
        require(rewardIdx < rewardInfosLen, "OUT OF REWARD INFO RANGE");
        _updateGlobalStatus();
        rewardInfos[rewardIdx].rewardPerBlock = _rewardPerBlock;
        emit ModifyRewardPerBlock(
            rewardInfos[rewardIdx].rewardToken,
            _rewardPerBlock
        );
    }

    function modifyStartBlock(uint256 _startBlock) external onlyOwner {
        require(startBlock > block.number, 'has started!');
        require(_startBlock > block.number, 'Too Early!');
        require(_startBlock < endBlock, 'Too Late!');
        startBlock = _startBlock;
        lastTouchBlock = _startBlock;
    }


    /// @notice Set new reward provider.
    /// @param rewardIdx which rewardInfo to modify
    /// @param provider New provider
    function modifyProvider(uint256 rewardIdx, address provider)
        external
        onlyOwner
    {
        require(rewardIdx < rewardInfosLen, "OUT OF REWARD INFO RANGE");
        rewardInfos[rewardIdx].provider = provider;
        emit ModifyProvider(rewardInfos[rewardIdx].rewardToken, provider);
    }

    function modifyChargeReceiver(address _chargeReceiver) external onlyOwner {
        chargeReceiver = _chargeReceiver;
    }

    function collectFeeCharged() external nonReentrant {
        require(msg.sender == chargeReceiver, "NOT RECEIVER");
        _safeTransferToken(rewardPool.token0, chargeReceiver, totalFeeCharged0);
        _safeTransferToken(rewardPool.token1, chargeReceiver, totalFeeCharged1);
        totalFeeCharged0 = 0;
        totalFeeCharged1 = 0;
    }
}

File 12 of 17 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 14 of 17 : interfaces.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IUniswapV3Pool {
    function slot0()
    external
    view
    returns (
        uint160 sqrtPriceX96,
        int24 tick,
        uint16 observationIndex,
        uint16 observationCardinality,
        uint16 observationCardinalityNext,
        uint8 feeProtocol,
        bool unlocked
    );
    
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );

    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
}

interface IUniswapV3Factory {

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

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

}

interface INonfungiblePositionManager {

    /// @return Returns the address of the Uniswap V3 factory
    function factory() external view returns (address);

    /// @return Returns the address of WETH9
    function WETH9() external view returns (address);
    struct Position {
        uint96 nonce;
        address operator;
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint128 liquidity;
        uint256 feeGrowthInside0LastX128;
        uint256 feeGrowthInside1LastX128;
        uint128 tokensOwed0;
        uint128 tokensOwed1;
    }
    function positions(uint256 tokenId)
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );
    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }
    
    /// @notice Refunds any ETH balance held by this contract to the `msg.sender`
    /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
    /// that use ether for the input amount
    function refundETH() external payable;

    /// @notice Creates a new position wrapped in a NFT
    /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized
    /// a method does not exist, i.e. the pool is assumed to be initialized.
    /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata
    /// @return tokenId The ID of the token that represents the minted position
    /// @return liquidity The amount of liquidity for this position
    /// @return amount0 The amount of token0
    /// @return amount1 The amount of token1
    function mint(MintParams calldata params)
        external
        payable
        returns (
            uint256 tokenId,
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );
    
    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

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

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

    /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient
    /// @param params tokenId The ID of the NFT for which tokens are being collected,
    /// recipient The account that should receive the tokens,
    /// amount0Max The maximum amount of token0 to collect,
    /// amount1Max The maximum amount of token1 to collect
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);

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

    function ownerOf(uint256 tokenId) external view returns (address);

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;
}

File 15 of 17 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/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 16 of 17 : FixedPoints.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

library FixedPoints {
    uint256 constant Q32 = (1 << 32);
    uint256 constant Q64 = (1 << 64);
    uint256 constant Q96 = (1 << 96);
    uint256 constant Q128 = (1 << 128);
    uint256 constant Q160 = (1 << 160);
}

File 17 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"uniV3NFTManager","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"internalType":"struct MiningFixRangeBoostV2.PoolParams","name":"poolParams","type":"tuple"},{"components":[{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"provider","type":"address"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"internalType":"struct MiningBase.RewardInfo[]","name":"_rewardInfos","type":"tuple[]"},{"internalType":"address","name":"iziTokenAddr","type":"address"},{"internalType":"int24","name":"_rewardUpperTick","type":"int24"},{"internalType":"int24","name":"_rewardLowerTick","type":"int24"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_endBlock","type":"uint256"},{"internalType":"uint24","name":"_feeChargePercent","type":"uint24"},{"internalType":"address","name":"_chargeReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CollectReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nIZI","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"}],"name":"ModifyEndBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"address","name":"provider","type":"address"}],"name":"ModifyProvider","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"name":"ModifyRewardPerBlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"chargeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectFeeCharged","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"collectReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"nIZI","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"vLiquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"deltaNIZI","type":"uint256"}],"name":"depositIZI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"emergenceWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeRemainPercent","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMiningContractInfo","outputs":[{"internalType":"address","name":"token0_","type":"address"},{"internalType":"address","name":"token1_","type":"address"},{"internalType":"uint24","name":"fee_","type":"uint24"},{"components":[{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"provider","type":"address"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"internalType":"struct MiningBase.RewardInfo[]","name":"rewardInfos_","type":"tuple[]"},{"internalType":"address","name":"iziTokenAddr_","type":"address"},{"internalType":"int24","name":"rewardUpperTick_","type":"int24"},{"internalType":"int24","name":"rewardLowerTick_","type":"int24"},{"internalType":"uint256","name":"lastTouchBlock_","type":"uint256"},{"internalType":"uint256","name":"totalVLiquidity_","type":"uint256"},{"internalType":"uint256","name":"startBlock_","type":"uint256"},{"internalType":"uint256","name":"endBlock_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"iziToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTouchBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_chargeReceiver","type":"address"}],"name":"modifyChargeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_endBlock","type":"uint256"}],"name":"modifyEndBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardIdx","type":"uint256"},{"internalType":"address","name":"provider","type":"address"}],"name":"modifyProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardIdx","type":"uint256"},{"internalType":"uint256","name":"_rewardPerBlock","type":"uint256"}],"name":"modifyRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startBlock","type":"uint256"}],"name":"modifyStartBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","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":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"owners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"pendingReward","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardInfos","outputs":[{"internalType":"address","name":"rewardToken","type":"address"},{"internalType":"address","name":"provider","type":"address"},{"internalType":"uint256","name":"accRewardPerShare","type":"uint256"},{"internalType":"uint256","name":"rewardPerBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardInfosLen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPool","outputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenStatus","outputs":[{"internalType":"uint256","name":"vLiquidity","type":"uint256"},{"internalType":"uint256","name":"validVLiquidity","type":"uint256"},{"internalType":"uint256","name":"nIZI","type":"uint256"},{"internalType":"uint256","name":"lastTouchBlock","type":"uint256"},{"internalType":"uint256","name":"lastTokensOwed0","type":"uint256"},{"internalType":"uint256","name":"lastTokensOwed1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalFeeCharged0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalFeeCharged1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalNIZI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"noReward","type":"bool"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b5060405162003fc638038062003fc683398101604081905262000034916200062c565b8189600001518a602001518b604001518c6060015185620000646200005e6200041f60201b60201c565b62000423565b60018055606462ffffff87161115620000c45760405162461bcd60e51b815260206004820152601560248201527f6368617267652070657263656e74203c3d20313030000000000000000000000060448201526064015b60405180910390fd5b620000d1866064620007a5565b600c60006101000a81548162ffffff021916908362ffffff160217905550846001600160a01b0316634aa4a4fc6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012957600080fd5b505afa1580156200013e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000164919062000608565b601180546001600160a01b03199081166001600160a01b039384161790915560128054909116918316919091179055620001a084848462000473565b50508c51601380546001600160a01b0319166001600160a01b0390921691909117905550505050600286810b9086900b12620002055760405162461bcd60e51b81526020600482015260036024820152624c3c5560e81b6044820152606401620000bb565b88604001516001600160a01b031689602001516001600160a01b031610620002705760405162461bcd60e51b815260206004820152601960248201527f544f4b454e30203c20544f4b454e31204e4f54204d41544348000000000000006044820152606401620000bb565b87516006819055620002b15760405162461bcd60e51b81526020600482015260096024820152681393c8149155d0549160ba1b6044820152606401620000bb565b600360065410620002f95760405162461bcd60e51b81526020600482015260116024820152704154204d4f53542032205245574152445360781b6044820152606401620000bb565b60005b60065481101562000398578881815181106200032857634e487b7160e01b600052603260045260246000fd5b60209081029190910181015160008381526005835260408120825181546001600160a01b03199081166001600160a01b03928316178355948401516001830180549096169116179093556060909101516003830155600290910155806200038f81620007cc565b915050620002fc565b5050600980546001600160a01b039097166001600160a01b03199097169690961790955560138054600294850b62ffffff908116600160b81b0262ffffff60b81b1997870b909116600160a01b029690961665ffffffffffff60a01b19909116179490941790935560038190556004929092555550506000600b819055600a555062000816565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b816001600160a01b0316836001600160a01b0316106200049557818362000498565b82825b60108054600f80546001600160a01b039586166001600160a01b031990911617905562ffffff94909416600160a01b026001600160b81b0319909416919092161791909117905550506000600d819055600e55565b80516001600160a01b03811681146200050557600080fd5b919050565b600082601f8301126200051b578081fd5b815160206001600160401b0382111562000539576200053962000800565b62000549818360051b0162000772565b80838252828201915082860187848660071b890101111562000569578586fd5b855b85811015620005d457608080838b03121562000585578788fd5b6200058f62000747565b6200059a84620004ed565b8152620005a9878501620004ed565b818801526040848101519082015260608085015190820152855293850193909101906001016200056b565b5090979650505050505050565b8051600281900b81146200050557600080fd5b805162ffffff811681146200050557600080fd5b6000602082840312156200061a578081fd5b6200062582620004ed565b9392505050565b6000806000806000806000806000898b036101808112156200064c578586fd5b60808112156200065a578586fd5b506200066562000747565b620006708b620004ed565b81526200068060208c01620004ed565b60208201526200069360408c01620004ed565b6040820152620006a660608c01620005f4565b606082015260808b01519099506001600160401b03811115620006c7578586fd5b620006d58c828d016200050a565b985050620006e660a08b01620004ed565b9650620006f660c08b01620005e1565b95506200070660e08b01620005e1565b94506101008a015193506101208a01519250620007276101408b01620005f4565b9150620007386101608b01620004ed565b90509295985092959850929598565b604051608081016001600160401b03811182821017156200076c576200076c62000800565b60405290565b604051601f8201601f191681016001600160401b03811182821017156200079d576200079d62000800565b604052919050565b600062ffffff83811690831681811015620007c457620007c4620007ea565b039392505050565b6000600019821415620007e357620007e3620007ea565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6137a080620008266000396000f3fe60806040526004361061021e5760003560e01c8063715018a611610123578063b74d60a9116100ab578063d1c924a51161006f578063d1c924a514610733578063d62dd3a61461075f578063d8cd50e21461077f578063e2bbb1581461079f578063f2fde38b146107bf57600080fd5b8063b74d60a9146106a8578063bd3507da146106bd578063c772ec7c146106dd578063cd785a5e146106f3578063d004b0361461071357600080fd5b80639ac8eebc116100f25780639ac8eebc146105bf5780639f04d135146105d5578063ac9650d8146105eb578063b01ce31f1461060b578063b36b9fa31461068857600080fd5b8063715018a6146104fc57806389d6517f146105115780638da5cb5b1461058b5780639a174591146105a957600080fd5b80633a6edcce116101a65780634c878ef7116101755780634c878ef71461042a5780634d340238146104405780635e1b9e3a1461045657806366666aa91461048657806370bb45b3146104e757600080fd5b80633a6edcce146103b45780633d2ebc36146103d45780633fc8cef3146103f457806348cd4cb11461041457600080fd5b8063150b7a02116101ed578063150b7a02146102ee5780632d6730db146103325780632e0c5ca21461035457806331d7a2621461037457806338d074361461039457600080fd5b8063025e7c271461022a578063083c63231461027d57806309ca2756146102a157806312f7086c146102c157600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5061026061024536600461315d565b6007602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561028957600080fd5b5061029360045481565b604051908152602001610274565b3480156102ad57600080fd5b50600954610260906001600160a01b031681565b3480156102cd57600080fd5b506102e16102dc36600461315d565b6107df565b60405161027491906134b7565b3480156102fa57600080fd5b50610319610309366004612fc0565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610274565b34801561033e57600080fd5b5061035261034d3660046131c8565b610958565b005b34801561036057600080fd5b5061035261036f366004613175565b610a3a565b34801561038057600080fd5b506102e161038f366004612f88565b610b17565b3480156103a057600080fd5b506103526103af3660046131a4565b610caa565b3480156103c057600080fd5b506103526103cf366004612f88565b611081565b3480156103e057600080fd5b506103526103ef36600461315d565b6110cd565b34801561040057600080fd5b50601154610260906001600160a01b031681565b34801561042057600080fd5b5061029360035481565b34801561043657600080fd5b50610293600d5481565b34801561044c57600080fd5b50610293600a5481565b34801561046257600080fd5b50600c546104729062ffffff1681565b60405162ffffff9091168152602001610274565b34801561049257600080fd5b50600f546010546104bc916001600160a01b039081169190811690600160a01b900462ffffff1683565b604080516001600160a01b03948516815293909216602084015262ffffff1690820152606001610274565b3480156104f357600080fd5b506103526111ba565b34801561050857600080fd5b50610352611291565b34801561051d57600080fd5b5061056061052c36600461315d565b60056020526000908152604090208054600182015460028301546003909301546001600160a01b0392831693919092169184565b604080516001600160a01b039586168152949093166020850152918301526060820152608001610274565b34801561059757600080fd5b506000546001600160a01b0316610260565b3480156105b557600080fd5b5061029360065481565b3480156105cb57600080fd5b50610293600b5481565b3480156105e157600080fd5b5061029360025481565b6105fe6105f9366004613067565b6112c7565b6040516102749190613456565b34801561061757600080fd5b5061065b61062636600461315d565b601460205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909186565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610274565b34801561069457600080fd5b506103526106a33660046131c8565b611442565b3480156106b457600080fd5b506103526115d2565b3480156106c957600080fd5b506103526106d836600461315d565b611693565b3480156106e957600080fd5b50610293600e5481565b3480156106ff57600080fd5b5061035261070e36600461315d565b61172a565b34801561071f57600080fd5b506102e161072e366004612f88565b6118af565b34801561073f57600080fd5b5061074861197f565b6040516102749b9a99989796959493929190613343565b34801561076b57600080fd5b5061035261077a36600461315d565b611b57565b34801561078b57600080fd5b50601254610260906001600160a01b031681565b3480156107ab57600080fd5b506102936107ba3660046131c8565b611c05565b3480156107cb57600080fd5b506103526107da366004612f88565b612111565b606060006107ec836121ac565b9050600060065467ffffffffffffffff81111561081957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610842578160200160208202803683370190505b50905060005b6006548110156109505760008181526005602052604081206003015460025461087190436122b8565b61087b9190613657565b90506000600b54600160801b836108929190613657565b61089c9190613637565b6000848152600560205260409020600201546108b8919061361f565b9050600160801b856060015184815181106108e357634e487b7160e01b600052603260045260246000fd5b6020026020010151826108f691906136bd565b86602001516109059190613657565b61090f9190613637565b84848151811061092f57634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505050808061094890613700565b915050610848565b509392505050565b6000546001600160a01b0316331461098b5760405162461bcd60e51b81526004016109829061350e565b60405180910390fd5b60065482106109d75760405162461bcd60e51b81526020600482015260186024820152774f5554204f462052455741524420494e464f2052414e474560401b6044820152606401610982565b6109df612303565b600082815260056020908152604091829020600381018490555491518381526001600160a01b03909216917fd9a745381d3899e0a1380f3c7f56ea1bf0fb8331482527ff4984296da9580fab91015b60405180910390a25050565b6000546001600160a01b03163314610a645760405162461bcd60e51b81526004016109829061350e565b6006548210610ab05760405162461bcd60e51b81526020600482015260186024820152774f5554204f462052455741524420494e464f2052414e474560401b6044820152606401610982565b6000828152600560209081526040918290206001810180546001600160a01b0319166001600160a01b038681169182179092559154935191825292909216917fda608212a78120f0e323cf82e77003c28512aa6eae3747c062c459901d7930159101610a2e565b6060600060065467ffffffffffffffff811115610b4457634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610b6d578160200160208202803683370190505b50905060005b600654811015610bbc576000828281518110610b9f57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610bb481613700565b915050610b73565b5060005b6001600160a01b0384166000908152600860205260409020610be1906123d6565b811015610ca3576001600160a01b0384166000908152600860205260408120610c0e906102dc90846123e0565b905060005b600654811015610c8e57818181518110610c3d57634e487b7160e01b600052603260045260246000fd5b6020026020010151848281518110610c6557634e487b7160e01b600052603260045260246000fd5b60200260200101818151610c79919061361f565b90525080610c8681613700565b915050610c13565b50508080610c9b90613700565b915050610bc0565b5092915050565b60026001541415610ccd5760405162461bcd60e51b815260040161098290613543565b60026001556000828152600760205260409020546001600160a01b03163314610d315760405162461bcd60e51b81526020600482015260166024820152751393d50813d5d391548813d4881393d50811561254d560521b6044820152606401610982565b8015610d4457610d3f612303565b610d4d565b610d4d826123f3565b60008281526014602052604081205490610d68908290612554565b6000838152601460205260409020600201548015610da257610d8b8160006125e6565b600954610da2906001600160a01b0316338361260f565b60135460009081906001600160a01b031663fc6f7865610df18830604080516080810182529283526001600160a01b039190911660208301526001600160801b03908201819052606082015290565b604080516001600160e01b031960e085901b1681528251600482015260208301516001600160a01b03166024820152908201516001600160801b03908116604483015260609092015190911660648201526084016040805180830381600087803b158015610e5e57600080fd5b505af1158015610e72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9691906131e9565b60008881526014602052604081206004810154600590910154600c549496509294509260649062ffffff16610ecb85886136bd565b610ed59190613657565b610edf9190613637565b610ee9908461361f565b600c5490915060009060649062ffffff16610f0485886136bd565b610f0e9190613657565b610f189190613637565b610f22908461361f565b600f54909150610f3c906001600160a01b03163384612672565b601054610f53906001600160a01b03163383612672565b610f5d82876136bd565b600d6000828254610f6e919061361f565b90915550610f7e905081866136bd565b600e6000828254610f8f919061361f565b9091555050601354604051632142170760e11b81526001600160a01b03909116906342842e0e90610fc890309033908f90600401613432565b600060405180830381600087803b158015610fe257600080fd5b505af1158015610ff6573d6000803e3d6000fd5b50505060008b815260076020908152604080832080546001600160a01b03191690553383526008909152812090915061102f908c612706565b90508061103b57600080fd5b6040518b815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649060200160405180910390a2505060018055505050505050505050565b6000546001600160a01b031633146110ab5760405162461bcd60e51b81526004016109829061350e565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146110f75760405162461bcd60e51b81526004016109829061350e565b43600354116111375760405162461bcd60e51b815260206004820152600c60248201526b68617320737461727465642160a01b6044820152606401610982565b4381116111735760405162461bcd60e51b815260206004820152600a602482015269546f6f204561726c792160b01b6044820152606401610982565b60045481106111b05760405162461bcd60e51b8152602060048201526009602482015268546f6f204c6174652160b81b6044820152606401610982565b6003819055600255565b600260015414156111dd5760405162461bcd60e51b815260040161098290613543565b6002600155336000908152600860205260408120905b6111fc826123d6565b81101561128957336007600061121285856123e0565b81526020810191909152604001600020546001600160a01b0316146112655760405162461bcd60e51b81526020600482015260096024820152682727aa1027aba722a960b91b6044820152606401610982565b61127761127283836123e0565b6123f3565b8061128181613700565b9150506111f3565b505060018055565b6000546001600160a01b031633146112bb5760405162461bcd60e51b81526004016109829061350e565b6112c56000612712565b565b60608167ffffffffffffffff8111156112f057634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561132357816020015b606081526020019060019003908161130e5790505b50905060005b82811015610ca3576000803086868581811061135557634e487b7160e01b600052603260045260246000fd5b9050602002810190611367919061357a565b604051611375929190613317565b600060405180830381855af49150503d80600081146113b0576040519150601f19603f3d011682016040523d82523d6000602084013e6113b5565b606091505b509150915081611401576044815110156113ce57600080fd5b600481019050808060200190518101906113e891906130f3565b60405162461bcd60e51b815260040161098291906134fb565b8084848151811061142257634e487b7160e01b600052603260045260246000fd5b60200260200101819052505050808061143a90613700565b915050611329565b600260015414156114655760405162461bcd60e51b815260040161098290613543565b60026001556000828152600760205260409020546001600160a01b031633146114c95760405162461bcd60e51b81526020600482015260166024820152751393d50813d5d39154881bdc881393d50811561254d560521b6044820152606401610982565b6009546001600160a01b031661150d5760405162461bcd60e51b81526020600482015260096024820152681393d5081093d3d4d560ba1b6044820152606401610982565b6000811161155d5760405162461bcd60e51b815260206004820152601c60248201527f4445504f53495420495a49204d55535420424520504f534954495645000000006044820152606401610982565b611566826123f3565b6000611571836121ac565b905061157e8260016125e6565b6000828260400151611590919061361f565b905060006115a2836000015183612762565b90506115af8582846127d2565b6009546115c7906001600160a01b031633308761285c565b505060018055505050565b600260015414156115f55760405162461bcd60e51b815260040161098290613543565b60026001556012546001600160a01b031633146116435760405162461bcd60e51b815260206004820152600c60248201526b2727aa102922a1a2a4ab22a960a11b6044820152606401610982565b600f54601254600d54611663926001600160a01b03908116921690612672565b601054601254600e54611683926001600160a01b03908116921690612672565b6000600d819055600e5560018055565b600260015414156116b65760405162461bcd60e51b815260040161098290613543565b60026001556000818152600760205260409020546001600160a01b0316331461171a5760405162461bcd60e51b81526020600482015260166024820152751393d50813d5d391548813d4881393d50811561254d560521b6044820152606401610982565b611723816123f3565b5060018055565b6000546001600160a01b031633146117545760405162461bcd60e51b81526004016109829061350e565b6000818152600760205260409020546001600160a01b03168061177657600080fd5b60135460008381526007602052604090819020549051632142170760e11b81526001600160a01b03928316926342842e0e926117bc923092909116908790600401613432565b600060405180830381600087803b1580156117d657600080fd5b505af11580156117ea573d6000803e3d6000fd5b5050506000838152601460205260409020600201549050801561188f5760095460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb90604401602060405180830381600087803b15801561185557600080fd5b505af1158015611869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188d91906130d7565b505b5050600090815260076020526040902080546001600160a01b0319169055565b6001600160a01b03811660009081526008602052604081206060916118d3826123d6565b67ffffffffffffffff8111156118f957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611922578160200160208202803683370190505b50905060005b611931836123d6565b8110156109505761194283826123e0565b82828151811061196257634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061197781613700565b915050611928565b60008060006060600080600080600080600060065467ffffffffffffffff8111156119ba57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611a0c57816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816119d85790505b50975060005b600654811015611aa957600081815260056020908152604091829020825160808101845281546001600160a01b03908116825260018301541692810192909252600281015492820192909252600390910154606082015289518a9083908110611a8b57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080611aa190613700565b915050611a12565b50600f60000160009054906101000a90046001600160a01b0316600f60010160009054906101000a90046001600160a01b0316600f60010160149054906101000a900462ffffff168a600960009054906101000a90046001600160a01b0316601360149054906101000a900460020b601360179054906101000a900460020b600254600b546003546004549a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b6000546001600160a01b03163314611b815760405162461bcd60e51b81526004016109829061350e565b438111611bbe5760405162461bcd60e51b815260206004820152600b60248201526a4f5554204f46204441544560a81b6044820152606401610982565b611bc6612303565b4360025560048190556040518181527f6861e667f4625c666d8000dd2fe6b7dde9a3d46381327f9e1330df56969f15be9060200160405180910390a150565b6013546040516331a9108f60e11b81526004810184905260009182916001600160a01b0390911690636352211e9060240160206040518083038186803b158015611c4e57600080fd5b505afa158015611c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c869190612fa4565b90506001600160a01b0381163314611ccc5760405162461bcd60e51b81526020600482015260096024820152682727aa1027aba722a960b91b6044820152606401610982565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201819052610160820152601354915163133f757160e31b81526004810187905290916001600160a01b0316906399fbab88906024016101806040518083038186803b158015611d6e57600080fd5b505afa158015611d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da6919061320c565b6001600160801b039081166101608e01529081166101408d015290921660e08b01525050600290810b810b60c089015290810b900b60a087015262ffffff1660808601526001600160a01b03908116606086015290811660408501819052600f54909116149150611e4e90505760405162461bcd60e51b815260206004820152601060248201526f0a89e8a969c60409c9ea8409a82a886960831b6044820152606401610982565b60105460608201516001600160a01b03908116911614611ea35760405162461bcd60e51b815260206004820152601060248201526f0a89e968a9c62409c9ea8409a82a886960831b6044820152606401610982565b601054608082015162ffffff908116600160a01b9092041614611ef85760405162461bcd60e51b815260206004820152600d60248201526c08c8a8a409c9ea8409a82a8869609b1b6044820152606401610982565b611f0f8160a001518260c001518360e00151612883565b925060008311611f515760405162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a2102a27a5a2a760991b6044820152606401610982565b601354604051632142170760e11b81526001600160a01b03909116906342842e0e90611f8590339030908a90600401613432565b600060405180830381600087803b158015611f9f57600080fd5b505af1158015611fb3573d6000803e3d6000fd5b505050600086815260076020908152604080832080546001600160a01b03191633908117909155835260089091528120909150611ff09087612959565b905080611ffc57600080fd5b612004612303565b61200f846001612554565b6009546001600160a01b031661202457600094505b61202f8560016125e6565b600061203b8587612762565b905061204c6006600160801b613637565b86106120835760405162461bcd60e51b81526020600482015260066024820152654e495a49204f60d01b6044820152606401610982565b6120ad878683898761014001516001600160801b03168861016001516001600160801b0316612965565b85156120cb576009546120cb906001600160a01b031633308961285c565b604080518881526020810188905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15910160405180910390a2505050505b92915050565b6000546001600160a01b0316331461213b5760405162461bcd60e51b81526004016109829061350e565b6001600160a01b0381166121a05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610982565b6121a981612712565b50565b6121d76040518060800160405280600081526020016000815260200160008152602001606081525090565b6000828152601460209081526040808320815160e081018352815481526001820154818501526002820154818401526003820154606082015260048201546080820152600582015460a08201526006820180548451818702810187019095528085529194929360c086019390929083018282801561227457602002820191906000526020600020905b815481526020019060010190808311612260575b505050505081525050905060405180608001604052808260000151815260200182602001518152602001826040015181526020018260c00151815250915050919050565b6000818311156122ca5750600061210b565b60045482116122e4576122dd83836136bd565b905061210b565b60045483106122f55750600061210b565b826004546122dd91906136bd565b600254431161230e57565b6004546002541061231b57565b600061232943600454612a6e565b9050600b546000141561233b57600255565b60005b6006548110156123d05760008181526005602052604081206003015460025461236790856136bd565b6123719190613657565b600b54909150612385600160801b83613657565b61238f9190613637565b6000838152600560205260409020600201546123ab919061361f565b60008381526005602052604090206002015550806123c881613700565b91505061233e565b50600255565b600061210b825490565b60006123ec8383612a84565b9392505050565b60006123fe826121ac565b9050612408612303565b60005b600654811015612529576000600160801b8360600151838151811061244057634e487b7160e01b600052603260045260246000fd5b6020026020010151600560008581526020019081526020016000206002015461246991906136bd565b84602001516124789190613657565b6124829190613637565b905080156124b7576000828152600560205260409020600181015490546124b7916001600160a01b039182169116338461285c565b6000828152600560209081526040918290205482518781526001600160a01b039091169181019190915290810182905233907fbc96baf3023d0b9ea3a899e000f15d5f0f7a8b064774c1eed6b4cc63fcbd1b199060600160405180910390a2508061252181613700565b91505061240b565b50600061253e82600001518360400151612762565b905061254f838284604001516127d2565b505050565b80156125705781600b54612568919061361f565b600b55612582565b81600b5461257e91906136bd565b600b555b612591600160801b6003613657565b600b5411156125e25760405162461bcd60e51b815260206004820152601960248201527f544f4f204d554348204c4951554944495459205354414b4544000000000000006044820152606401610982565b5050565b80156126015781600a546125fa919061361f565b600a555050565b81600a546125fa91906136bd565b6040516001600160a01b03831660248201526044810182905261254f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612abc565b801561254f576011546001600160a01b03848116911614156126f257604051632e1a7d4d60e01b8152600481018290526001600160a01b03841690632e1a7d4d90602401600060405180830381600087803b1580156126d057600080fd5b505af11580156126e4573d6000803e3d6000fd5b5050505061254f8282612b8e565b61254f6001600160a01b038416838361260f565b60006123ec8383612c31565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600a546000141561277657508161210b565b6000600a805484600b5461278a9190613657565b612795906006613657565b61279f9190613637565b6127aa866004613657565b6127b4919061361f565b6127be9190613637565b90506127ca8185612a6e565b949350505050565b6000838152601460205260408120600181018490556002808201849055546003820155905b600654811015612855576000818152600560205260409020600201546006830180548390811061283757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001558061284d81613700565b9150506127f7565b5050505050565b61287d846323b872dd60e01b85858560405160240161263b93929190613432565b50505050565b6000620f4240826001600160801b031610156128d75760405162461bcd60e51b8152602060048201526013602482015272131254555251125516481513d3c814d3505313606a1b6044820152606401610982565b60135460009061291d906128f590600160b81b900460020b87612d4e565b60135461290c90600160a01b900460020b87612d64565b6129169190613676565b6000612d4e565b62ffffff169050620f42406001600160801b03841661293c8380613657565b6129469190613657565b6129509190613637565b95945050505050565b60006123ec8383612d79565b600086815260146020526040902085815560018101859055600280820185905554600382015560065467ffffffffffffffff8111156129b457634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156129dd578160200160208202803683370190505b5080516129f4916006840191602090910190612edc565b50600481018390556005810182905560005b600654811015612a645760008181526005602052604090206002015460068301805483908110612a4657634e487b7160e01b600052603260045260246000fd5b60009182526020909120015580612a5c81613700565b915050612a06565b5050505050505050565b6000818310612a7d57816123ec565b5090919050565b6000826000018281548110612aa957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000612b11826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612dc89092919063ffffffff16565b80519091501561254f5780806020019051810190612b2f91906130d7565b61254f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610982565b604080516000808252602082019092526001600160a01b038416908390604051612bb89190613327565b60006040518083038185875af1925050503d8060008114612bf5576040519150601f19603f3d011682016040523d82523d6000602084013e612bfa565b606091505b505090508061254f5760405162461bcd60e51b815260206004820152600360248201526253544560e81b6044820152606401610982565b60008181526001830160205260408120548015612d44576000612c556001836136bd565b8554909150600090612c69906001906136bd565b9050818114612cea576000866000018281548110612c9757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110612cc857634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612d0957634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061210b565b600091505061210b565b60008160020b8360020b1215612a7d57816123ec565b60008160020b8360020b12612a7d57816123ec565b6000818152600183016020526040812054612dc05750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561210b565b50600061210b565b60606127ca8484600085856001600160a01b0385163b612e2a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610982565b600080866001600160a01b03168587604051612e469190613327565b60006040518083038185875af1925050503d8060008114612e83576040519150601f19603f3d011682016040523d82523d6000602084013e612e88565b606091505b5091509150612e98828286612ea3565b979650505050505050565b60608315612eb25750816123ec565b825115612ec25782518084602001fd5b8160405162461bcd60e51b815260040161098291906134fb565b828054828255906000526020600020908101928215612f17579160200282015b82811115612f17578251825591602001919060010190612efc565b50612f23929150612f27565b5090565b5b80821115612f235760008155600101612f28565b8051612f4781613747565b919050565b8051600281900b8114612f4757600080fd5b80516001600160801b0381168114612f4757600080fd5b805162ffffff81168114612f4757600080fd5b600060208284031215612f99578081fd5b81356123ec81613747565b600060208284031215612fb5578081fd5b81516123ec81613747565b60008060008060808587031215612fd5578283fd5b8435612fe081613747565b93506020850135612ff081613747565b925060408501359150606085013567ffffffffffffffff811115613012578182fd5b8501601f81018713613022578182fd5b8035613035613030826135f7565b6135c6565b818152886020838501011115613049578384fd5b81602084016020830137908101602001929092525092959194509250565b60008060208385031215613079578182fd5b823567ffffffffffffffff80821115613090578384fd5b818501915085601f8301126130a3578384fd5b8135818111156130b1578485fd5b8660208260051b85010111156130c5578485fd5b60209290920196919550909350505050565b6000602082840312156130e8578081fd5b81516123ec8161375c565b600060208284031215613104578081fd5b815167ffffffffffffffff81111561311a578182fd5b8201601f8101841361312a578182fd5b8051613138613030826135f7565b81815285602083850101111561314c578384fd5b6129508260208301602086016136d4565b60006020828403121561316e578081fd5b5035919050565b60008060408385031215613187578182fd5b82359150602083013561319981613747565b809150509250929050565b600080604083850312156131b6578182fd5b8235915060208301356131998161375c565b600080604083850312156131da578182fd5b50508035926020909101359150565b600080604083850312156131fb578182fd5b505080516020909101519092909150565b6000806000806000806000806000806000806101808d8f03121561322e57898afd5b8c516bffffffffffffffffffffffff81168114613249578a8bfd5b9b5061325760208e01612f3c565b9a5061326560408e01612f3c565b995061327360608e01612f3c565b985061328160808e01612f75565b975061328f60a08e01612f4c565b965061329d60c08e01612f4c565b95506132ab60e08e01612f5e565b94506101008d015193506101208d015192506132ca6101408e01612f5e565b91506132d96101608e01612f5e565b90509295989b509295989b509295989b565b600081518084526133038160208601602086016136d4565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b600082516133398184602087016136d4565b9190910192915050565b6000610160820160018060a01b03808f168452808e16602085015262ffffff8d1660408501526101606060850152818c518084526101808601915060208e019350845b818110156133ce578451848151168452846020820151166020850152604081015160408501526060810151606085015250608083019250602085019450600181019050613386565b50506001600160a01b038c16608086015292506133e9915050565b6133f860a083018960020b9052565b61340760c083018860020b9052565b8560e08301528461010083015283610120830152826101408301529c9b505050505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b828110156134aa57603f198886030184526134988583516132eb565b9450928501929085019060010161347c565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156134ef578351835292840192918401916001016134d3565b50909695505050505050565b6020815260006123ec60208301846132eb565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000808335601e19843603018112613590578283fd5b83018035915067ffffffffffffffff8211156135aa578283fd5b6020019150368190038213156135bf57600080fd5b9250929050565b604051601f8201601f1916810167ffffffffffffffff811182821017156135ef576135ef613731565b604052919050565b600067ffffffffffffffff82111561361157613611613731565b50601f01601f191660200190565b600082198211156136325761363261371b565b500190565b60008261365257634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156136715761367161371b565b500290565b60008160020b8360020b82811281627fffff190183128115161561369c5761369c61371b565b81627fffff0183138116156136b3576136b361371b565b5090039392505050565b6000828210156136cf576136cf61371b565b500390565b60005b838110156136ef5781810151838201526020016136d7565b8381111561287d5750506000910152565b60006000198214156137145761371461371b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146121a957600080fd5b80151581146121a957600080fdfea2646970667358221220b7b869d7f4e29979bbdc407eb2d8b41f6c4e7b1a057def8dc2be5eaa04b547ba64736f6c63430008040033000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe880000000000000000000000000a3bb08b3a15a19b4de82f8acfc862606fb69a2d000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000001800000000000000000000000009ad37205d608b8b219e6a2573f922094cec5c200fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbca26fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc8960000000000000000000000000000000000000000000000000000000000dfc3940000000000000000000000000000000000000000000000000000000000e2f73800000000000000000000000000000000000000000000000000000000000000280000000000000000000000003599a414b4365b118766479600c0fd135177c2d500000000000000000000000000000000000000000000000000000000000000010000000000000000000000009ad37205d608b8b219e6a2573f922094cec5c200000000000000000000000000ee264e74a2fd2c7a55da705b80e092f05dae5b5d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c3bc3a4a3194400

Deployed Bytecode

0x60806040526004361061021e5760003560e01c8063715018a611610123578063b74d60a9116100ab578063d1c924a51161006f578063d1c924a514610733578063d62dd3a61461075f578063d8cd50e21461077f578063e2bbb1581461079f578063f2fde38b146107bf57600080fd5b8063b74d60a9146106a8578063bd3507da146106bd578063c772ec7c146106dd578063cd785a5e146106f3578063d004b0361461071357600080fd5b80639ac8eebc116100f25780639ac8eebc146105bf5780639f04d135146105d5578063ac9650d8146105eb578063b01ce31f1461060b578063b36b9fa31461068857600080fd5b8063715018a6146104fc57806389d6517f146105115780638da5cb5b1461058b5780639a174591146105a957600080fd5b80633a6edcce116101a65780634c878ef7116101755780634c878ef71461042a5780634d340238146104405780635e1b9e3a1461045657806366666aa91461048657806370bb45b3146104e757600080fd5b80633a6edcce146103b45780633d2ebc36146103d45780633fc8cef3146103f457806348cd4cb11461041457600080fd5b8063150b7a02116101ed578063150b7a02146102ee5780632d6730db146103325780632e0c5ca21461035457806331d7a2621461037457806338d074361461039457600080fd5b8063025e7c271461022a578063083c63231461027d57806309ca2756146102a157806312f7086c146102c157600080fd5b3661022557005b600080fd5b34801561023657600080fd5b5061026061024536600461315d565b6007602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561028957600080fd5b5061029360045481565b604051908152602001610274565b3480156102ad57600080fd5b50600954610260906001600160a01b031681565b3480156102cd57600080fd5b506102e16102dc36600461315d565b6107df565b60405161027491906134b7565b3480156102fa57600080fd5b50610319610309366004612fc0565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610274565b34801561033e57600080fd5b5061035261034d3660046131c8565b610958565b005b34801561036057600080fd5b5061035261036f366004613175565b610a3a565b34801561038057600080fd5b506102e161038f366004612f88565b610b17565b3480156103a057600080fd5b506103526103af3660046131a4565b610caa565b3480156103c057600080fd5b506103526103cf366004612f88565b611081565b3480156103e057600080fd5b506103526103ef36600461315d565b6110cd565b34801561040057600080fd5b50601154610260906001600160a01b031681565b34801561042057600080fd5b5061029360035481565b34801561043657600080fd5b50610293600d5481565b34801561044c57600080fd5b50610293600a5481565b34801561046257600080fd5b50600c546104729062ffffff1681565b60405162ffffff9091168152602001610274565b34801561049257600080fd5b50600f546010546104bc916001600160a01b039081169190811690600160a01b900462ffffff1683565b604080516001600160a01b03948516815293909216602084015262ffffff1690820152606001610274565b3480156104f357600080fd5b506103526111ba565b34801561050857600080fd5b50610352611291565b34801561051d57600080fd5b5061056061052c36600461315d565b60056020526000908152604090208054600182015460028301546003909301546001600160a01b0392831693919092169184565b604080516001600160a01b039586168152949093166020850152918301526060820152608001610274565b34801561059757600080fd5b506000546001600160a01b0316610260565b3480156105b557600080fd5b5061029360065481565b3480156105cb57600080fd5b50610293600b5481565b3480156105e157600080fd5b5061029360025481565b6105fe6105f9366004613067565b6112c7565b6040516102749190613456565b34801561061757600080fd5b5061065b61062636600461315d565b601460205260009081526040902080546001820154600283015460038401546004850154600590950154939492939192909186565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610274565b34801561069457600080fd5b506103526106a33660046131c8565b611442565b3480156106b457600080fd5b506103526115d2565b3480156106c957600080fd5b506103526106d836600461315d565b611693565b3480156106e957600080fd5b50610293600e5481565b3480156106ff57600080fd5b5061035261070e36600461315d565b61172a565b34801561071f57600080fd5b506102e161072e366004612f88565b6118af565b34801561073f57600080fd5b5061074861197f565b6040516102749b9a99989796959493929190613343565b34801561076b57600080fd5b5061035261077a36600461315d565b611b57565b34801561078b57600080fd5b50601254610260906001600160a01b031681565b3480156107ab57600080fd5b506102936107ba3660046131c8565b611c05565b3480156107cb57600080fd5b506103526107da366004612f88565b612111565b606060006107ec836121ac565b9050600060065467ffffffffffffffff81111561081957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610842578160200160208202803683370190505b50905060005b6006548110156109505760008181526005602052604081206003015460025461087190436122b8565b61087b9190613657565b90506000600b54600160801b836108929190613657565b61089c9190613637565b6000848152600560205260409020600201546108b8919061361f565b9050600160801b856060015184815181106108e357634e487b7160e01b600052603260045260246000fd5b6020026020010151826108f691906136bd565b86602001516109059190613657565b61090f9190613637565b84848151811061092f57634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505050808061094890613700565b915050610848565b509392505050565b6000546001600160a01b0316331461098b5760405162461bcd60e51b81526004016109829061350e565b60405180910390fd5b60065482106109d75760405162461bcd60e51b81526020600482015260186024820152774f5554204f462052455741524420494e464f2052414e474560401b6044820152606401610982565b6109df612303565b600082815260056020908152604091829020600381018490555491518381526001600160a01b03909216917fd9a745381d3899e0a1380f3c7f56ea1bf0fb8331482527ff4984296da9580fab91015b60405180910390a25050565b6000546001600160a01b03163314610a645760405162461bcd60e51b81526004016109829061350e565b6006548210610ab05760405162461bcd60e51b81526020600482015260186024820152774f5554204f462052455741524420494e464f2052414e474560401b6044820152606401610982565b6000828152600560209081526040918290206001810180546001600160a01b0319166001600160a01b038681169182179092559154935191825292909216917fda608212a78120f0e323cf82e77003c28512aa6eae3747c062c459901d7930159101610a2e565b6060600060065467ffffffffffffffff811115610b4457634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610b6d578160200160208202803683370190505b50905060005b600654811015610bbc576000828281518110610b9f57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610bb481613700565b915050610b73565b5060005b6001600160a01b0384166000908152600860205260409020610be1906123d6565b811015610ca3576001600160a01b0384166000908152600860205260408120610c0e906102dc90846123e0565b905060005b600654811015610c8e57818181518110610c3d57634e487b7160e01b600052603260045260246000fd5b6020026020010151848281518110610c6557634e487b7160e01b600052603260045260246000fd5b60200260200101818151610c79919061361f565b90525080610c8681613700565b915050610c13565b50508080610c9b90613700565b915050610bc0565b5092915050565b60026001541415610ccd5760405162461bcd60e51b815260040161098290613543565b60026001556000828152600760205260409020546001600160a01b03163314610d315760405162461bcd60e51b81526020600482015260166024820152751393d50813d5d391548813d4881393d50811561254d560521b6044820152606401610982565b8015610d4457610d3f612303565b610d4d565b610d4d826123f3565b60008281526014602052604081205490610d68908290612554565b6000838152601460205260409020600201548015610da257610d8b8160006125e6565b600954610da2906001600160a01b0316338361260f565b60135460009081906001600160a01b031663fc6f7865610df18830604080516080810182529283526001600160a01b039190911660208301526001600160801b03908201819052606082015290565b604080516001600160e01b031960e085901b1681528251600482015260208301516001600160a01b03166024820152908201516001600160801b03908116604483015260609092015190911660648201526084016040805180830381600087803b158015610e5e57600080fd5b505af1158015610e72573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9691906131e9565b60008881526014602052604081206004810154600590910154600c549496509294509260649062ffffff16610ecb85886136bd565b610ed59190613657565b610edf9190613637565b610ee9908461361f565b600c5490915060009060649062ffffff16610f0485886136bd565b610f0e9190613657565b610f189190613637565b610f22908461361f565b600f54909150610f3c906001600160a01b03163384612672565b601054610f53906001600160a01b03163383612672565b610f5d82876136bd565b600d6000828254610f6e919061361f565b90915550610f7e905081866136bd565b600e6000828254610f8f919061361f565b9091555050601354604051632142170760e11b81526001600160a01b03909116906342842e0e90610fc890309033908f90600401613432565b600060405180830381600087803b158015610fe257600080fd5b505af1158015610ff6573d6000803e3d6000fd5b50505060008b815260076020908152604080832080546001600160a01b03191690553383526008909152812090915061102f908c612706565b90508061103b57600080fd5b6040518b815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649060200160405180910390a2505060018055505050505050505050565b6000546001600160a01b031633146110ab5760405162461bcd60e51b81526004016109829061350e565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146110f75760405162461bcd60e51b81526004016109829061350e565b43600354116111375760405162461bcd60e51b815260206004820152600c60248201526b68617320737461727465642160a01b6044820152606401610982565b4381116111735760405162461bcd60e51b815260206004820152600a602482015269546f6f204561726c792160b01b6044820152606401610982565b60045481106111b05760405162461bcd60e51b8152602060048201526009602482015268546f6f204c6174652160b81b6044820152606401610982565b6003819055600255565b600260015414156111dd5760405162461bcd60e51b815260040161098290613543565b6002600155336000908152600860205260408120905b6111fc826123d6565b81101561128957336007600061121285856123e0565b81526020810191909152604001600020546001600160a01b0316146112655760405162461bcd60e51b81526020600482015260096024820152682727aa1027aba722a960b91b6044820152606401610982565b61127761127283836123e0565b6123f3565b8061128181613700565b9150506111f3565b505060018055565b6000546001600160a01b031633146112bb5760405162461bcd60e51b81526004016109829061350e565b6112c56000612712565b565b60608167ffffffffffffffff8111156112f057634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561132357816020015b606081526020019060019003908161130e5790505b50905060005b82811015610ca3576000803086868581811061135557634e487b7160e01b600052603260045260246000fd5b9050602002810190611367919061357a565b604051611375929190613317565b600060405180830381855af49150503d80600081146113b0576040519150601f19603f3d011682016040523d82523d6000602084013e6113b5565b606091505b509150915081611401576044815110156113ce57600080fd5b600481019050808060200190518101906113e891906130f3565b60405162461bcd60e51b815260040161098291906134fb565b8084848151811061142257634e487b7160e01b600052603260045260246000fd5b60200260200101819052505050808061143a90613700565b915050611329565b600260015414156114655760405162461bcd60e51b815260040161098290613543565b60026001556000828152600760205260409020546001600160a01b031633146114c95760405162461bcd60e51b81526020600482015260166024820152751393d50813d5d39154881bdc881393d50811561254d560521b6044820152606401610982565b6009546001600160a01b031661150d5760405162461bcd60e51b81526020600482015260096024820152681393d5081093d3d4d560ba1b6044820152606401610982565b6000811161155d5760405162461bcd60e51b815260206004820152601c60248201527f4445504f53495420495a49204d55535420424520504f534954495645000000006044820152606401610982565b611566826123f3565b6000611571836121ac565b905061157e8260016125e6565b6000828260400151611590919061361f565b905060006115a2836000015183612762565b90506115af8582846127d2565b6009546115c7906001600160a01b031633308761285c565b505060018055505050565b600260015414156115f55760405162461bcd60e51b815260040161098290613543565b60026001556012546001600160a01b031633146116435760405162461bcd60e51b815260206004820152600c60248201526b2727aa102922a1a2a4ab22a960a11b6044820152606401610982565b600f54601254600d54611663926001600160a01b03908116921690612672565b601054601254600e54611683926001600160a01b03908116921690612672565b6000600d819055600e5560018055565b600260015414156116b65760405162461bcd60e51b815260040161098290613543565b60026001556000818152600760205260409020546001600160a01b0316331461171a5760405162461bcd60e51b81526020600482015260166024820152751393d50813d5d391548813d4881393d50811561254d560521b6044820152606401610982565b611723816123f3565b5060018055565b6000546001600160a01b031633146117545760405162461bcd60e51b81526004016109829061350e565b6000818152600760205260409020546001600160a01b03168061177657600080fd5b60135460008381526007602052604090819020549051632142170760e11b81526001600160a01b03928316926342842e0e926117bc923092909116908790600401613432565b600060405180830381600087803b1580156117d657600080fd5b505af11580156117ea573d6000803e3d6000fd5b5050506000838152601460205260409020600201549050801561188f5760095460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb90604401602060405180830381600087803b15801561185557600080fd5b505af1158015611869573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188d91906130d7565b505b5050600090815260076020526040902080546001600160a01b0319169055565b6001600160a01b03811660009081526008602052604081206060916118d3826123d6565b67ffffffffffffffff8111156118f957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611922578160200160208202803683370190505b50905060005b611931836123d6565b8110156109505761194283826123e0565b82828151811061196257634e487b7160e01b600052603260045260246000fd5b60209081029190910101528061197781613700565b915050611928565b60008060006060600080600080600080600060065467ffffffffffffffff8111156119ba57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611a0c57816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816119d85790505b50975060005b600654811015611aa957600081815260056020908152604091829020825160808101845281546001600160a01b03908116825260018301541692810192909252600281015492820192909252600390910154606082015289518a9083908110611a8b57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080611aa190613700565b915050611a12565b50600f60000160009054906101000a90046001600160a01b0316600f60010160009054906101000a90046001600160a01b0316600f60010160149054906101000a900462ffffff168a600960009054906101000a90046001600160a01b0316601360149054906101000a900460020b601360179054906101000a900460020b600254600b546003546004549a509a509a509a509a509a509a509a509a509a509a50909192939495969798999a565b6000546001600160a01b03163314611b815760405162461bcd60e51b81526004016109829061350e565b438111611bbe5760405162461bcd60e51b815260206004820152600b60248201526a4f5554204f46204441544560a81b6044820152606401610982565b611bc6612303565b4360025560048190556040518181527f6861e667f4625c666d8000dd2fe6b7dde9a3d46381327f9e1330df56969f15be9060200160405180910390a150565b6013546040516331a9108f60e11b81526004810184905260009182916001600160a01b0390911690636352211e9060240160206040518083038186803b158015611c4e57600080fd5b505afa158015611c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c869190612fa4565b90506001600160a01b0381163314611ccc5760405162461bcd60e51b81526020600482015260096024820152682727aa1027aba722a960b91b6044820152606401610982565b6040805161018081018252600080825260208201819052818301819052606082018190526080820181905260a0820181905260c0820181905260e08201819052610100820181905261012082018190526101408201819052610160820152601354915163133f757160e31b81526004810187905290916001600160a01b0316906399fbab88906024016101806040518083038186803b158015611d6e57600080fd5b505afa158015611d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da6919061320c565b6001600160801b039081166101608e01529081166101408d015290921660e08b01525050600290810b810b60c089015290810b900b60a087015262ffffff1660808601526001600160a01b03908116606086015290811660408501819052600f54909116149150611e4e90505760405162461bcd60e51b815260206004820152601060248201526f0a89e8a969c60409c9ea8409a82a886960831b6044820152606401610982565b60105460608201516001600160a01b03908116911614611ea35760405162461bcd60e51b815260206004820152601060248201526f0a89e968a9c62409c9ea8409a82a886960831b6044820152606401610982565b601054608082015162ffffff908116600160a01b9092041614611ef85760405162461bcd60e51b815260206004820152600d60248201526c08c8a8a409c9ea8409a82a8869609b1b6044820152606401610982565b611f0f8160a001518260c001518360e00151612883565b925060008311611f515760405162461bcd60e51b815260206004820152600d60248201526c24a72b20a624a2102a27a5a2a760991b6044820152606401610982565b601354604051632142170760e11b81526001600160a01b03909116906342842e0e90611f8590339030908a90600401613432565b600060405180830381600087803b158015611f9f57600080fd5b505af1158015611fb3573d6000803e3d6000fd5b505050600086815260076020908152604080832080546001600160a01b03191633908117909155835260089091528120909150611ff09087612959565b905080611ffc57600080fd5b612004612303565b61200f846001612554565b6009546001600160a01b031661202457600094505b61202f8560016125e6565b600061203b8587612762565b905061204c6006600160801b613637565b86106120835760405162461bcd60e51b81526020600482015260066024820152654e495a49204f60d01b6044820152606401610982565b6120ad878683898761014001516001600160801b03168861016001516001600160801b0316612965565b85156120cb576009546120cb906001600160a01b031633308961285c565b604080518881526020810188905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15910160405180910390a2505050505b92915050565b6000546001600160a01b0316331461213b5760405162461bcd60e51b81526004016109829061350e565b6001600160a01b0381166121a05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610982565b6121a981612712565b50565b6121d76040518060800160405280600081526020016000815260200160008152602001606081525090565b6000828152601460209081526040808320815160e081018352815481526001820154818501526002820154818401526003820154606082015260048201546080820152600582015460a08201526006820180548451818702810187019095528085529194929360c086019390929083018282801561227457602002820191906000526020600020905b815481526020019060010190808311612260575b505050505081525050905060405180608001604052808260000151815260200182602001518152602001826040015181526020018260c00151815250915050919050565b6000818311156122ca5750600061210b565b60045482116122e4576122dd83836136bd565b905061210b565b60045483106122f55750600061210b565b826004546122dd91906136bd565b600254431161230e57565b6004546002541061231b57565b600061232943600454612a6e565b9050600b546000141561233b57600255565b60005b6006548110156123d05760008181526005602052604081206003015460025461236790856136bd565b6123719190613657565b600b54909150612385600160801b83613657565b61238f9190613637565b6000838152600560205260409020600201546123ab919061361f565b60008381526005602052604090206002015550806123c881613700565b91505061233e565b50600255565b600061210b825490565b60006123ec8383612a84565b9392505050565b60006123fe826121ac565b9050612408612303565b60005b600654811015612529576000600160801b8360600151838151811061244057634e487b7160e01b600052603260045260246000fd5b6020026020010151600560008581526020019081526020016000206002015461246991906136bd565b84602001516124789190613657565b6124829190613637565b905080156124b7576000828152600560205260409020600181015490546124b7916001600160a01b039182169116338461285c565b6000828152600560209081526040918290205482518781526001600160a01b039091169181019190915290810182905233907fbc96baf3023d0b9ea3a899e000f15d5f0f7a8b064774c1eed6b4cc63fcbd1b199060600160405180910390a2508061252181613700565b91505061240b565b50600061253e82600001518360400151612762565b905061254f838284604001516127d2565b505050565b80156125705781600b54612568919061361f565b600b55612582565b81600b5461257e91906136bd565b600b555b612591600160801b6003613657565b600b5411156125e25760405162461bcd60e51b815260206004820152601960248201527f544f4f204d554348204c4951554944495459205354414b4544000000000000006044820152606401610982565b5050565b80156126015781600a546125fa919061361f565b600a555050565b81600a546125fa91906136bd565b6040516001600160a01b03831660248201526044810182905261254f90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612abc565b801561254f576011546001600160a01b03848116911614156126f257604051632e1a7d4d60e01b8152600481018290526001600160a01b03841690632e1a7d4d90602401600060405180830381600087803b1580156126d057600080fd5b505af11580156126e4573d6000803e3d6000fd5b5050505061254f8282612b8e565b61254f6001600160a01b038416838361260f565b60006123ec8383612c31565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600a546000141561277657508161210b565b6000600a805484600b5461278a9190613657565b612795906006613657565b61279f9190613637565b6127aa866004613657565b6127b4919061361f565b6127be9190613637565b90506127ca8185612a6e565b949350505050565b6000838152601460205260408120600181018490556002808201849055546003820155905b600654811015612855576000818152600560205260409020600201546006830180548390811061283757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001558061284d81613700565b9150506127f7565b5050505050565b61287d846323b872dd60e01b85858560405160240161263b93929190613432565b50505050565b6000620f4240826001600160801b031610156128d75760405162461bcd60e51b8152602060048201526013602482015272131254555251125516481513d3c814d3505313606a1b6044820152606401610982565b60135460009061291d906128f590600160b81b900460020b87612d4e565b60135461290c90600160a01b900460020b87612d64565b6129169190613676565b6000612d4e565b62ffffff169050620f42406001600160801b03841661293c8380613657565b6129469190613657565b6129509190613637565b95945050505050565b60006123ec8383612d79565b600086815260146020526040902085815560018101859055600280820185905554600382015560065467ffffffffffffffff8111156129b457634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156129dd578160200160208202803683370190505b5080516129f4916006840191602090910190612edc565b50600481018390556005810182905560005b600654811015612a645760008181526005602052604090206002015460068301805483908110612a4657634e487b7160e01b600052603260045260246000fd5b60009182526020909120015580612a5c81613700565b915050612a06565b5050505050505050565b6000818310612a7d57816123ec565b5090919050565b6000826000018281548110612aa957634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000612b11826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612dc89092919063ffffffff16565b80519091501561254f5780806020019051810190612b2f91906130d7565b61254f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610982565b604080516000808252602082019092526001600160a01b038416908390604051612bb89190613327565b60006040518083038185875af1925050503d8060008114612bf5576040519150601f19603f3d011682016040523d82523d6000602084013e612bfa565b606091505b505090508061254f5760405162461bcd60e51b815260206004820152600360248201526253544560e81b6044820152606401610982565b60008181526001830160205260408120548015612d44576000612c556001836136bd565b8554909150600090612c69906001906136bd565b9050818114612cea576000866000018281548110612c9757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110612cc857634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612d0957634e487b7160e01b600052603160045260246000fd5b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061210b565b600091505061210b565b60008160020b8360020b1215612a7d57816123ec565b60008160020b8360020b12612a7d57816123ec565b6000818152600183016020526040812054612dc05750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561210b565b50600061210b565b60606127ca8484600085856001600160a01b0385163b612e2a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610982565b600080866001600160a01b03168587604051612e469190613327565b60006040518083038185875af1925050503d8060008114612e83576040519150601f19603f3d011682016040523d82523d6000602084013e612e88565b606091505b5091509150612e98828286612ea3565b979650505050505050565b60608315612eb25750816123ec565b825115612ec25782518084602001fd5b8160405162461bcd60e51b815260040161098291906134fb565b828054828255906000526020600020908101928215612f17579160200282015b82811115612f17578251825591602001919060010190612efc565b50612f23929150612f27565b5090565b5b80821115612f235760008155600101612f28565b8051612f4781613747565b919050565b8051600281900b8114612f4757600080fd5b80516001600160801b0381168114612f4757600080fd5b805162ffffff81168114612f4757600080fd5b600060208284031215612f99578081fd5b81356123ec81613747565b600060208284031215612fb5578081fd5b81516123ec81613747565b60008060008060808587031215612fd5578283fd5b8435612fe081613747565b93506020850135612ff081613747565b925060408501359150606085013567ffffffffffffffff811115613012578182fd5b8501601f81018713613022578182fd5b8035613035613030826135f7565b6135c6565b818152886020838501011115613049578384fd5b81602084016020830137908101602001929092525092959194509250565b60008060208385031215613079578182fd5b823567ffffffffffffffff80821115613090578384fd5b818501915085601f8301126130a3578384fd5b8135818111156130b1578485fd5b8660208260051b85010111156130c5578485fd5b60209290920196919550909350505050565b6000602082840312156130e8578081fd5b81516123ec8161375c565b600060208284031215613104578081fd5b815167ffffffffffffffff81111561311a578182fd5b8201601f8101841361312a578182fd5b8051613138613030826135f7565b81815285602083850101111561314c578384fd5b6129508260208301602086016136d4565b60006020828403121561316e578081fd5b5035919050565b60008060408385031215613187578182fd5b82359150602083013561319981613747565b809150509250929050565b600080604083850312156131b6578182fd5b8235915060208301356131998161375c565b600080604083850312156131da578182fd5b50508035926020909101359150565b600080604083850312156131fb578182fd5b505080516020909101519092909150565b6000806000806000806000806000806000806101808d8f03121561322e57898afd5b8c516bffffffffffffffffffffffff81168114613249578a8bfd5b9b5061325760208e01612f3c565b9a5061326560408e01612f3c565b995061327360608e01612f3c565b985061328160808e01612f75565b975061328f60a08e01612f4c565b965061329d60c08e01612f4c565b95506132ab60e08e01612f5e565b94506101008d015193506101208d015192506132ca6101408e01612f5e565b91506132d96101608e01612f5e565b90509295989b509295989b509295989b565b600081518084526133038160208601602086016136d4565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b600082516133398184602087016136d4565b9190910192915050565b6000610160820160018060a01b03808f168452808e16602085015262ffffff8d1660408501526101606060850152818c518084526101808601915060208e019350845b818110156133ce578451848151168452846020820151166020850152604081015160408501526060810151606085015250608083019250602085019450600181019050613386565b50506001600160a01b038c16608086015292506133e9915050565b6133f860a083018960020b9052565b61340760c083018860020b9052565b8560e08301528461010083015283610120830152826101408301529c9b505050505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b828110156134aa57603f198886030184526134988583516132eb565b9450928501929085019060010161347c565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b818110156134ef578351835292840192918401916001016134d3565b50909695505050505050565b6020815260006123ec60208301846132eb565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000808335601e19843603018112613590578283fd5b83018035915067ffffffffffffffff8211156135aa578283fd5b6020019150368190038213156135bf57600080fd5b9250929050565b604051601f8201601f1916810167ffffffffffffffff811182821017156135ef576135ef613731565b604052919050565b600067ffffffffffffffff82111561361157613611613731565b50601f01601f191660200190565b600082198211156136325761363261371b565b500190565b60008261365257634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156136715761367161371b565b500290565b60008160020b8360020b82811281627fffff190183128115161561369c5761369c61371b565b81627fffff0183138116156136b3576136b361371b565b5090039392505050565b6000828210156136cf576136cf61371b565b500390565b60005b838110156136ef5781810151838201526020016136d7565b8381111561287d5750506000910152565b60006000198214156137145761371461371b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146121a957600080fd5b80151581146121a957600080fdfea2646970667358221220b7b869d7f4e29979bbdc407eb2d8b41f6c4e7b1a057def8dc2be5eaa04b547ba64736f6c63430008040033

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

000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe880000000000000000000000000a3bb08b3a15a19b4de82f8acfc862606fb69a2d000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000001800000000000000000000000009ad37205d608b8b219e6a2573f922094cec5c200fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbca26fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc8960000000000000000000000000000000000000000000000000000000000dfc3940000000000000000000000000000000000000000000000000000000000e2f73800000000000000000000000000000000000000000000000000000000000000280000000000000000000000003599a414b4365b118766479600c0fd135177c2d500000000000000000000000000000000000000000000000000000000000000010000000000000000000000009ad37205d608b8b219e6a2573f922094cec5c200000000000000000000000000ee264e74a2fd2c7a55da705b80e092f05dae5b5d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003c3bc3a4a3194400

-----Decoded View---------------
Arg [0] : poolParams (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [1] : _rewardInfos (tuple[]): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [2] : iziTokenAddr (address): 0x9ad37205d608B8b219e6a2573f922094CEc5c200
Arg [3] : _rewardUpperTick (int24): -275930
Arg [4] : _rewardLowerTick (int24): -276330
Arg [5] : _startBlock (uint256): 14664596
Arg [6] : _endBlock (uint256): 14874424
Arg [7] : _feeChargePercent (uint24): 40
Arg [8] : _chargeReceiver (address): 0x3599A414B4365b118766479600c0fD135177C2D5

-----Encoded View---------------
17 Constructor Arguments found :
Arg [0] : 000000000000000000000000c36442b4a4522e871399cd717abdd847ab11fe88
Arg [1] : 0000000000000000000000000a3bb08b3a15a19b4de82f8acfc862606fb69a2d
Arg [2] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [5] : 0000000000000000000000009ad37205d608b8b219e6a2573f922094cec5c200
Arg [6] : fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbca26
Arg [7] : fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc896
Arg [8] : 0000000000000000000000000000000000000000000000000000000000dfc394
Arg [9] : 0000000000000000000000000000000000000000000000000000000000e2f738
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [11] : 0000000000000000000000003599a414b4365b118766479600c0fd135177c2d5
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 0000000000000000000000009ad37205d608b8b219e6a2573f922094cec5c200
Arg [14] : 000000000000000000000000ee264e74a2fd2c7a55da705b80e092f05dae5b5d
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [16] : 0000000000000000000000000000000000000000000000003c3bc3a4a3194400


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.