ETH Price: $2,678.34 (-0.64%)

Contract

0x9b2B253D75DC61FC9ae512e04850e258bEbEf8C6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit218352732025-02-13 4:47:114 days ago1739422031IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000280171.34140193
Withdraw All218194992025-02-10 23:47:476 days ago1739231267IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000281451.36750666
Claim218145202025-02-10 7:07:117 days ago1739171231IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000196731.23397644
Deposit218067142025-02-09 4:56:598 days ago1739077019IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000334141.32381047
Deposit218063332025-02-09 3:40:238 days ago1739072423IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000313171.2951516
Withdraw All218028472025-02-08 15:59:478 days ago1739030387IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000342191.53507239
Claim218028392025-02-08 15:58:118 days ago1739030291IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000252551.44707984
Unlock218028362025-02-08 15:57:358 days ago1739030255IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000340681.41177596
Withdraw All217978842025-02-07 23:21:599 days ago1738970519IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000325371.47281624
Unlock217978792025-02-07 23:20:599 days ago1738970459IN
0x9b2B253D...8bEbEf8C6
0 ETH0.00031391.4
Unlock217910942025-02-07 0:37:4710 days ago1738888667IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000294011.36817271
Withdraw All217882312025-02-06 15:02:3510 days ago1738854155IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000952074
Unlock217882292025-02-06 15:02:1110 days ago1738854131IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000840883.7501314
Deposit217555112025-02-02 1:20:2315 days ago1738459223IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000474332
Deposit217413292025-01-31 1:47:4717 days ago1738288067IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000717011.79206091
Withdraw All217396372025-01-30 20:07:2317 days ago1738267643IN
0x9b2B253D...8bEbEf8C6
0 ETH0.001023524.6330586
Unlock217396312025-01-30 20:06:1117 days ago1738267571IN
0x9b2B253D...8bEbEf8C6
0 ETH0.001095424.5391319
Claim217332912025-01-29 22:52:2318 days ago1738191143IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000500042.86508978
Unlock217332852025-01-29 22:51:1118 days ago1738191071IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000568072.87205265
Claim217035122025-01-25 19:07:5922 days ago1737832079IN
0x9b2B253D...8bEbEf8C6
0 ETH0.00101795.83229557
Unlock217035082025-01-25 19:07:1122 days ago1737832031IN
0x9b2B253D...8bEbEf8C6
0 ETH0.001229325.7205795
Withdraw All215902662025-01-09 23:40:4738 days ago1736466047IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000111593.61794997
Withdraw All215902642025-01-09 23:40:2338 days ago1736466023IN
0x9b2B253D...8bEbEf8C6
0 ETH0.000856863.6
Withdraw All215722752025-01-07 11:24:2340 days ago1736249063IN
0x9b2B253D...8bEbEf8C6
0 ETH0.001513836.85247934
Unlock215722712025-01-07 11:23:3540 days ago1736249015IN
0x9b2B253D...8bEbEf8C6
0 ETH0.001537766.85803208
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenPool

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 12 : TokenPool.sol
// SPDX-License-Identifier: GPLv3
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "./CakePool.sol";

contract TokenPool is CakePool {
    using SafeERC20 for IERC20;


    mapping(address => uint256) public userRewardDebt;
    mapping(address => uint256) public userRewardPending;

    uint256 public totalStakedAmount; // total stake amount.
    uint256 private bbcPerShare;
    uint8 private immutable tokenDecimals;

    /**
     * @notice Constructor
     * @param _token: Staking token contract
     * @param _masterchefV2: MasterChefV2 contract
     * @param _admin: address of the admin
     * @param _treasury: address of the treasury (collects fees)
     * @param _operator: address of operator
     * @param _pid: bbc pool ID in MasterChefV2
     */
    constructor(
        IERC20 _token,
        IMasterChefV2 _masterchefV2,
        address _admin,
        address _treasury,
        address _operator,
        uint256 _pid
    ) CakePool(_token, _masterchefV2, _admin, _treasury, _operator, _pid) {
        require(address(_token) != address(bbc), "Invalid token");
        tokenDecimals = IERC20Metadata(address(_token)).decimals();
        require(tokenDecimals<=18, "Unsupported decimals");
    }

    function toEther(uint256 _amount) internal view returns(uint256) {
        if(tokenDecimals < 18)
            return _amount * 10 ** (18 - tokenDecimals);
        else if(tokenDecimals > 18)
            return _amount / 10 ** (tokenDecimals - 18);
        return _amount;
    }
    
    function fromEther(uint256 _amount) internal view returns(uint256) {
        if(tokenDecimals < 18)
            return _amount / 10 ** (18 - tokenDecimals);
        else if(tokenDecimals > 18)
            return _amount * 10 ** (tokenDecimals - 18);
        return _amount;
    }

    /**
     * @notice Update user share when need to unlock or charges a fee.
     * @param _user: User address
     */
    function updateUserShare(address _user) internal override {
        UserInfo storage user = userInfo[_user];
        if (user.shares > 0) {
            if (user.locked) {
                // Calculate the user's current token amount and update related parameters.
                uint256 currentAmount = (balanceOf() * (user.shares)) /
                    totalShares -
                    user.userBoostedShare;
                totalBoostDebt -= user.userBoostedShare;
                user.userBoostedShare = 0;
                totalShares -= user.shares;
                //Charge a overdue fee after the free duration has expired.
                if (
                    !freeOverdueFeeUsers[_user] &&
                    ((user.lockEndTime + UNLOCK_FREE_DURATION) <
                        block.timestamp)
                ) {
                    uint256 earnAmount = userRewardPending[_user];
                    uint256 overdueDuration = block.timestamp -
                        user.lockEndTime -
                        UNLOCK_FREE_DURATION;
                    if (overdueDuration > DURATION_FACTOR_OVERDUE) {
                        overdueDuration = DURATION_FACTOR_OVERDUE;
                    }
                    // Rates are calculated based on the user's overdue duration.
                    uint256 overdueWeight = (overdueDuration * overdueFee) /
                        DURATION_FACTOR_OVERDUE;
                    uint256 currentOverdueFee = (earnAmount * overdueWeight) /
                        PRECISION_FACTOR;
                    uint256 feeHalf = currentOverdueFee / 2;
                    bbc.safeTransfer(treasury, feeHalf);
                    bbc.safeTransfer(
                        address(0xdead),
                        currentOverdueFee - feeHalf
                    );
                    userRewardPending[_user] -= currentOverdueFee;
                }
                // Recalculate the user's share.
                uint256 pool = balanceOf();
                uint256 currentShares;
                if (totalShares != 0) {
                    currentShares =
                        (currentAmount * totalShares) /
                        (pool - currentAmount);
                } else {
                    currentShares = currentAmount;
                }
                user.shares = currentShares;
                totalShares += currentShares;
                // After the lock duration, update related parameters.
                if (user.lockEndTime < block.timestamp) {
                    user.locked = false;
                    user.lockStartTime = 0;
                    user.lockEndTime = 0;
                    totalLockedAmount -= user.lockedAmount;
                    user.lockedAmount = 0;
                    emit Unlock(_user, currentAmount, block.timestamp);
                }
            } else if (!freePerformanceFeeUsers[_user]) {
                // Calculate Performance fee.
                uint256 earnAmount = userRewardPending[_user];
                uint256 currentPerformanceFee = (earnAmount *
                    performanceFee) / FEE_RATE_SCALE;
                if (currentPerformanceFee > 0) {
                    bbc.safeTransfer(treasury, currentPerformanceFee);
                    userRewardPending[_user] -= currentPerformanceFee;
                }
            }
        }
    }


    /**
     * @notice The operation of deposite.
     * @param _amount: number of tokens to deposit (in BBC)
     * @param _lockDuration: Token lock duration
     * @param _user: User address
     */
    function depositOperation(
        uint256 _amount,
        uint256 _lockDuration,
        address _user
    ) internal override {
        UserInfo storage user = userInfo[_user];
        if (user.shares == 0 || _amount > 0) {
            require(toEther(_amount) > MIN_DEPOSIT_AMOUNT, "Deposit amount must be greater than MIN_DEPOSIT_AMOUNT");
        }
        // Calculate the total lock duration and check whether the lock duration meets the conditions.
        uint256 totalLockDuration = _lockDuration;
        uint256 userLockEndTime = user.lockEndTime;
        if (userLockEndTime >= block.timestamp) {
            // Adding funds during the lock duration is equivalent to re-locking the position, needs to update some variables.
            if (_amount > 0) {
                user.lockStartTime = block.timestamp;
                totalLockedAmount -= user.lockedAmount;
                user.lockedAmount = 0;
            }
            totalLockDuration += userLockEndTime - user.lockStartTime;
        }
        require(
            _lockDuration == 0 || totalLockDuration >= MIN_LOCK_DURATION,
            "Minimum lock period is one week"
        );
        require(
            totalLockDuration <= MAX_LOCK_DURATION,
            "Maximum lock period exceeded"
        );

        // Harvest tokens from Masterchef.
        uint256 harvestedAmount = harvest();

        // Handle stock funds.
        if (totalShares == 0) {
            uint256 stockAmount = bbc.balanceOf(address(this));
            bbc.safeTransfer(treasury, stockAmount);
            harvestedAmount = 0;
        } else {
            bbcPerShare += (harvestedAmount * 1 ether) / totalShares;
            if (user.shares > 0) {
                userRewardPending[_user] +=
                    (bbcPerShare * user.shares) /
                    1 ether -
                    userRewardDebt[_user];
            }
        }

        // Update user share.
        updateUserShare(_user);

        // Update lock duration.
        if (_lockDuration > 0) {
            if (userLockEndTime < block.timestamp) {
                user.lockStartTime = block.timestamp;
                userLockEndTime = block.timestamp + _lockDuration;
            } else {
                userLockEndTime += _lockDuration;
            }
            user.locked = true;
            user.lockEndTime = userLockEndTime;
        }

        uint256 currentShares;
        uint256 currentAmount;
        uint256 userCurrentLockedBalance;
        uint256 pool = balanceOf();
        if (_amount > 0) {
            token.safeTransferFrom(_user, address(this), _amount);
            currentAmount = _amount;
        }

        // Calculate lock funds
        if (user.shares > 0 && user.locked) {
            userCurrentLockedBalance = (pool * user.shares) / totalShares;
            currentAmount += userCurrentLockedBalance;
            totalShares -= user.shares;
            user.shares = 0;

            // Update lock amount
            if (user.lockStartTime == block.timestamp) {
                user.lockedAmount = userCurrentLockedBalance;
                totalLockedAmount += user.lockedAmount;
            }
        }
        if (totalShares != 0) {
            currentShares =
                (currentAmount * totalShares) /
                (pool - userCurrentLockedBalance);
        } else {
            currentShares = currentAmount;
        }

        // Calculate the boost weight share.
        if (userLockEndTime > user.lockStartTime) {
            // Calculate boost share.
            uint256 boostWeight = ((userLockEndTime - user.lockStartTime) *
                BOOST_WEIGHT) / DURATION_FACTOR;
            uint256 boostShares = (boostWeight * currentShares) /
                PRECISION_FACTOR;
            currentShares += boostShares;
            user.shares += currentShares;

            // Calculate boost share , the user only enjoys the reward, so the principal needs to be recorded as a debt.
            uint256 userBoostedShare = (boostWeight * currentAmount) /
                PRECISION_FACTOR;
            user.userBoostedShare += userBoostedShare;
            totalBoostDebt += userBoostedShare;

            // Update lock amount.
            user.lockedAmount += _amount;
            totalLockedAmount += _amount;

            emit Lock(
                _user,
                user.lockedAmount,
                user.shares,
                (userLockEndTime - user.lockStartTime),
                block.timestamp
            );
        } else {
            user.shares += currentShares;
        }

        if (_amount > 0 || _lockDuration > 0) {
            user.lastDepositedTime = block.timestamp;
        }
        totalShares += currentShares;

        user.lastUserActionAmount =
            (user.shares * balanceOf()) /
            totalShares -
            user.userBoostedShare;

        user.lastUserActionTime = block.timestamp;

        userRewardDebt[_user] = (bbcPerShare * user.shares) / 1 ether;
        totalStakedAmount += _amount;

        emit Deposit(
            _user,
            _amount,
            currentShares,
            _lockDuration,
            block.timestamp
        );
    }

    /**
     * @notice The operation of withdraw.
     * @param _shares: Number of shares to withdraw
     * @param _amount: Number of amount to withdraw
     */
    function withdrawOperation(uint256 _shares, uint256 _amount) internal override {
        UserInfo storage user = userInfo[msg.sender];
        if(_shares==0 && _amount > 0)
            require(toEther(_amount) > MIN_WITHDRAW_AMOUNT, "Withdraw amount must be greater than MIN_WITHDRAW_AMOUNT");
        require(_shares <= user.shares, "Withdraw amount exceeds balance");
        require(user.lockEndTime < block.timestamp, "Still in lock");

        // Calculate the percent of withdraw shares, when unlocking or calculating the Performance fee, the shares will be updated.
        uint256 currentShare = _shares;
        uint256 sharesPercent = (_shares * PRECISION_FACTOR_SHARE) /
            user.shares;

        // Harvest token from MasterchefV2.
        uint256 harvestedAmount = harvest();

        if (totalShares > 0) {
            bbcPerShare += (harvestedAmount * 1 ether) / totalShares;
            if (user.shares > 0) {
                userRewardPending[msg.sender] +=
                    (bbcPerShare * user.shares) /
                    1 ether -
                    userRewardDebt[msg.sender];
            }
        }

        // Update user share.
        updateUserShare(msg.sender);

        if (_shares == 0 && _amount > 0) {
            uint256 pool = balanceOf();
            currentShare = (_amount * totalShares) / pool; // Calculate equivalent shares
            if (currentShare > user.shares) {
                currentShare = user.shares;
            }
        } else {
            currentShare =
                (sharesPercent * user.shares) /
                PRECISION_FACTOR_SHARE;
        }
        
        uint256 currentAmount = (balanceOf() * currentShare) / totalShares;
        user.shares -= currentShare;
        totalShares -= currentShare;

        uint256 senderRewardPending = userRewardPending[msg.sender];
        if (user.shares == 0 && senderRewardPending > 0) {
            bbc.safeTransfer(msg.sender, senderRewardPending);
            userRewardPending[msg.sender] = 0;
        }
        totalStakedAmount -= currentAmount;

        // Calculate withdraw fee
        if (
            !freeWithdrawFeeUsers[msg.sender] &&
            (block.timestamp < user.lastDepositedTime + withdrawFeePeriod)
        ) {
            uint256 currentWithdrawFee = (currentAmount * withdrawFee) /
                FEE_RATE_SCALE;
            token.safeTransfer(treasury, currentWithdrawFee);
            currentAmount -= currentWithdrawFee;
        }
        token.safeTransfer(msg.sender, currentAmount);

        if (user.shares > 0) {
            user.lastUserActionAmount =
                (user.shares * balanceOf()) /
                totalShares;
        } else {
            user.lastUserActionAmount = 0;
        }

        user.lastUserActionTime = block.timestamp;
        userRewardDebt[msg.sender] = (bbcPerShare * user.shares) / 1 ether;

        emit Withdraw(msg.sender, currentAmount, currentShare);
    }

    function claim() public nonReentrant returns (uint256) {
        UserInfo storage user = userInfo[msg.sender];
        if (!user.locked) {
            uint256 harvestedAmount = harvest();
            bbcPerShare += (harvestedAmount * 1 ether) / totalShares;
            uint256 currentBBCAmount = userRewardPending[msg.sender] +
                (bbcPerShare * user.shares) /
                1 ether -
                userRewardDebt[msg.sender];
            if (currentBBCAmount > 0) {
                userRewardPending[msg.sender] = 0;

                if (!freePerformanceFeeUsers[msg.sender]) {
                    uint256 currentPerformanceFee = (currentBBCAmount *
                        performanceFee) / FEE_RATE_SCALE;

                    if (currentPerformanceFee > 0) {
                        currentBBCAmount -= currentPerformanceFee;
                        bbc.safeTransfer(treasury, currentPerformanceFee);
                    }
                }
                bbc.safeTransfer(msg.sender, currentBBCAmount);
            }
            userRewardDebt[msg.sender] =
                (bbcPerShare * user.shares) /
                1 ether;
            return currentBBCAmount;
        }
        return 0;
    }


    function getPricePerFullShare() public override view returns (uint256) {
        return
            totalShares == 0
                ? 1e18
                : ((bbc.balanceOf(address(this)) + calculateTotalPendingBBCRewards()) * 1e18 / totalShares);
    }

    function getProfit(address _user) public override view returns (uint256) {
        UserInfo storage user = userInfo[_user];
        if (user.shares == 0) return 0;
        return
            (calculateTotalPendingBBCRewards() * user.shares) /
            totalShares +
            userRewardPending[_user] +
            (bbcPerShare * user.shares) /
            1 ether -
            userRewardDebt[_user];
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 3 of 12 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 5 of 12 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 6 of 12 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 7 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 8 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 9 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 10 of 12 : 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 11 of 12 : IMasterChefV2.sol
// SPDX-License-Identifier: GPLv3
pragma solidity 0.8.19;

interface IMasterChefV2 {
    function BBC() external view returns (address);

    function deposit(uint256 _pid, uint256 _amount) external;

    function withdraw(uint256 _pid, uint256 _amount) external;

    function pendingBBC(
        uint256 _pid,
        address _user
    ) external view returns (uint256);

    function userInfo(
        uint256 _pid,
        address _user
    ) external view returns (uint256, uint256, uint256);

    function emergencyWithdraw(uint256 _pid) external;

    function lpToken(uint256 _pid) external view returns (address);

    function poolLength() external view returns (uint256 pools);

    function getBoostMultiplier(
        address _user,
        uint256 _pid
    ) external view returns (uint256);

    function updateBoostMultiplier(
        address _user,
        uint256 _pid,
        uint256 _newMultiplier
    ) external;
}

File 12 of 12 : CakePool.sol
// SPDX-License-Identifier: GPLv3
pragma solidity 0.8.19;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "../farm/interfaces/IMasterChefV2.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract CakePool is Ownable, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    struct UserInfo {
        uint256 shares; // number of shares for a user.
        uint256 lastDepositedTime; // keep track of deposited time for potential penalty.
        uint256 lastUserActionAmount; // keep track of token deposited at the last user action.
        uint256 lastUserActionTime; // keep track of the last user action time.
        uint256 lockStartTime; // lock start time.
        uint256 lockEndTime; // lock end time.
        uint256 userBoostedShare; // boost share, in order to give the user higher reward. The user only enjoys the reward, so the principal needs to be recorded as a debt.
        bool locked; //lock status.
        uint256 lockedAmount; // amount deposited during lock period.
    }

    IERC20 public immutable token; // staking token.
    IERC20 public immutable bbc; // earning token.

    IMasterChefV2 public immutable masterchefV2;

    mapping(address => UserInfo) public userInfo;
    mapping(address => bool) public freePerformanceFeeUsers; // free performance fee users.
    mapping(address => bool) public freeWithdrawFeeUsers; // free withdraw fee users.
    mapping(address => bool) public freeOverdueFeeUsers; // free overdue fee users.

    uint256 public totalShares;
    address public admin;
    address public treasury;
    address public operator;
    uint256 public bbcPoolPID;
    uint256 public totalBoostDebt; // total boost debt.
    uint256 public totalLockedAmount; // total lock amount.

    uint256 public constant MAX_PERFORMANCE_FEE = 2000; // 20%
    uint256 public constant MAX_WITHDRAW_FEE = 500; // 5%
    uint256 public constant MAX_OVERDUE_FEE = 100 * 1e10; // 100%
    uint256 public constant MAX_WITHDRAW_FEE_PERIOD = 1 weeks; // 1 week
    uint256 public constant MIN_LOCK_DURATION = 1 weeks; // 1 week
    uint256 public constant MAX_LOCK_DURATION_LIMIT = 1000 days; // 1000 days
    uint256 public constant BOOST_WEIGHT_LIMIT = 5000 * 1e10; // 5000%
    uint256 public constant PRECISION_FACTOR = 1e12; // precision factor.
    uint256 public constant PRECISION_FACTOR_SHARE = 1e28; // precision factor for share.
    uint256 public constant MIN_DEPOSIT_AMOUNT = 0.00001 ether;
    uint256 public constant MIN_WITHDRAW_AMOUNT = 0.00001 ether;
    uint256 public UNLOCK_FREE_DURATION = 2 weeks; // 2 week
    uint256 public MAX_LOCK_DURATION = 365 days; // 365 days
    uint256 public DURATION_FACTOR = 365 days; // 365 days, in order to calculate user additional boost.
    uint256 public DURATION_FACTOR_OVERDUE = 90 days; // 90 days, in order to calculate overdue fee.
    uint256 public BOOST_WEIGHT = 2000 * 1e10; // 2000%
    uint256 public constant FEE_RATE_SCALE = 10000;

    uint256 public performanceFee = 200; // 2%
    uint256 public withdrawFee = 400; // 4%
    uint256 public overdueFee = 100 * 1e10; // 100%
    uint256 public withdrawFeePeriod = 72 hours; // 3 days

    event Deposit(
        address indexed sender,
        uint256 amount,
        uint256 shares,
        uint256 duration,
        uint256 lastDepositedTime
    );
    event Withdraw(address indexed sender, uint256 amount, uint256 shares);
    event Harvest(address indexed sender, uint256 amount);
    event Pause();
    event Unpause();
    event Init();
    event Lock(
        address indexed sender,
        uint256 lockedAmount,
        uint256 shares,
        uint256 lockedDuration,
        uint256 blockTimestamp
    );
    event Unlock(
        address indexed sender,
        uint256 amount,
        uint256 blockTimestamp
    );
    event NewAdmin(address admin);
    event NewTreasury(address treasury);
    event NewOperator(address operator);
    event FreeFeeUser(address indexed user, bool indexed free);
    event NewPerformanceFee(uint256 performanceFee);
    event NewWithdrawFee(uint256 withdrawFee);
    event NewOverdueFee(uint256 overdueFee);
    event NewWithdrawFeePeriod(uint256 withdrawFeePeriod);
    event NewMaxLockDuration(uint256 maxLockDuration);
    event NewDurationFactor(uint256 durationFactor);
    event NewDurationFactorOverdue(uint256 durationFactorOverdue);
    event NewUnlockFreeDuration(uint256 unlockFreeDuration);
    event NewBoostWeight(uint256 boostWeight);

    /**
     * @notice Constructor
     * @param _token: Staking token contract
     * @param _masterchefV2: MasterChefV2 contract
     * @param _admin: address of the admin
     * @param _treasury: address of the treasury (collects fees)
     * @param _operator: address of operator
     * @param _pid: bbc pool ID in MasterChefV2
     */
    constructor(
        IERC20 _token,
        IMasterChefV2 _masterchefV2,
        address _admin,
        address _treasury,
        address _operator,
        uint256 _pid
    ) {
        require(address(_token) != address(0), "Invalid token");
        require(address(_masterchefV2) != address(0), "Invalid masterchefV2");
        require(_admin != address(0), "Invalid admin");
        require(_treasury != address(0), "Invalid treasury");
        require(_operator != address(0), "Invalid operator");
        token = _token;
        bbc = IERC20(_masterchefV2.BBC());
        masterchefV2 = _masterchefV2;
        admin = _admin;
        treasury = _treasury;
        operator = _operator;
        bbcPoolPID = _pid;
    }

    /**
     * @notice Deposits a dummy token to `MASTER_CHEF` MCV2.
     * It will transfer all the `dummyToken` in the msg sender address.
     * @param dummyToken The address of the token to be deposited into MCV2.
     */
    function init(IERC20 dummyToken, uint256 amount) public onlyOwner {
        uint256 balance = dummyToken.balanceOf(msg.sender);
        require(balance != 0, "Balance must exceed 0");
        if (amount == 0 || amount > balance) amount = balance;
        dummyToken.safeTransferFrom(msg.sender, address(this), amount);
        dummyToken.approve(address(masterchefV2), amount);
        masterchefV2.deposit(bbcPoolPID, amount);
        emit Init();
    }

    function close() public onlyOwner {
        masterchefV2.emergencyWithdraw(bbcPoolPID);
    }

    /**
     * @notice Checks if the msg.sender is the admin address.
     */
    modifier onlyAdmin() {
        require(msg.sender == admin, "admin: wut?");
        _;
    }

    /**
     * @notice Checks if the msg.sender is either the bbc owner address or the operator address.
     */
    modifier onlyOperatorOrBBCOwner(address _user) {
        require(
            msg.sender == _user || msg.sender == operator,
            "Not operator or bbc owner"
        );
        _;
    }

    /**
     * @notice Update user share When need to unlock or charges a fee.
     * @param _user: User address
     */
    function updateUserShare(address _user) internal virtual {
        UserInfo storage user = userInfo[_user];
        if (user.shares > 0) {
            if (user.locked) {
                // Calculate the user's current token amount and update related parameters.
                uint256 currentAmount = (balanceOf() * (user.shares)) /
                    totalShares -
                    user.userBoostedShare;
                totalBoostDebt -= user.userBoostedShare;
                user.userBoostedShare = 0;
                totalShares -= user.shares;
                //Charge a overdue fee after the free duration has expired.
                if (
                    !freeOverdueFeeUsers[_user] &&
                    ((user.lockEndTime + UNLOCK_FREE_DURATION) <
                        block.timestamp)
                ) {
                    uint256 earnAmount = currentAmount - user.lockedAmount;
                    uint256 overdueDuration = block.timestamp -
                        user.lockEndTime -
                        UNLOCK_FREE_DURATION;
                    if (overdueDuration > DURATION_FACTOR_OVERDUE) {
                        overdueDuration = DURATION_FACTOR_OVERDUE;
                    }
                    // Rates are calculated based on the user's overdue duration.
                    uint256 overdueWeight = (overdueDuration * overdueFee) /
                        DURATION_FACTOR_OVERDUE;
                    uint256 currentOverdueFee = (earnAmount * overdueWeight) /
                        PRECISION_FACTOR;
                    uint256 feeHalf = currentOverdueFee / 2;
                    bbc.safeTransfer(treasury, feeHalf);
                    bbc.safeTransfer(
                        address(0xdead),
                        currentOverdueFee - feeHalf
                    );
                    currentAmount -= currentOverdueFee;
                }
                // Recalculate the user's share.
                uint256 pool = balanceOf();
                uint256 currentShares;
                if (totalShares != 0) {
                    currentShares =
                        (currentAmount * totalShares) /
                        (pool - currentAmount);
                } else {
                    currentShares = currentAmount;
                }
                user.shares = currentShares;
                totalShares += currentShares;
                // After the lock duration, update related parameters.
                if (user.lockEndTime < block.timestamp) {
                    user.locked = false;
                    user.lockStartTime = 0;
                    user.lockEndTime = 0;
                    totalLockedAmount -= user.lockedAmount;
                    user.lockedAmount = 0;
                    emit Unlock(_user, currentAmount, block.timestamp);
                }
            } else if (!freePerformanceFeeUsers[_user]) {
                // Calculate Performance fee.
                uint256 totalAmount = (user.shares * balanceOf()) / totalShares;
                totalShares -= user.shares;
                user.shares = 0;
                uint256 earnAmount = totalAmount -
                    user.lastUserActionAmount;
                uint256 currentPerformanceFee = (earnAmount *
                    performanceFee) / FEE_RATE_SCALE;
                if (currentPerformanceFee > 0) {
                    bbc.safeTransfer(treasury, currentPerformanceFee);
                    totalAmount -= currentPerformanceFee;
                }
                // Recalculate the user's share.
                uint256 pool = balanceOf();
                uint256 newShares;
                if (totalShares != 0) {
                    newShares =
                        (totalAmount * totalShares) /
                        (pool - totalAmount);
                } else {
                    newShares = totalAmount;
                }
                user.shares = newShares;
                totalShares += newShares;
            }
        }
    }

    /**
     * @notice Unlock user bbc funds.
     * @dev Only possible when contract not paused.
     * @param _user: User address
     */
    function unlock(
        address _user
    ) public onlyOperatorOrBBCOwner(_user) whenNotPaused nonReentrant {
        UserInfo storage user = userInfo[_user];
        require(
            user.locked && user.lockEndTime < block.timestamp,
            "Cannot unlock yet"
        );
        depositOperation(0, 0, _user);
    }

    /**
     * @notice Deposit funds into the BBC Pool.
     * @dev Only possible when contract not paused.
     * @param _amount: number of tokens to deposit (in BBC)
     * @param _lockDuration: Token lock duration
     */
    function deposit(
        uint256 _amount,
        uint256 _lockDuration
    ) public whenNotPaused nonReentrant {
        require(_amount > 0 || _lockDuration > 0, "Nothing to deposit");
        depositOperation(_amount, _lockDuration, msg.sender);
    }

    /**
     * @notice The operation of deposite.
     * @param _amount: number of tokens to deposit (in BBC)
     * @param _lockDuration: Token lock duration
     * @param _user: User address
     */
    function depositOperation(
        uint256 _amount,
        uint256 _lockDuration,
        address _user
    ) internal virtual {
        UserInfo storage user = userInfo[_user];
        if (user.shares == 0 || _amount > 0) {
            require(_amount > MIN_DEPOSIT_AMOUNT, "Deposit amount must be greater than MIN_DEPOSIT_AMOUNT");
        }
        // Calculate the total lock duration and check whether the lock duration meets the conditions.
        uint256 totalLockDuration = _lockDuration;
        uint256 userLockEndTime = user.lockEndTime;
        if (userLockEndTime >= block.timestamp) {
            // Adding funds during the lock duration is equivalent to re-locking the position, needs to update some variables.
            if (_amount > 0) {
                user.lockStartTime = block.timestamp;
                totalLockedAmount -= user.lockedAmount;
                user.lockedAmount = 0;
            }
            totalLockDuration += userLockEndTime - user.lockStartTime;
        }
        require(
            _lockDuration == 0 || totalLockDuration >= MIN_LOCK_DURATION,
            "Minimum lock period is one week"
        );
        require(
            totalLockDuration <= MAX_LOCK_DURATION,
            "Maximum lock period exceeded"
        );

        // Harvest tokens from Masterchef.
        harvest();

        // Handle stock funds.
        if (totalShares == 0) {
            uint256 stockAmount = bbc.balanceOf(address(this));
            bbc.safeTransfer(treasury, stockAmount);
        }
        // Update user share.
        updateUserShare(_user);

        // Update lock duration.
        if (_lockDuration > 0) {
            if (userLockEndTime < block.timestamp) {
                user.lockStartTime = block.timestamp;
                userLockEndTime = block.timestamp + _lockDuration;
            } else {
                userLockEndTime += _lockDuration;
            }
            user.locked = true;
            user.lockEndTime = userLockEndTime;
        }

        uint256 currentShares;
        uint256 currentAmount;
        uint256 userCurrentLockedBalance;
        uint256 pool = balanceOf();
        if (_amount > 0) {
            token.safeTransferFrom(_user, address(this), _amount);
            currentAmount = _amount;
        }

        // Calculate lock funds
        if (user.shares > 0 && user.locked) {
            userCurrentLockedBalance = (pool * user.shares) / totalShares;
            currentAmount += userCurrentLockedBalance;
            totalShares -= user.shares;
            user.shares = 0;

            // Update lock amount
            if (user.lockStartTime == block.timestamp) {
                user.lockedAmount = userCurrentLockedBalance;
                totalLockedAmount += userCurrentLockedBalance;
            }
        }
        if (totalShares != 0) {
            currentShares =
                (currentAmount * totalShares) /
                (pool - userCurrentLockedBalance);
        } else {
            currentShares = currentAmount;
        }

        // Calculate the boost weight share.
        if (userLockEndTime > user.lockStartTime) {
            // Calculate boost share.
            uint256 boostWeight = ((userLockEndTime - user.lockStartTime) *
                BOOST_WEIGHT) / DURATION_FACTOR;
            uint256 boostShares = (boostWeight * currentShares) /
                PRECISION_FACTOR;
            currentShares += boostShares;
            user.shares += currentShares;

            // Calculate boost share , the user only enjoys the reward, so the principal needs to be recorded as a debt.
            uint256 userBoostedShare = (boostWeight * currentAmount) /
                PRECISION_FACTOR;
            user.userBoostedShare += userBoostedShare;
            totalBoostDebt += userBoostedShare;

            // Update lock amount.
            user.lockedAmount += _amount;
            totalLockedAmount += _amount;

            emit Lock(
                _user,
                user.lockedAmount,
                user.shares,
                (userLockEndTime - user.lockStartTime),
                block.timestamp
            );
        } else {
            user.shares += currentShares;
        }

        if (_amount > 0 || _lockDuration > 0) {
            user.lastDepositedTime = block.timestamp;
        }
        totalShares += currentShares;

        user.lastUserActionAmount =
            (user.shares * balanceOf()) /
            totalShares -
            user.userBoostedShare;

        user.lastUserActionTime = block.timestamp;

        emit Deposit(
            _user,
            _amount,
            currentShares,
            _lockDuration,
            block.timestamp
        );
    }

    /**
     * @notice Withdraw funds from the BBC Pool.
     * @param _amount: Number of amount to withdraw
     */
    function withdrawByAmount(
        uint256 _amount
    ) public whenNotPaused nonReentrant {
        withdrawOperation(0, _amount);
    }

    /**
     * @notice Withdraw funds from the BBC Pool.
     * @param _shares: Number of shares to withdraw
     */
    function withdraw(uint256 _shares) public whenNotPaused nonReentrant {
        require(_shares > 0, "Nothing to withdraw");
        withdrawOperation(_shares, 0);
    }

    /**
     * @notice The operation of withdraw.
     * @param _shares: Number of shares to withdraw
     * @param _amount: Number of amount to withdraw
     */
	function withdrawOperation(uint256 _shares, uint256 _amount) internal virtual {
        UserInfo storage user = userInfo[msg.sender];
        if(_shares==0 && _amount > 0)
            require(_amount > MIN_WITHDRAW_AMOUNT, "Withdraw amount must be greater than MIN_WITHDRAW_AMOUNT");
        else
            require(_shares <= user.shares, "Withdraw amount exceeds balance");
        require(user.lockEndTime < block.timestamp, "Still in lock");

        // Calculate the percent of withdraw shares, when unlocking or calculating the Performance fee, the shares will be updated.
        uint256 currentShare = _shares;
        uint256 sharesPercent = (_shares * PRECISION_FACTOR_SHARE) /
            user.shares;

        // Harvest token from MasterchefV2.
        harvest();

        // Update user share.
        updateUserShare(msg.sender);

        if (_shares == 0 && _amount > 0) {
            uint256 pool = balanceOf();
            currentShare = (_amount * totalShares) / pool; // Calculate equivalent shares
            if (currentShare > user.shares) {
                currentShare = user.shares;
            }
        } else {
            currentShare =
                (sharesPercent * user.shares) /
                PRECISION_FACTOR_SHARE;
        }
        uint256 currentAmount = (balanceOf() * currentShare) / totalShares;
        user.shares -= currentShare;
        totalShares -= currentShare;

        // Calculate withdraw fee
        if (
            !freeWithdrawFeeUsers[msg.sender] &&
            (block.timestamp < user.lastDepositedTime + withdrawFeePeriod)
        ) {
            uint256 currentWithdrawFee = (currentAmount * withdrawFee) /
                FEE_RATE_SCALE;
            token.safeTransfer(treasury, currentWithdrawFee);
            currentAmount -= currentWithdrawFee;
        }
        token.safeTransfer(msg.sender, currentAmount);

        if (user.shares > 0) {
            user.lastUserActionAmount =
                (user.shares * balanceOf()) /
                totalShares;
        } else {
            user.lastUserActionAmount = 0;
        }

        user.lastUserActionTime = block.timestamp;

        emit Withdraw(msg.sender, currentAmount, currentShare);
    }

    /**
     * @notice Withdraw all funds for a user
     */
    function withdrawAll() public {
        withdraw(userInfo[msg.sender].shares);
    }

    /**
     * @notice Harvest pending BBC tokens from MasterChef
     */
    function harvest() internal returns (uint256) {
        uint256 pendingBBC = masterchefV2.pendingBBC(bbcPoolPID, address(this));
        if (pendingBBC > 0) {
            uint256 balBefore = bbc.balanceOf(address(this));
            masterchefV2.withdraw(bbcPoolPID, 0);
            uint256 balAfter = bbc.balanceOf(address(this));
            uint256 balInc = balAfter - balBefore;
            emit Harvest(msg.sender, balInc);
            return balInc;
        }
        return 0;
    }

    /**
     * @notice Set admin address
     * @dev Only callable by the contract owner.
     */
    function setAdmin(address _admin) public onlyOwner {
        require(_admin != address(0), "Cannot be zero address");
        admin = _admin;
        emit NewAdmin(admin);
    }

    /**
     * @notice Set treasury address
     * @dev Only callable by the contract owner.
     */
    function setTreasury(address _treasury) public onlyOwner {
        require(_treasury != address(0), "Cannot be zero address");
        treasury = _treasury;
        emit NewTreasury(treasury);
    }

    /**
     * @notice Set operator address
     * @dev Callable by the contract owner.
     */
    function setOperator(address _operator) public onlyOwner {
        require(_operator != address(0), "Cannot be zero address");
        operator = _operator;
        emit NewOperator(operator);
    }

    /**
     * @notice Set free performance fee address
     * @dev Only callable by the contract admin.
     * @param _user: User address
     * @param _free: true:free false:not free
     */
    function setFreePerformanceFeeUser(
        address _user,
        bool _free
    ) public onlyAdmin {
        require(_user != address(0), "Cannot be zero address");
        freePerformanceFeeUsers[_user] = _free;
        emit FreeFeeUser(_user, _free);
    }

    /**
     * @notice Set free overdue fee address
     * @dev Only callable by the contract admin.
     * @param _user: User address
     * @param _free: true:free false:not free
     */
    function setFreeOverdueFeeUser(address _user, bool _free) public onlyAdmin {
        require(_user != address(0), "Cannot be zero address");
        freeOverdueFeeUsers[_user] = _free;
        emit FreeFeeUser(_user, _free);
    }

    /**
     * @notice Set free withdraw fee address
     * @dev Only callable by the contract admin.
     * @param _user: User address
     * @param _free: true:free false:not free
     */
    function setFreeWithdrawFeeUser(address _user, bool _free) public onlyAdmin {
        require(_user != address(0), "Cannot be zero address");
        freeWithdrawFeeUsers[_user] = _free;
        emit FreeFeeUser(_user, _free);
    }

    /**
     * @notice Set performance fee
     * @dev Only callable by the contract admin.
     */
    function setPerformanceFee(uint256 _performanceFee) public onlyAdmin {
        require(
            _performanceFee <= MAX_PERFORMANCE_FEE,
            "performanceFee cannot be more than MAX_PERFORMANCE_FEE"
        );
        performanceFee = _performanceFee;
        emit NewPerformanceFee(performanceFee);
    }

    /**
     * @notice Set withdraw fee
     * @dev Only callable by the contract admin.
     */
    function setWithdrawFee(uint256 _withdrawFee) public onlyAdmin {
        require(
            _withdrawFee <= MAX_WITHDRAW_FEE,
            "withdrawFee cannot be more than MAX_WITHDRAW_FEE"
        );
        withdrawFee = _withdrawFee;
        emit NewWithdrawFee(withdrawFee);
    }

    /**
     * @notice Set overdue fee
     * @dev Only callable by the contract admin.
     */
    function setOverdueFee(uint256 _overdueFee) public onlyAdmin {
        require(
            _overdueFee <= MAX_OVERDUE_FEE,
            "overdueFee cannot be more than MAX_OVERDUE_FEE"
        );
        overdueFee = _overdueFee;
        emit NewOverdueFee(_overdueFee);
    }

    /**
     * @notice Set withdraw fee period
     * @dev Only callable by the contract admin.
     */
    function setWithdrawFeePeriod(uint256 _withdrawFeePeriod) public onlyAdmin {
        require(
            _withdrawFeePeriod <= MAX_WITHDRAW_FEE_PERIOD,
            "withdrawFeePeriod cannot be more than MAX_WITHDRAW_FEE_PERIOD"
        );
        withdrawFeePeriod = _withdrawFeePeriod;
        emit NewWithdrawFeePeriod(withdrawFeePeriod);
    }

    /**
     * @notice Set MAX_LOCK_DURATION
     * @dev Only callable by the contract admin.
     */
    function setMaxLockDuration(uint256 _maxLockDuration) public onlyAdmin {
        require(
            _maxLockDuration <= MAX_LOCK_DURATION_LIMIT,
            "MAX_LOCK_DURATION cannot be more than MAX_LOCK_DURATION_LIMIT"
        );
        MAX_LOCK_DURATION = _maxLockDuration;
        emit NewMaxLockDuration(_maxLockDuration);
    }

    /**
     * @notice Set DURATION_FACTOR
     * @dev Only callable by the contract admin.
     */
    function setDurationFactor(uint256 _durationFactor) public onlyAdmin {
        require(_durationFactor > 0, "DURATION_FACTOR cannot be zero");
        DURATION_FACTOR = _durationFactor;
        emit NewDurationFactor(_durationFactor);
    }

    /**
     * @notice Set DURATION_FACTOR_OVERDUE
     * @dev Only callable by the contract admin.
     */
    function setDurationFactorOverdue(
        uint256 _durationFactorOverdue
    ) public onlyAdmin {
        require(
            _durationFactorOverdue > 0,
            "DURATION_FACTOR_OVERDUE cannot be zero"
        );
        DURATION_FACTOR_OVERDUE = _durationFactorOverdue;
        emit NewDurationFactorOverdue(_durationFactorOverdue);
    }

    /**
     * @notice Set UNLOCK_FREE_DURATION
     * @dev Only callable by the contract admin.
     */
    function setUnlockFreeDuration(
        uint256 _unlockFreeDuration
    ) public onlyAdmin {
        require(_unlockFreeDuration > 0, "UNLOCK_FREE_DURATION cannot be zero");
        UNLOCK_FREE_DURATION = _unlockFreeDuration;
        emit NewUnlockFreeDuration(_unlockFreeDuration);
    }

    /**
     * @notice Set BOOST_WEIGHT
     * @dev Only callable by the contract admin.
     */
    function setBoostWeight(uint256 _boostWeight) public onlyAdmin {
        require(
            _boostWeight <= BOOST_WEIGHT_LIMIT,
            "BOOST_WEIGHT cannot be more than BOOST_WEIGHT_LIMIT"
        );
        BOOST_WEIGHT = _boostWeight;
        emit NewBoostWeight(_boostWeight);
    }

    /**
     * @notice Withdraw unexpected tokens sent to the BBC Pool
     */
    function inCaseTokensGetStuck(address _token) public onlyAdmin {
        require(
            _token != address(token),
            "Token cannot be same as deposit token"
        );

        uint256 amount = IERC20(_token).balanceOf(address(this));
        IERC20(_token).safeTransfer(msg.sender, amount);
    }

    /**
     * @notice Trigger stopped state
     * @dev Only possible when contract not paused.
     */
    function pause() public onlyAdmin whenNotPaused {
        _pause();
        emit Pause();
    }

    /**
     * @notice Return to normal state
     * @dev Only possible when contract is paused.
     */
    function unpause() public onlyAdmin whenPaused {
        _unpause();
        emit Unpause();
    }

    /**
     * @notice Calculate Performance fee.
     * @param _user: User address
     * @return Returns Performance fee.
     */
    function calculatePerformanceFee(
        address _user
    ) public view returns (uint256) {
        UserInfo storage user = userInfo[_user];
        if (
            user.shares > 0 && !user.locked && !freePerformanceFeeUsers[_user]
        ) {
            uint256 earnAmount = getProfit(_user);
            uint256 currentPerformanceFee = (earnAmount * performanceFee) /
                FEE_RATE_SCALE;
            return currentPerformanceFee;
        }
        return 0;
    }

    /**
     * @notice Calculate overdue fee.
     * @param _user: User address
     * @return Returns Overdue fee.
     */
    function calculateOverdueFee(address _user) public view returns (uint256) {
        UserInfo storage user = userInfo[_user];
        if (
            user.shares > 0 &&
            user.locked &&
            !freeOverdueFeeUsers[_user] &&
            ((user.lockEndTime + UNLOCK_FREE_DURATION) < block.timestamp)
        ) {
            uint256 earnAmount = getProfit(_user);
            uint256 overdueDuration = block.timestamp -
                user.lockEndTime -
                UNLOCK_FREE_DURATION;
            if (overdueDuration > DURATION_FACTOR_OVERDUE) {
                overdueDuration = DURATION_FACTOR_OVERDUE;
            }
            // Rates are calculated based on the user's overdue duration.
            uint256 overdueWeight = (overdueDuration * overdueFee) /
                DURATION_FACTOR_OVERDUE;
            uint256 currentOverdueFee = (earnAmount * overdueWeight) /
                PRECISION_FACTOR;
            return currentOverdueFee;
        }
        return 0;
    }

    /**
     * @notice Calculate Performance Fee Or Overdue Fee
     * @param _user: User address
     * @return Returns  Performance Fee Or Overdue Fee.
     */
    function calculatePerformanceFeeOrOverdueFee(
        address _user
    ) internal view returns (uint256) {
        return calculatePerformanceFee(_user) + calculateOverdueFee(_user);
    }

    /**
     * @notice Calculate withdraw fee.
     * @param _user: User address
     * @param _shares: Number of shares to withdraw
     * @return Returns Withdraw fee.
     */
    function calculateWithdrawFee(
        address _user, 
        uint256 _shares
    ) public view returns (uint256) {
        UserInfo storage user = userInfo[_user];
        if (user.shares < _shares) {
            _shares = user.shares;
        }
        if (!freeWithdrawFeeUsers[msg.sender] && !user.locked && (block.timestamp < user.lastDepositedTime + withdrawFeePeriod)) {
            uint256 pool = balanceOf() + calculateTotalPendingBBCRewards();
            uint256 sharesPercent = (_shares * PRECISION_FACTOR) / user.shares;
            uint256 currentTotalAmount = (pool * (user.shares)) /
                totalShares -
                user.userBoostedShare -
                calculatePerformanceFeeOrOverdueFee(_user);
            uint256 currentAmount = (currentTotalAmount * sharesPercent) / PRECISION_FACTOR;
            uint256 currentWithdrawFee = (currentAmount * withdrawFee) / FEE_RATE_SCALE;
            return currentWithdrawFee;
        }
        return 0;
    }

    /**
     * @notice Calculates the total pending rewards that can be harvested
     * @return Returns total pending bbc rewards
     */
    function calculateTotalPendingBBCRewards() public view returns (uint256) {
        uint256 amount = masterchefV2.pendingBBC(bbcPoolPID, address(this));
        return amount;
    }

    function getPricePerFullShare() public virtual view returns (uint256) {
        return
            totalShares == 0
                ? 1e18
                : ((balanceOf() + calculateTotalPendingBBCRewards()) * 1e18 / totalShares);
    }

    function getProfit(address _user) public virtual view returns (uint256) {
        UserInfo storage user = userInfo[_user];
        if (user.shares == 0) return 0;
        uint256 pool = balanceOf() + calculateTotalPendingBBCRewards();
        if (user.locked) {
            uint256 currentAmount = (pool * user.shares) /
                totalShares -
                user.userBoostedShare;
            return currentAmount - user.lockedAmount;
        }
        return
            (user.shares * pool) / totalShares - user.lastUserActionAmount;
    }

    /**
     * @notice Current pool available balance
     * @dev The contract puts 100% of the tokens to work.
     */
    function available() public view returns (uint256) {
        return token.balanceOf(address(this));
    }

    /**
     * @notice Calculates the total underlying bbcs
     * @dev It includes bbcs held by the contract and the boost debt amount.
     */
    function balanceOf() public view returns (uint256) {
        return token.balanceOf(address(this)) + totalBoostDebt;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"contract IMasterChefV2","name":"_masterchefV2","type":"address"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_pid","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastDepositedTime","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"bool","name":"free","type":"bool"}],"name":"FreeFeeUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[],"name":"Init","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockedDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"NewAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"boostWeight","type":"uint256"}],"name":"NewBoostWeight","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"durationFactor","type":"uint256"}],"name":"NewDurationFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"durationFactorOverdue","type":"uint256"}],"name":"NewDurationFactorOverdue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxLockDuration","type":"uint256"}],"name":"NewMaxLockDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"NewOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"overdueFee","type":"uint256"}],"name":"NewOverdueFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"performanceFee","type":"uint256"}],"name":"NewPerformanceFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"NewTreasury","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"unlockFreeDuration","type":"uint256"}],"name":"NewUnlockFreeDuration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawFee","type":"uint256"}],"name":"NewWithdrawFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"withdrawFeePeriod","type":"uint256"}],"name":"NewWithdrawFeePeriod","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":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"Unlock","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BOOST_WEIGHT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BOOST_WEIGHT_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DURATION_FACTOR_OVERDUE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_RATE_SCALE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_LOCK_DURATION_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_OVERDUE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERFORMANCE_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAW_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAW_FEE_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DEPOSIT_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_WITHDRAW_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION_FACTOR_SHARE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNLOCK_FREE_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"available","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bbc","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bbcPoolPID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"calculateOverdueFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"calculatePerformanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculateTotalPendingBBCRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"calculateWithdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"close","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_lockDuration","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeOverdueFeeUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freePerformanceFeeUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeWithdrawFeeUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPricePerFullShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getProfit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"inCaseTokensGetStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"dummyToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"masterchefV2","outputs":[{"internalType":"contract IMasterChefV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"overdueFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_boostWeight","type":"uint256"}],"name":"setBoostWeight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_durationFactor","type":"uint256"}],"name":"setDurationFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_durationFactorOverdue","type":"uint256"}],"name":"setDurationFactorOverdue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_free","type":"bool"}],"name":"setFreeOverdueFeeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_free","type":"bool"}],"name":"setFreePerformanceFeeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_free","type":"bool"}],"name":"setFreeWithdrawFeeUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxLockDuration","type":"uint256"}],"name":"setMaxLockDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_overdueFee","type":"uint256"}],"name":"setOverdueFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_performanceFee","type":"uint256"}],"name":"setPerformanceFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unlockFreeDuration","type":"uint256"}],"name":"setUnlockFreeDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawFee","type":"uint256"}],"name":"setWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawFeePeriod","type":"uint256"}],"name":"setWithdrawFeePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBoostDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStakedAmount","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":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"lastDepositedTime","type":"uint256"},{"internalType":"uint256","name":"lastUserActionAmount","type":"uint256"},{"internalType":"uint256","name":"lastUserActionTime","type":"uint256"},{"internalType":"uint256","name":"lockStartTime","type":"uint256"},{"internalType":"uint256","name":"lockEndTime","type":"uint256"},{"internalType":"uint256","name":"userBoostedShare","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPending","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawByAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFeePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

61010060405262127500600d556301e13380600e556301e13380600f556276a7006010556512309ce5400060115560c860125561019060135564e8d4a510006014556203f4806015553480156200005557600080fd5b506040516200599a3803806200599a833981016040819052620000789162000467565b8585858585856200008933620003fe565b6000805460ff60a01b19169055600180556001600160a01b038616620000e65760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b60448201526064015b60405180910390fd5b6001600160a01b0385166200013e5760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964206d61737465726368656656320000000000000000000000006044820152606401620000dd565b6001600160a01b038416620001865760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21030b236b4b760991b6044820152606401620000dd565b6001600160a01b038316620001d15760405162461bcd60e51b815260206004820152601060248201526f496e76616c696420747265617375727960801b6044820152606401620000dd565b6001600160a01b0382166200021c5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21037b832b930ba37b960811b6044820152606401620000dd565b856001600160a01b03166080816001600160a01b031681525050846001600160a01b031663662d6d766040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000275573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029b9190620004ef565b6001600160a01b0390811660a081905295811660c052600780549582166001600160a01b03199687161790556008805494821694861694909417909355600980549284169290941691909117909255600a919091558816039050620003335760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b6044820152606401620000dd565b856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000372573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000398919062000516565b60ff1660e081905260121015620003f25760405162461bcd60e51b815260206004820152601460248201527f556e737570706f7274656420646563696d616c730000000000000000000000006044820152606401620000dd565b5050505050506200053b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200046457600080fd5b50565b60008060008060008060c087890312156200048157600080fd5b86516200048e816200044e565b6020880151909650620004a1816200044e565b6040880151909550620004b4816200044e565b6060880151909450620004c7816200044e565b6080880151909350620004da816200044e565b8092505060a087015190509295509295509295565b6000602082840312156200050257600080fd5b81516200050f816200044e565b9392505050565b6000602082840312156200052957600080fd5b815160ff811681146200050f57600080fd5b60805160a05160c05160e05161536f6200062b6000396000818161471f0152818161474c0152818161478b01526147ba0152600081816109ae015281816113960152818161144d015281816118dd015281816124cb01528181614301015261446201526000818161092901528181611b3f01528181611b8401528181611f6c0152818161360101528181613a4e01528181613aef015281816143a501528181614503015281816149af015281816149ff0152614c1f015260008181610ab40152818161198101528181611eb201528181612acd015281816136c3015281816137140152613c8e015261536f6000f3fe608060405234801561001057600080fd5b50600436106105145760003560e01c806387d4bda9116102a1578063c6ed51be1161016b578063e73008bc116100e3578063f786b95811610097578063fc0c546a1161007c578063fc0c546a14610aaf578063fc4477b414610ad6578063fd253b6414610adf57600080fd5b8063f786b95814610a7c578063f851a44014610a8f57600080fd5b8063f0f44260116100c8578063f0f4426014610a43578063f2fde38b14610a56578063f5c2e29c14610a6957600080fd5b8063e73008bc14610a31578063e941fa7814610a3a57600080fd5b8063dee838b11161013a578063df10b4e61161011f578063df10b4e614610a0c578063e2bbb15814610a15578063e464c62314610a2857600080fd5b8063dee838b1146109d9578063def68a9c146109f957600080fd5b8063c6ed51be14610996578063cb528b52146109a9578063ccd34cd5146108bc578063d4b0de2f146109d057600080fd5b8063aaada5da11610219578063b6ac642a116101cd578063bdca9165116101b2578063bdca916514610967578063c54d349c14610970578063c600e1dc1461098357600080fd5b8063b6ac642a1461094b578063bc75f4b81461095e57600080fd5b8063b3ab15fb116101fe578063b3ab15fb14610911578063b440458614610924578063b6857844146105fa57600080fd5b8063aaada5da146108ff578063acaf88cd1461090857600080fd5b8063948a03f211610270578063a3639b3911610255578063a3639b39146108db578063a3d09b4e146108ee578063a5834e06146108f657600080fd5b8063948a03f2146108bc57806395dc14e1146108c857600080fd5b806387d4bda91461085f5780638b48a05e146108825780638da5cb5b1461088b57806393c99e6a146108a957600080fd5b80634bf6f9e7116103e2578063704b6c021161035a57806377c7b8fc1161030e5780638456cb59116102f35780638456cb5914610846578063853828b61461084e578063877887821461085657600080fd5b806377c7b8fc1461083e57806378b4330f1461062d57600080fd5b8063715018a61161033f578063715018a61461081b578063722713f714610823578063731ff24a1461082b57600080fd5b8063704b6c02146107f557806370897b231461080857600080fd5b8063567e98f9116103b15780635c975abb116103965780635c975abb1461078f57806361d027b3146107b2578063668679ba146107d257600080fd5b8063567e98f914610741578063570ca7351461074a57600080fd5b80634bf6f9e7146106fd5780634e71d92d1461071d5780634f1bfc9e146107255780635521e9bf1461072e57600080fd5b80632f6c493c116104905780633f4ba83a11610444578063423b93ed11610429578063423b93ed146106da57806343d726d6146106ed57806348a0d754146106f557600080fd5b80633f4ba83a1461069f5780633fec4e32146106a757600080fd5b8063399ae72411610475578063399ae724146106705780633a98ef39146106835780633f4155021461068c57600080fd5b80632f6c493c1461064a578063359819211461065d57600080fd5b80631ea30fef116104e757806329a5cfd6116104cc57806329a5cfd61461061a5780632cfc5f011461062d5780632e1a7d4d1461063757600080fd5b80631ea30fef146105fa5780631efac1b81461060757600080fd5b806301e813261461051957806305a9f274146105375780630c59696b146105405780631959a00214610555575b600080fd5b6105246305265c0081565b6040519081526020015b60405180910390f35b610524600c5481565b61055361054e366004614f96565b610aec565b005b6105b4610563366004614fd1565b60026020819052600091825260409091208054600182015492820154600383015460048401546005850154600686015460078701546008909701549597969495939492939192909160ff9091169089565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c0840152151560e08301526101008201526101200161052e565b6105246509184e72a00081565b610553610615366004614f96565b610c43565b610524610628366004614fee565b610d8c565b61052462093a8081565b610553610645366004614f96565b610ed8565b610553610658366004614fd1565b610f69565b61055361066b366004614f96565b6110d7565b61055361067e366004614fee565b61121d565b61052460065481565b61055361069a366004615028565b6114ec565b610553611669565b6106ca6106b5366004614fd1565b60036020526000908152604090205460ff1681565b604051901515815260200161052e565b6105536106e8366004615028565b611725565b6105536118a2565b610524611950565b61052461070b366004614fd1565b60166020526000908152604090205481565b610524611a06565b610524600e5481565b61055361073c366004614f96565b611bf9565b61052460185481565b60095461076a9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161052e565b60005474010000000000000000000000000000000000000000900460ff166106ca565b60085461076a9073ffffffffffffffffffffffffffffffffffffffff1681565b6106ca6107e0366004614fd1565b60056020526000908152604090205460ff1681565b610553610803366004614fd1565b611c14565b610553610816366004614f96565b611d0c565b610553611e54565b610524611e68565b6105246b204fce5e3e2502611000000081565b610524611f27565b61055361201f565b6105536120db565b61052460125481565b6106ca61086d366004614fd1565b60046020526000908152604090205460ff1681565b61052461271081565b60005473ffffffffffffffffffffffffffffffffffffffff1661076a565b6105536108b7366004614f96565b6120f4565b61052464e8d4a5100081565b6105246108d6366004614fd1565b612240565b6105536108e9366004614f96565b612358565b610524612478565b61052460145481565b610524600d5481565b61052460105481565b61055361091f366004614fd1565b612536565b61076a7f000000000000000000000000000000000000000000000000000000000000000081565b610553610959366004614f96565b61262e565b61052460115481565b6105246107d081565b61055361097e366004614f96565b612776565b610524610991366004614fd1565b6128bc565b6105246109a4366004614fd1565b6129a6565b61076a7f000000000000000000000000000000000000000000000000000000000000000081565b6105246101f481565b6105246109e7366004614fd1565b60176020526000908152604090205481565b610553610a07366004614fd1565b612a4a565b61052460155481565b610553610a23366004615061565b612c5a565b610524600f5481565b610524600b5481565b61052460135481565b610553610a51366004614fd1565b612cf3565b610553610a64366004614fd1565b612deb565b610553610a77366004615028565b612e9f565b610553610a8a366004614f96565b61301c565b60075461076a9073ffffffffffffffffffffffffffffffffffffffff1681565b61076a7f000000000000000000000000000000000000000000000000000000000000000081565b610524600a5481565b610524652d79883d200081565b60075473ffffffffffffffffffffffffffffffffffffffff163314610b72576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f00000000000000000000000000000000000000000060448201526064015b60405180910390fd5b64e8d4a51000811115610c07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f6f7665726475654665652063616e6e6f74206265206d6f7265207468616e204d60448201527f41585f4f5645524455455f4645450000000000000000000000000000000000006064820152608401610b69565b60148190556040518181527ff4bd1c5978320077e792afbb3911e8cab1325ce28a6b3e67f9067a1d80692961906020015b60405180910390a150565b60075473ffffffffffffffffffffffffffffffffffffffff163314610cc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b62093a80811115610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f7769746864726177466565506572696f642063616e6e6f74206265206d6f726560448201527f207468616e204d41585f57495448445241575f4645455f504552494f440000006064820152608401610b69565b60158190556040518181527fb89ddaddb7435be26824cb48d2d0186c9525a2e1ec057abcb502704cdc0686cc90602001610c38565b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054831115610dbf57805492505b3360009081526004602052604090205460ff16158015610de45750600781015460ff16155b8015610e0057506015548160010154610dfd91906150b2565b42105b15610ecc576000610e0f612478565b610e17611e68565b610e2191906150b2565b8254909150600090610e3864e8d4a51000876150c5565b610e4291906150dc565b90506000610e4f87613166565b60068086015490548654610e6390876150c5565b610e6d91906150dc565b610e779190615117565b610e819190615117565b9050600064e8d4a51000610e9584846150c5565b610e9f91906150dc565b9050600061271060135483610eb491906150c5565b610ebe91906150dc565b9650610ed295505050505050565b60009150505b92915050565b610ee0613184565b610ee8613209565b60008111610f52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4e6f7468696e6720746f207769746864726177000000000000000000000000006044820152606401610b69565b610f5d81600061327c565b610f6660018055565b50565b803373ffffffffffffffffffffffffffffffffffffffff82161480610fa5575060095473ffffffffffffffffffffffffffffffffffffffff1633145b61100b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4e6f74206f70657261746f72206f7220626263206f776e6572000000000000006044820152606401610b69565b611013613184565b61101b613209565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600260205260409020600781015460ff1680156110575750428160050154105b6110bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43616e6e6f7420756e6c6f636b207965740000000000000000000000000000006044820152606401610b69565b6110c9600080856137f6565b506110d360018055565b5050565b60075473ffffffffffffffffffffffffffffffffffffffff163314611158576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b600081116111e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4455524154494f4e5f464143544f525f4f5645524455452063616e6e6f74206260448201527f65207a65726f00000000000000000000000000000000000000000000000000006064820152608401610b69565b60108190556040518181527f18b6d179114082d7eda9837e15a39eb30032d5f3df00487a67541398f48fabfe90602001610c38565b611225614050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015611292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b6919061512a565b905080600003611322576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f42616c616e6365206d75737420657863656564203000000000000000000000006044820152606401610b69565b81158061132e57508082115b15611337578091505b61135973ffffffffffffffffffffffffffffffffffffffff84163330856140d1565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820184905284169063095ea7b3906044016020604051808303816000875af11580156113ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114129190615143565b50600a546040517fe2bbb1580000000000000000000000000000000000000000000000000000000081526004810191909152602481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063e2bbb15890604401600060405180830381600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b50506040517f57a86f7d14ccde89e22870afe839e3011216827daa9b24e18629f0a1e9d6cc14925060009150a1505050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461156d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff82166115ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff821660008181526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f3d7902bc9a6665bd7caf4240b834bb805d3cd68256889e9f8d2e40a10be41d4491a35050565b60075473ffffffffffffffffffffffffffffffffffffffff1633146116ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6116f26141ad565b6116fa614231565b6040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60075473ffffffffffffffffffffffffffffffffffffffff1633146117a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff8216611823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff821660008181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f3d7902bc9a6665bd7caf4240b834bb805d3cd68256889e9f8d2e40a10be41d4491a35050565b6118aa614050565b600a546040517f5312ea8e00000000000000000000000000000000000000000000000000000000815260048101919091527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690635312ea8e90602401600060405180830381600087803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b50505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061512a565b905090565b6000611a10613209565b336000908152600260205260409020600781015460ff16611be7576000611a356142ae565b600654909150611a4d82670de0b6b3a76400006150c5565b611a5791906150dc565b60196000828254611a6891906150b2565b9091555050336000908152601660205260408120548354601954670de0b6b3a764000091611a95916150c5565b611a9f91906150dc565b33600090815260176020526040902054611ab991906150b2565b611ac39190615117565b90508015611bab57336000908152601760209081526040808320839055600390915290205460ff16611b6a57600061271060125483611b0291906150c5565b611b0c91906150dc565b90508015611b6857611b1e8183615117565b600854909250611b689073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116836145da565b505b611bab73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633836145da565b8254601954670de0b6b3a764000091611bc3916150c5565b611bcd91906150dc565b336000908152601660205260409020559250611bed915050565b60009150505b611bf660018055565b90565b611c01613184565b611c09613209565b610f5d60008261327c565b611c1c614050565b73ffffffffffffffffffffffffffffffffffffffff8116611c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c90602001610c38565b60075473ffffffffffffffffffffffffffffffffffffffff163314611d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6107d0811115611e1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f706572666f726d616e63654665652063616e6e6f74206265206d6f726520746860448201527f616e204d41585f504552464f524d414e43455f464545000000000000000000006064820152608401610b69565b60128190556040518181527fefeafcf03e479a9566d7ef321b4816de0ba19cfa3cd0fae2f8c5f4a0afb342c490602001610c38565b611e5c614050565b611e666000614635565b565b600b546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000919073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d919061512a565b611a0191906150b2565b600060065460001461201257600654611f3e612478565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015611fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fec919061512a565b611ff691906150b2565b61200890670de0b6b3a76400006150c5565b611a0191906150dc565b50670de0b6b3a764000090565b60075473ffffffffffffffffffffffffffffffffffffffff1633146120a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6120a8613184565b6120b06146aa565b6040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b33600090815260026020526040902054611e6690610ed8565b60075473ffffffffffffffffffffffffffffffffffffffff163314612175576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b652d79883d200081111561220b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f424f4f53545f5745494748542063616e6e6f74206265206d6f7265207468616e60448201527f20424f4f53545f5745494748545f4c494d4954000000000000000000000000006064820152608401610b69565b60118190556040518181527f7666dfff8c3377938e522b4eed3aff079973a976f95969db60a406d49f40da4e90602001610c38565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081208054158015906122795750600781015460ff165b80156122ab575073ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff16155b80156122c7575042600d5482600501546122c591906150b2565b105b1561234f5760006122d7846128bc565b90506000600d548360050154426122ee9190615117565b6122f89190615117565b905060105481111561230957506010545b60006010546014548361231c91906150c5565b61232691906150dc565b9050600064e8d4a5100061233a83866150c5565b61234491906150dc565b979650505050505050565b50600092915050565b60075473ffffffffffffffffffffffffffffffffffffffff1633146123d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b60008111612443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4455524154494f4e5f464143544f522063616e6e6f74206265207a65726f00006044820152606401610b69565b600f8190556040518181527f9478eb023aac0a7d58a4e935377056bf27cf5b72a2300725f831817a8f62fbde90602001610c38565b600a546040517fddaf5c4c0000000000000000000000000000000000000000000000000000000081526004810191909152306024820152600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063ddaf5c4c90604401602060405180830381865afa158015612512573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed2919061512a565b61253e614050565b73ffffffffffffffffffffffffffffffffffffffff81166125bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fda12ee837e6978172aaf54b16145ffe08414fd8710092ef033c71b8eb6ec189a90602001610c38565b60075473ffffffffffffffffffffffffffffffffffffffff1633146126af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6101f4811115612741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f77697468647261774665652063616e6e6f74206265206d6f7265207468616e2060448201527f4d41585f57495448445241575f464545000000000000000000000000000000006064820152608401610b69565b60138190556040518181527fd5fe46099fa396290a7f57e36c3c3c8774e2562c18ed5d1dcc0fa75071e03f1d90602001610c38565b60075473ffffffffffffffffffffffffffffffffffffffff1633146127f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b60008111612887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f554e4c4f434b5f465245455f4455524154494f4e2063616e6e6f74206265207a60448201527f65726f00000000000000000000000000000000000000000000000000000000006064820152608401610b69565b600d8190556040518181527ff84bf2b901cfc02956d4e69556d7448cef4ea13587e7714dba7c6d697091e7ad90602001610c38565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260408120805482036128f25750600092915050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152601660205260409020548154601954670de0b6b3a764000091612930916150c5565b61293a91906150dc565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260176020526040902054600654845461296d612478565b61297791906150c5565b61298191906150dc565b61298b91906150b2565b61299591906150b2565b61299f9190615117565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081208054158015906129e05750600781015460ff16155b8015612a12575073ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604090205460ff16155b1561234f576000612a22846128bc565b9050600061271060125483612a3791906150c5565b612a4191906150dc565b95945050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314612acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612ba6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f546f6b656e2063616e6e6f742062652073616d65206173206465706f7369742060448201527f746f6b656e0000000000000000000000000000000000000000000000000000006064820152608401610b69565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015612c13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c37919061512a565b90506110d373ffffffffffffffffffffffffffffffffffffffff831633836145da565b612c62613184565b612c6a613209565b6000821180612c795750600081115b612cdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e6f7468696e6720746f206465706f73697400000000000000000000000000006044820152606401610b69565b612cea8282336137f6565b6110d360018055565b612cfb614050565b73ffffffffffffffffffffffffffffffffffffffff8116612d78576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fafa147634b29e2c7bd53ce194256b9f41cfb9ba3036f2b822fdd1d965beea08690602001610c38565b612df3614050565b73ffffffffffffffffffffffffffffffffffffffff8116612e96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b69565b610f6681614635565b60075473ffffffffffffffffffffffffffffffffffffffff163314612f20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff8216612f9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff821660008181526004602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f3d7902bc9a6665bd7caf4240b834bb805d3cd68256889e9f8d2e40a10be41d4491a35050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461309d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6305265c00811115613131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4d41585f4c4f434b5f4455524154494f4e2063616e6e6f74206265206d6f726560448201527f207468616e204d41585f4c4f434b5f4455524154494f4e5f4c494d49540000006064820152608401610b69565b600e8190556040518181527fcab2f3455b51b6ca5377e84fccd0f890b6f6ca36c02e18b6d36cb34f469fe4fe90602001610c38565b600061317182612240565b61317a836129a6565b610ed291906150b2565b60005474010000000000000000000000000000000000000000900460ff1615611e66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610b69565b600260015403613275576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b69565b6002600155565b336000908152600260205260409020821580156132995750600082115b1561333b576509184e72a0006132ae83614719565b1161333b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f576974686472617720616d6f756e74206d75737420626520677265617465722060448201527f7468616e204d494e5f57495448445241575f414d4f554e5400000000000000006064820152608401610b69565b80548311156133a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f576974686472617720616d6f756e7420657863656564732062616c616e6365006044820152606401610b69565b42816005015410613413576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f5374696c6c20696e206c6f636b000000000000000000000000000000000000006044820152606401610b69565b805483906000906134306b204fce5e3e25026110000000846150c5565b61343a91906150dc565b905060006134466142ae565b600654909150156134ee5760065461346682670de0b6b3a76400006150c5565b61347091906150dc565b6019600082825461348191906150b2565b90915550508354156134ee57336000908152601660205260409020548454601954670de0b6b3a7640000916134b5916150c5565b6134bf91906150dc565b6134c99190615117565b33600090815260176020526040812080549091906134e89084906150b2565b90915550505b6134f7336147f7565b851580156135055750600085115b15613546576000613514611e68565b9050806006548761352591906150c5565b61352f91906150dc565b855490945084111561354057845493505b5061356d565b83546b204fce5e3e250261100000009061356090846150c5565b61356a91906150dc565b92505b60006006548461357b611e68565b61358591906150c5565b61358f91906150dc565b9050838560000160008282546135a59190615117565b9250508190555083600660008282546135be9190615117565b90915550503360009081526017602052604090205485541580156135e25750600081115b156136395761362873ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633836145da565b336000908152601760205260408120555b816018600082825461364b9190615117565b90915550503360009081526004602052604090205460ff161580156136805750601554866001015461367d91906150b2565b42105b156136fa5760006127106013548461369891906150c5565b6136a291906150dc565b6008549091506136ec9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116836145da565b6136f68184615117565b9250505b61373b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633846145da565b85541561376d5760065461374d611e68565b875461375991906150c5565b61376391906150dc565b6002870155613775565b600060028701555b4260038701558554601954670de0b6b3a764000091613793916150c5565b61379d91906150dc565b3360008181526016602090815260409182902093909355805185815292830188905290917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a25050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260409020805415806138295750600084115b156138cb576509184e72a00061383e85614719565b116138cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f4465706f73697420616d6f756e74206d7573742062652067726561746572207460448201527f68616e204d494e5f4445504f5349545f414d4f554e54000000000000000000006064820152608401610b69565b60058101548390428110613925578515613909574260048401556008830154600c80546000906138fc908490615117565b9091555050600060088401555b60048301546139189082615117565b61392290836150b2565b91505b841580613935575062093a808210155b61399b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e696d756d206c6f636b20706572696f64206973206f6e65207765656b006044820152606401610b69565b600e54821115613a07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d6178696d756d206c6f636b20706572696f64206578636565646564000000006044820152606401610b69565b6000613a116142ae565b9050600654600003613b22576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015613aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ace919061512a565b600854909150613b189073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116836145da565b6000915050613beb565b600654613b3782670de0b6b3a76400006150c5565b613b4191906150dc565b60196000828254613b5291906150b2565b9091555050835415613beb5773ffffffffffffffffffffffffffffffffffffffff85166000908152601660205260409020548454601954670de0b6b3a764000091613b9c916150c5565b613ba691906150dc565b613bb09190615117565b73ffffffffffffffffffffffffffffffffffffffff861660009081526017602052604081208054909190613be59084906150b2565b90915550505b613bf4856147f7565b8515613c5e5742821015613c1c574260048501819055613c159087906150b2565b9150613c29565b613c2686836150b2565b91505b6007840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055600584018290555b600080600080613c6c611e68565b90508a15613cba57613cb673ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168a308e6140d1565b8a92505b875415801590613cce5750600788015460ff165b15613d47576006548854613ce290836150c5565b613cec91906150dc565b9150613cf882846150b2565b9250876000015460066000828254613d109190615117565b9091555050600088556004880154429003613d475760088801829055600c8054839190600090613d419084906150b2565b90915550505b60065415613d7757613d598282615117565b600654613d6690856150c5565b613d7091906150dc565b9350613d7b565b8293505b8760040154861115613efb576000600f546011548a6004015489613d9f9190615117565b613da991906150c5565b613db391906150dc565b9050600064e8d4a51000613dc787846150c5565b613dd191906150dc565b9050613ddd81876150b2565b9550858a6000016000828254613df391906150b2565b909155506000905064e8d4a51000613e0b87856150c5565b613e1591906150dc565b9050808b6006016000828254613e2b91906150b2565b9250508190555080600b6000828254613e4491906150b2565b925050819055508d8b6008016000828254613e5f91906150b2565b925050819055508d600c6000828254613e7891906150b2565b909155505060088b01548b5460048d015473ffffffffffffffffffffffffffffffffffffffff8f16927f2b943276e5d747f6f7dd46d3b880d8874cb8d6b9b88ca1903990a2738e7dc7a1929091613ecf908e615117565b6040805193845260208401929092529082015242606082015260800160405180910390a2505050613f15565b83886000016000828254613f0f91906150b2565b90915550505b60008b1180613f24575060008a115b15613f30574260018901555b8360066000828254613f4291906150b2565b90915550506006808901549054613f57611e68565b8a54613f6391906150c5565b613f6d91906150dc565b613f779190615117565b60028901554260038901558754601954670de0b6b3a764000091613f9a916150c5565b613fa491906150dc565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260166020526040812091909155601880548d9290613fdf9084906150b2565b9091555050604080518c8152602081018690529081018b905242606082015273ffffffffffffffffffffffffffffffffffffffff8a16907f7162984403f6c73c8639375d45a9187dfd04602231bd8e587c415718b5f7e5f99060800160405180910390a25050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b69565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261194a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614c88565b60005474010000000000000000000000000000000000000000900460ff16611e66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610b69565b6142396141ad565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b600a546040517fddaf5c4c0000000000000000000000000000000000000000000000000000000081526004810191909152306024820152600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063ddaf5c4c90604401602060405180830381865afa158015614348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061436c919061512a565b905080156145d2576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015614401573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614425919061512a565b600a546040517f441a3e700000000000000000000000000000000000000000000000000000000081526004810191909152600060248201529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063441a3e7090604401600060405180830381600087803b1580156144bb57600080fd5b505af11580156144cf573d6000803e3d6000fd5b50506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600092507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1691506370a0823190602401602060405180830381865afa158015614560573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614584919061512a565b905060006145928383615117565b60405181815290915033907fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba9060200160405180910390a2949350505050565b600091505090565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526146309084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161412b565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6146b2613184565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586142843390565b600060127f000000000000000000000000000000000000000000000000000000000000000060ff161015614787576147727f00000000000000000000000000000000000000000000000000000000000000006012615160565b61477d90600a615299565b610ed290836150c5565b60127f000000000000000000000000000000000000000000000000000000000000000060ff1611156147f3576147de60127f0000000000000000000000000000000000000000000000000000000000000000615160565b6147e990600a615299565b610ed290836150dc565b5090565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090208054156110d357600781015460ff1615614b8857600081600601546006548360000154614847611e68565b61485191906150c5565b61485b91906150dc565b6148659190615117565b90508160060154600b600082825461487d9190615117565b9091555050600060068084018290558354815490929061489e908490615117565b909155505073ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff161580156148e9575042600d5483600501546148e791906150b2565b105b15614a665773ffffffffffffffffffffffffffffffffffffffff8316600090815260176020526040812054600d5460058501549192916149299042615117565b6149339190615117565b905060105481111561494457506010545b60006010546014548361495791906150c5565b61496191906150dc565b9050600064e8d4a5100061497583866150c5565b61497f91906150dc565b9050600061498e6002836150dc565b6008549091506149d89073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116836145da565b614a2661dead6149e88385615117565b73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001691906145da565b73ffffffffffffffffffffffffffffffffffffffff881660009081526017602052604081208054849290614a5b908490615117565b909155505050505050505b6000614a70611e68565b90506000600654600014614aa657614a888383615117565b600654614a9590856150c5565b614a9f91906150dc565b9050614aa9565b50815b80845560068054829190600090614ac19084906150b2565b90915550506005840154421115614b81576007840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600060048501819055600585018190556008850154600c805491929091614b24908490615117565b9091555050600060088501556040805184815242602082015273ffffffffffffffffffffffffffffffffffffffff8716917ff7870c5b224cbc19873599e46ccfc7103934650509b1af0c3ce90138377c2004910160405180910390a25b5050505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604090205460ff166110d35773ffffffffffffffffffffffffffffffffffffffff821660009081526017602052604081205460125490919061271090614bef90846150c5565b614bf991906150dc565b9050801561194a57600854614c489073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169116836145da565b73ffffffffffffffffffffffffffffffffffffffff841660009081526017602052604081208054839290614c7d908490615117565b909155505050505050565b6000614cea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16614d979092919063ffffffff16565b9050805160001480614d0b575080806020019051810190614d0b9190615143565b614630576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610b69565b6060614da68484600085614dae565b949350505050565b606082471015614e40576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610b69565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051614e6991906152cc565b60006040518083038185875af1925050503d8060008114614ea6576040519150601f19603f3d011682016040523d82523d6000602084013e614eab565b606091505b50915091506123448783838760608315614f4d578251600003614f465773ffffffffffffffffffffffffffffffffffffffff85163b614f46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b69565b5081614da6565b614da68383815115614f625781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6991906152e8565b600060208284031215614fa857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610f6657600080fd5b600060208284031215614fe357600080fd5b813561299f81614faf565b6000806040838503121561500157600080fd5b823561500c81614faf565b946020939093013593505050565b8015158114610f6657600080fd5b6000806040838503121561503b57600080fd5b823561504681614faf565b915060208301356150568161501a565b809150509250929050565b6000806040838503121561507457600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610ed257610ed2615083565b8082028115828204841417610ed257610ed2615083565b600082615112577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610ed257610ed2615083565b60006020828403121561513c57600080fd5b5051919050565b60006020828403121561515557600080fd5b815161299f8161501a565b60ff8281168282160390811115610ed257610ed2615083565b600181815b808511156151d257817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156151b8576151b8615083565b808516156151c557918102915b93841c939080029061517e565b509250929050565b6000826151e957506001610ed2565b816151f657506000610ed2565b816001811461520c576002811461521657615232565b6001915050610ed2565b60ff84111561522757615227615083565b50506001821b610ed2565b5060208310610133831016604e8410600b8410161715615255575081810a610ed2565b61525f8383615179565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561529157615291615083565b029392505050565b600061299f60ff8416836151da565b60005b838110156152c35781810151838201526020016152ab565b50506000910152565b600082516152de8184602087016152a8565b9190910192915050565b60208152600082518060208401526153078160408501602087016152a8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a392363a51b198551920ff8bf7e6aae98d6397086abb8d8407d4e6688aece8b964736f6c63430008130033000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a20000000000000000000000003fefd06828689252a69207718985b9a78350561f00000000000000000000000095fe70a9449d1e8276040d29a4fdf63b94246288000000000000000000000000b5c4d8671e03fba09d467c50fc51215b77ee54540000000000000000000000001d8ecef8fcaaa50f0326d9af768809a01aae61a90000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106105145760003560e01c806387d4bda9116102a1578063c6ed51be1161016b578063e73008bc116100e3578063f786b95811610097578063fc0c546a1161007c578063fc0c546a14610aaf578063fc4477b414610ad6578063fd253b6414610adf57600080fd5b8063f786b95814610a7c578063f851a44014610a8f57600080fd5b8063f0f44260116100c8578063f0f4426014610a43578063f2fde38b14610a56578063f5c2e29c14610a6957600080fd5b8063e73008bc14610a31578063e941fa7814610a3a57600080fd5b8063dee838b11161013a578063df10b4e61161011f578063df10b4e614610a0c578063e2bbb15814610a15578063e464c62314610a2857600080fd5b8063dee838b1146109d9578063def68a9c146109f957600080fd5b8063c6ed51be14610996578063cb528b52146109a9578063ccd34cd5146108bc578063d4b0de2f146109d057600080fd5b8063aaada5da11610219578063b6ac642a116101cd578063bdca9165116101b2578063bdca916514610967578063c54d349c14610970578063c600e1dc1461098357600080fd5b8063b6ac642a1461094b578063bc75f4b81461095e57600080fd5b8063b3ab15fb116101fe578063b3ab15fb14610911578063b440458614610924578063b6857844146105fa57600080fd5b8063aaada5da146108ff578063acaf88cd1461090857600080fd5b8063948a03f211610270578063a3639b3911610255578063a3639b39146108db578063a3d09b4e146108ee578063a5834e06146108f657600080fd5b8063948a03f2146108bc57806395dc14e1146108c857600080fd5b806387d4bda91461085f5780638b48a05e146108825780638da5cb5b1461088b57806393c99e6a146108a957600080fd5b80634bf6f9e7116103e2578063704b6c021161035a57806377c7b8fc1161030e5780638456cb59116102f35780638456cb5914610846578063853828b61461084e578063877887821461085657600080fd5b806377c7b8fc1461083e57806378b4330f1461062d57600080fd5b8063715018a61161033f578063715018a61461081b578063722713f714610823578063731ff24a1461082b57600080fd5b8063704b6c02146107f557806370897b231461080857600080fd5b8063567e98f9116103b15780635c975abb116103965780635c975abb1461078f57806361d027b3146107b2578063668679ba146107d257600080fd5b8063567e98f914610741578063570ca7351461074a57600080fd5b80634bf6f9e7146106fd5780634e71d92d1461071d5780634f1bfc9e146107255780635521e9bf1461072e57600080fd5b80632f6c493c116104905780633f4ba83a11610444578063423b93ed11610429578063423b93ed146106da57806343d726d6146106ed57806348a0d754146106f557600080fd5b80633f4ba83a1461069f5780633fec4e32146106a757600080fd5b8063399ae72411610475578063399ae724146106705780633a98ef39146106835780633f4155021461068c57600080fd5b80632f6c493c1461064a578063359819211461065d57600080fd5b80631ea30fef116104e757806329a5cfd6116104cc57806329a5cfd61461061a5780632cfc5f011461062d5780632e1a7d4d1461063757600080fd5b80631ea30fef146105fa5780631efac1b81461060757600080fd5b806301e813261461051957806305a9f274146105375780630c59696b146105405780631959a00214610555575b600080fd5b6105246305265c0081565b6040519081526020015b60405180910390f35b610524600c5481565b61055361054e366004614f96565b610aec565b005b6105b4610563366004614fd1565b60026020819052600091825260409091208054600182015492820154600383015460048401546005850154600686015460078701546008909701549597969495939492939192909160ff9091169089565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c0840152151560e08301526101008201526101200161052e565b6105246509184e72a00081565b610553610615366004614f96565b610c43565b610524610628366004614fee565b610d8c565b61052462093a8081565b610553610645366004614f96565b610ed8565b610553610658366004614fd1565b610f69565b61055361066b366004614f96565b6110d7565b61055361067e366004614fee565b61121d565b61052460065481565b61055361069a366004615028565b6114ec565b610553611669565b6106ca6106b5366004614fd1565b60036020526000908152604090205460ff1681565b604051901515815260200161052e565b6105536106e8366004615028565b611725565b6105536118a2565b610524611950565b61052461070b366004614fd1565b60166020526000908152604090205481565b610524611a06565b610524600e5481565b61055361073c366004614f96565b611bf9565b61052460185481565b60095461076a9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161052e565b60005474010000000000000000000000000000000000000000900460ff166106ca565b60085461076a9073ffffffffffffffffffffffffffffffffffffffff1681565b6106ca6107e0366004614fd1565b60056020526000908152604090205460ff1681565b610553610803366004614fd1565b611c14565b610553610816366004614f96565b611d0c565b610553611e54565b610524611e68565b6105246b204fce5e3e2502611000000081565b610524611f27565b61055361201f565b6105536120db565b61052460125481565b6106ca61086d366004614fd1565b60046020526000908152604090205460ff1681565b61052461271081565b60005473ffffffffffffffffffffffffffffffffffffffff1661076a565b6105536108b7366004614f96565b6120f4565b61052464e8d4a5100081565b6105246108d6366004614fd1565b612240565b6105536108e9366004614f96565b612358565b610524612478565b61052460145481565b610524600d5481565b61052460105481565b61055361091f366004614fd1565b612536565b61076a7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243681565b610553610959366004614f96565b61262e565b61052460115481565b6105246107d081565b61055361097e366004614f96565b612776565b610524610991366004614fd1565b6128bc565b6105246109a4366004614fd1565b6129a6565b61076a7f0000000000000000000000003fefd06828689252a69207718985b9a78350561f81565b6105246101f481565b6105246109e7366004614fd1565b60176020526000908152604090205481565b610553610a07366004614fd1565b612a4a565b61052460155481565b610553610a23366004615061565b612c5a565b610524600f5481565b610524600b5481565b61052460135481565b610553610a51366004614fd1565b612cf3565b610553610a64366004614fd1565b612deb565b610553610a77366004615028565b612e9f565b610553610a8a366004614f96565b61301c565b60075461076a9073ffffffffffffffffffffffffffffffffffffffff1681565b61076a7f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a281565b610524600a5481565b610524652d79883d200081565b60075473ffffffffffffffffffffffffffffffffffffffff163314610b72576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f00000000000000000000000000000000000000000060448201526064015b60405180910390fd5b64e8d4a51000811115610c07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f6f7665726475654665652063616e6e6f74206265206d6f7265207468616e204d60448201527f41585f4f5645524455455f4645450000000000000000000000000000000000006064820152608401610b69565b60148190556040518181527ff4bd1c5978320077e792afbb3911e8cab1325ce28a6b3e67f9067a1d80692961906020015b60405180910390a150565b60075473ffffffffffffffffffffffffffffffffffffffff163314610cc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b62093a80811115610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f7769746864726177466565506572696f642063616e6e6f74206265206d6f726560448201527f207468616e204d41585f57495448445241575f4645455f504552494f440000006064820152608401610b69565b60158190556040518181527fb89ddaddb7435be26824cb48d2d0186c9525a2e1ec057abcb502704cdc0686cc90602001610c38565b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604081208054831115610dbf57805492505b3360009081526004602052604090205460ff16158015610de45750600781015460ff16155b8015610e0057506015548160010154610dfd91906150b2565b42105b15610ecc576000610e0f612478565b610e17611e68565b610e2191906150b2565b8254909150600090610e3864e8d4a51000876150c5565b610e4291906150dc565b90506000610e4f87613166565b60068086015490548654610e6390876150c5565b610e6d91906150dc565b610e779190615117565b610e819190615117565b9050600064e8d4a51000610e9584846150c5565b610e9f91906150dc565b9050600061271060135483610eb491906150c5565b610ebe91906150dc565b9650610ed295505050505050565b60009150505b92915050565b610ee0613184565b610ee8613209565b60008111610f52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4e6f7468696e6720746f207769746864726177000000000000000000000000006044820152606401610b69565b610f5d81600061327c565b610f6660018055565b50565b803373ffffffffffffffffffffffffffffffffffffffff82161480610fa5575060095473ffffffffffffffffffffffffffffffffffffffff1633145b61100b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4e6f74206f70657261746f72206f7220626263206f776e6572000000000000006044820152606401610b69565b611013613184565b61101b613209565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600260205260409020600781015460ff1680156110575750428160050154105b6110bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43616e6e6f7420756e6c6f636b207965740000000000000000000000000000006044820152606401610b69565b6110c9600080856137f6565b506110d360018055565b5050565b60075473ffffffffffffffffffffffffffffffffffffffff163314611158576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b600081116111e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4455524154494f4e5f464143544f525f4f5645524455452063616e6e6f74206260448201527f65207a65726f00000000000000000000000000000000000000000000000000006064820152608401610b69565b60108190556040518181527f18b6d179114082d7eda9837e15a39eb30032d5f3df00487a67541398f48fabfe90602001610c38565b611225614050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015611292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b6919061512a565b905080600003611322576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f42616c616e6365206d75737420657863656564203000000000000000000000006044820152606401610b69565b81158061132e57508082115b15611337578091505b61135973ffffffffffffffffffffffffffffffffffffffff84163330856140d1565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fefd06828689252a69207718985b9a78350561f811660048301526024820184905284169063095ea7b3906044016020604051808303816000875af11580156113ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114129190615143565b50600a546040517fe2bbb1580000000000000000000000000000000000000000000000000000000081526004810191909152602481018390527f0000000000000000000000003fefd06828689252a69207718985b9a78350561f73ffffffffffffffffffffffffffffffffffffffff169063e2bbb15890604401600060405180830381600087803b1580156114a657600080fd5b505af11580156114ba573d6000803e3d6000fd5b50506040517f57a86f7d14ccde89e22870afe839e3011216827daa9b24e18629f0a1e9d6cc14925060009150a1505050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461156d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff82166115ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff821660008181526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f3d7902bc9a6665bd7caf4240b834bb805d3cd68256889e9f8d2e40a10be41d4491a35050565b60075473ffffffffffffffffffffffffffffffffffffffff1633146116ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6116f26141ad565b6116fa614231565b6040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60075473ffffffffffffffffffffffffffffffffffffffff1633146117a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff8216611823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff821660008181526003602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f3d7902bc9a6665bd7caf4240b834bb805d3cd68256889e9f8d2e40a10be41d4491a35050565b6118aa614050565b600a546040517f5312ea8e00000000000000000000000000000000000000000000000000000000815260048101919091527f0000000000000000000000003fefd06828689252a69207718985b9a78350561f73ffffffffffffffffffffffffffffffffffffffff1690635312ea8e90602401600060405180830381600087803b15801561193657600080fd5b505af115801561194a573d6000803e3d6000fd5b50505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a273ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa1580156119dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a01919061512a565b905090565b6000611a10613209565b336000908152600260205260409020600781015460ff16611be7576000611a356142ae565b600654909150611a4d82670de0b6b3a76400006150c5565b611a5791906150dc565b60196000828254611a6891906150b2565b9091555050336000908152601660205260408120548354601954670de0b6b3a764000091611a95916150c5565b611a9f91906150dc565b33600090815260176020526040902054611ab991906150b2565b611ac39190615117565b90508015611bab57336000908152601760209081526040808320839055600390915290205460ff16611b6a57600061271060125483611b0291906150c5565b611b0c91906150dc565b90508015611b6857611b1e8183615117565b600854909250611b689073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243681169116836145da565b505b611bab73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a324361633836145da565b8254601954670de0b6b3a764000091611bc3916150c5565b611bcd91906150dc565b336000908152601660205260409020559250611bed915050565b60009150505b611bf660018055565b90565b611c01613184565b611c09613209565b610f5d60008261327c565b611c1c614050565b73ffffffffffffffffffffffffffffffffffffffff8116611c99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c90602001610c38565b60075473ffffffffffffffffffffffffffffffffffffffff163314611d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6107d0811115611e1f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f706572666f726d616e63654665652063616e6e6f74206265206d6f726520746860448201527f616e204d41585f504552464f524d414e43455f464545000000000000000000006064820152608401610b69565b60128190556040518181527fefeafcf03e479a9566d7ef321b4816de0ba19cfa3cd0fae2f8c5f4a0afb342c490602001610c38565b611e5c614050565b611e666000614635565b565b600b546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000919073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a216906370a0823190602401602060405180830381865afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d919061512a565b611a0191906150b2565b600060065460001461201257600654611f3e612478565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201527f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243673ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015611fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fec919061512a565b611ff691906150b2565b61200890670de0b6b3a76400006150c5565b611a0191906150dc565b50670de0b6b3a764000090565b60075473ffffffffffffffffffffffffffffffffffffffff1633146120a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6120a8613184565b6120b06146aa565b6040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b33600090815260026020526040902054611e6690610ed8565b60075473ffffffffffffffffffffffffffffffffffffffff163314612175576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b652d79883d200081111561220b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f424f4f53545f5745494748542063616e6e6f74206265206d6f7265207468616e60448201527f20424f4f53545f5745494748545f4c494d4954000000000000000000000000006064820152608401610b69565b60118190556040518181527f7666dfff8c3377938e522b4eed3aff079973a976f95969db60a406d49f40da4e90602001610c38565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081208054158015906122795750600781015460ff165b80156122ab575073ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff16155b80156122c7575042600d5482600501546122c591906150b2565b105b1561234f5760006122d7846128bc565b90506000600d548360050154426122ee9190615117565b6122f89190615117565b905060105481111561230957506010545b60006010546014548361231c91906150c5565b61232691906150dc565b9050600064e8d4a5100061233a83866150c5565b61234491906150dc565b979650505050505050565b50600092915050565b60075473ffffffffffffffffffffffffffffffffffffffff1633146123d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b60008111612443576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4455524154494f4e5f464143544f522063616e6e6f74206265207a65726f00006044820152606401610b69565b600f8190556040518181527f9478eb023aac0a7d58a4e935377056bf27cf5b72a2300725f831817a8f62fbde90602001610c38565b600a546040517fddaf5c4c0000000000000000000000000000000000000000000000000000000081526004810191909152306024820152600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fefd06828689252a69207718985b9a78350561f169063ddaf5c4c90604401602060405180830381865afa158015612512573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed2919061512a565b61253e614050565b73ffffffffffffffffffffffffffffffffffffffff81166125bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fda12ee837e6978172aaf54b16145ffe08414fd8710092ef033c71b8eb6ec189a90602001610c38565b60075473ffffffffffffffffffffffffffffffffffffffff1633146126af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6101f4811115612741576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f77697468647261774665652063616e6e6f74206265206d6f7265207468616e2060448201527f4d41585f57495448445241575f464545000000000000000000000000000000006064820152608401610b69565b60138190556040518181527fd5fe46099fa396290a7f57e36c3c3c8774e2562c18ed5d1dcc0fa75071e03f1d90602001610c38565b60075473ffffffffffffffffffffffffffffffffffffffff1633146127f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b60008111612887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f554e4c4f434b5f465245455f4455524154494f4e2063616e6e6f74206265207a60448201527f65726f00000000000000000000000000000000000000000000000000000000006064820152608401610b69565b600d8190556040518181527ff84bf2b901cfc02956d4e69556d7448cef4ea13587e7714dba7c6d697091e7ad90602001610c38565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260408120805482036128f25750600092915050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152601660205260409020548154601954670de0b6b3a764000091612930916150c5565b61293a91906150dc565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260176020526040902054600654845461296d612478565b61297791906150c5565b61298191906150dc565b61298b91906150b2565b61299591906150b2565b61299f9190615117565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081208054158015906129e05750600781015460ff16155b8015612a12575073ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604090205460ff16155b1561234f576000612a22846128bc565b9050600061271060125483612a3791906150c5565b612a4191906150dc565b95945050505050565b60075473ffffffffffffffffffffffffffffffffffffffff163314612acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b7f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612ba6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f546f6b656e2063616e6e6f742062652073616d65206173206465706f7369742060448201527f746f6b656e0000000000000000000000000000000000000000000000000000006064820152608401610b69565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015612c13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c37919061512a565b90506110d373ffffffffffffffffffffffffffffffffffffffff831633836145da565b612c62613184565b612c6a613209565b6000821180612c795750600081115b612cdf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e6f7468696e6720746f206465706f73697400000000000000000000000000006044820152606401610b69565b612cea8282336137f6565b6110d360018055565b612cfb614050565b73ffffffffffffffffffffffffffffffffffffffff8116612d78576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b600880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fafa147634b29e2c7bd53ce194256b9f41cfb9ba3036f2b822fdd1d965beea08690602001610c38565b612df3614050565b73ffffffffffffffffffffffffffffffffffffffff8116612e96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b69565b610f6681614635565b60075473ffffffffffffffffffffffffffffffffffffffff163314612f20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff8216612f9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f43616e6e6f74206265207a65726f2061646472657373000000000000000000006044820152606401610b69565b73ffffffffffffffffffffffffffffffffffffffff821660008181526004602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915590519092917f3d7902bc9a6665bd7caf4240b834bb805d3cd68256889e9f8d2e40a10be41d4491a35050565b60075473ffffffffffffffffffffffffffffffffffffffff16331461309d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f61646d696e3a207775743f0000000000000000000000000000000000000000006044820152606401610b69565b6305265c00811115613131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4d41585f4c4f434b5f4455524154494f4e2063616e6e6f74206265206d6f726560448201527f207468616e204d41585f4c4f434b5f4455524154494f4e5f4c494d49540000006064820152608401610b69565b600e8190556040518181527fcab2f3455b51b6ca5377e84fccd0f890b6f6ca36c02e18b6d36cb34f469fe4fe90602001610c38565b600061317182612240565b61317a836129a6565b610ed291906150b2565b60005474010000000000000000000000000000000000000000900460ff1615611e66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610b69565b600260015403613275576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b69565b6002600155565b336000908152600260205260409020821580156132995750600082115b1561333b576509184e72a0006132ae83614719565b1161333b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603860248201527f576974686472617720616d6f756e74206d75737420626520677265617465722060448201527f7468616e204d494e5f57495448445241575f414d4f554e5400000000000000006064820152608401610b69565b80548311156133a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f576974686472617720616d6f756e7420657863656564732062616c616e6365006044820152606401610b69565b42816005015410613413576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f5374696c6c20696e206c6f636b000000000000000000000000000000000000006044820152606401610b69565b805483906000906134306b204fce5e3e25026110000000846150c5565b61343a91906150dc565b905060006134466142ae565b600654909150156134ee5760065461346682670de0b6b3a76400006150c5565b61347091906150dc565b6019600082825461348191906150b2565b90915550508354156134ee57336000908152601660205260409020548454601954670de0b6b3a7640000916134b5916150c5565b6134bf91906150dc565b6134c99190615117565b33600090815260176020526040812080549091906134e89084906150b2565b90915550505b6134f7336147f7565b851580156135055750600085115b15613546576000613514611e68565b9050806006548761352591906150c5565b61352f91906150dc565b855490945084111561354057845493505b5061356d565b83546b204fce5e3e250261100000009061356090846150c5565b61356a91906150dc565b92505b60006006548461357b611e68565b61358591906150c5565b61358f91906150dc565b9050838560000160008282546135a59190615117565b9250508190555083600660008282546135be9190615117565b90915550503360009081526017602052604090205485541580156135e25750600081115b156136395761362873ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a324361633836145da565b336000908152601760205260408120555b816018600082825461364b9190615117565b90915550503360009081526004602052604090205460ff161580156136805750601554866001015461367d91906150b2565b42105b156136fa5760006127106013548461369891906150c5565b6136a291906150dc565b6008549091506136ec9073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a281169116836145da565b6136f68184615117565b9250505b61373b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a21633846145da565b85541561376d5760065461374d611e68565b875461375991906150c5565b61376391906150dc565b6002870155613775565b600060028701555b4260038701558554601954670de0b6b3a764000091613793916150c5565b61379d91906150dc565b3360008181526016602090815260409182902093909355805185815292830188905290917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568910160405180910390a25050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260205260409020805415806138295750600084115b156138cb576509184e72a00061383e85614719565b116138cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f4465706f73697420616d6f756e74206d7573742062652067726561746572207460448201527f68616e204d494e5f4445504f5349545f414d4f554e54000000000000000000006064820152608401610b69565b60058101548390428110613925578515613909574260048401556008830154600c80546000906138fc908490615117565b9091555050600060088401555b60048301546139189082615117565b61392290836150b2565b91505b841580613935575062093a808210155b61399b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d696e696d756d206c6f636b20706572696f64206973206f6e65207765656b006044820152606401610b69565b600e54821115613a07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d6178696d756d206c6f636b20706572696f64206578636565646564000000006044820152606401610b69565b6000613a116142ae565b9050600654600003613b22576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243673ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015613aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ace919061512a565b600854909150613b189073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243681169116836145da565b6000915050613beb565b600654613b3782670de0b6b3a76400006150c5565b613b4191906150dc565b60196000828254613b5291906150b2565b9091555050835415613beb5773ffffffffffffffffffffffffffffffffffffffff85166000908152601660205260409020548454601954670de0b6b3a764000091613b9c916150c5565b613ba691906150dc565b613bb09190615117565b73ffffffffffffffffffffffffffffffffffffffff861660009081526017602052604081208054909190613be59084906150b2565b90915550505b613bf4856147f7565b8515613c5e5742821015613c1c574260048501819055613c159087906150b2565b9150613c29565b613c2686836150b2565b91505b6007840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055600584018290555b600080600080613c6c611e68565b90508a15613cba57613cb673ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a2168a308e6140d1565b8a92505b875415801590613cce5750600788015460ff165b15613d47576006548854613ce290836150c5565b613cec91906150dc565b9150613cf882846150b2565b9250876000015460066000828254613d109190615117565b9091555050600088556004880154429003613d475760088801829055600c8054839190600090613d419084906150b2565b90915550505b60065415613d7757613d598282615117565b600654613d6690856150c5565b613d7091906150dc565b9350613d7b565b8293505b8760040154861115613efb576000600f546011548a6004015489613d9f9190615117565b613da991906150c5565b613db391906150dc565b9050600064e8d4a51000613dc787846150c5565b613dd191906150dc565b9050613ddd81876150b2565b9550858a6000016000828254613df391906150b2565b909155506000905064e8d4a51000613e0b87856150c5565b613e1591906150dc565b9050808b6006016000828254613e2b91906150b2565b9250508190555080600b6000828254613e4491906150b2565b925050819055508d8b6008016000828254613e5f91906150b2565b925050819055508d600c6000828254613e7891906150b2565b909155505060088b01548b5460048d015473ffffffffffffffffffffffffffffffffffffffff8f16927f2b943276e5d747f6f7dd46d3b880d8874cb8d6b9b88ca1903990a2738e7dc7a1929091613ecf908e615117565b6040805193845260208401929092529082015242606082015260800160405180910390a2505050613f15565b83886000016000828254613f0f91906150b2565b90915550505b60008b1180613f24575060008a115b15613f30574260018901555b8360066000828254613f4291906150b2565b90915550506006808901549054613f57611e68565b8a54613f6391906150c5565b613f6d91906150dc565b613f779190615117565b60028901554260038901558754601954670de0b6b3a764000091613f9a916150c5565b613fa491906150dc565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260166020526040812091909155601880548d9290613fdf9084906150b2565b9091555050604080518c8152602081018690529081018b905242606082015273ffffffffffffffffffffffffffffffffffffffff8a16907f7162984403f6c73c8639375d45a9187dfd04602231bd8e587c415718b5f7e5f99060800160405180910390a25050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b69565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261194a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614c88565b60005474010000000000000000000000000000000000000000900460ff16611e66576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610b69565b6142396141ad565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b600a546040517fddaf5c4c0000000000000000000000000000000000000000000000000000000081526004810191909152306024820152600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003fefd06828689252a69207718985b9a78350561f169063ddaf5c4c90604401602060405180830381865afa158015614348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061436c919061512a565b905080156145d2576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243673ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015614401573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614425919061512a565b600a546040517f441a3e700000000000000000000000000000000000000000000000000000000081526004810191909152600060248201529091507f0000000000000000000000003fefd06828689252a69207718985b9a78350561f73ffffffffffffffffffffffffffffffffffffffff169063441a3e7090604401600060405180830381600087803b1580156144bb57600080fd5b505af11580156144cf573d6000803e3d6000fd5b50506040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600092507f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243673ffffffffffffffffffffffffffffffffffffffff1691506370a0823190602401602060405180830381865afa158015614560573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614584919061512a565b905060006145928383615117565b60405181815290915033907fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba9060200160405180910390a2949350505050565b600091505090565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526146309084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161412b565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6146b2613184565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586142843390565b600060127f000000000000000000000000000000000000000000000000000000000000001260ff161015614787576147727f00000000000000000000000000000000000000000000000000000000000000126012615160565b61477d90600a615299565b610ed290836150c5565b60127f000000000000000000000000000000000000000000000000000000000000001260ff1611156147f3576147de60127f0000000000000000000000000000000000000000000000000000000000000012615160565b6147e990600a615299565b610ed290836150dc565b5090565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090208054156110d357600781015460ff1615614b8857600081600601546006548360000154614847611e68565b61485191906150c5565b61485b91906150dc565b6148659190615117565b90508160060154600b600082825461487d9190615117565b9091555050600060068084018290558354815490929061489e908490615117565b909155505073ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604090205460ff161580156148e9575042600d5483600501546148e791906150b2565b105b15614a665773ffffffffffffffffffffffffffffffffffffffff8316600090815260176020526040812054600d5460058501549192916149299042615117565b6149339190615117565b905060105481111561494457506010545b60006010546014548361495791906150c5565b61496191906150dc565b9050600064e8d4a5100061497583866150c5565b61497f91906150dc565b9050600061498e6002836150dc565b6008549091506149d89073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243681169116836145da565b614a2661dead6149e88385615117565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a324361691906145da565b73ffffffffffffffffffffffffffffffffffffffff881660009081526017602052604081208054849290614a5b908490615117565b909155505050505050505b6000614a70611e68565b90506000600654600014614aa657614a888383615117565b600654614a9590856150c5565b614a9f91906150dc565b9050614aa9565b50815b80845560068054829190600090614ac19084906150b2565b90915550506005840154421115614b81576007840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600060048501819055600585018190556008850154600c805491929091614b24908490615117565b9091555050600060088501556040805184815242602082015273ffffffffffffffffffffffffffffffffffffffff8716917ff7870c5b224cbc19873599e46ccfc7103934650509b1af0c3ce90138377c2004910160405180910390a25b5050505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604090205460ff166110d35773ffffffffffffffffffffffffffffffffffffffff821660009081526017602052604081205460125490919061271090614bef90846150c5565b614bf991906150dc565b9050801561194a57600854614c489073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000015628ce9150db1bce2fbb717a09e846f8a3243681169116836145da565b73ffffffffffffffffffffffffffffffffffffffff841660009081526017602052604081208054839290614c7d908490615117565b909155505050505050565b6000614cea826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16614d979092919063ffffffff16565b9050805160001480614d0b575080806020019051810190614d0b9190615143565b614630576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610b69565b6060614da68484600085614dae565b949350505050565b606082471015614e40576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610b69565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051614e6991906152cc565b60006040518083038185875af1925050503d8060008114614ea6576040519150601f19603f3d011682016040523d82523d6000602084013e614eab565b606091505b50915091506123448783838760608315614f4d578251600003614f465773ffffffffffffffffffffffffffffffffffffffff85163b614f46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b69565b5081614da6565b614da68383815115614f625781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6991906152e8565b600060208284031215614fa857600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff81168114610f6657600080fd5b600060208284031215614fe357600080fd5b813561299f81614faf565b6000806040838503121561500157600080fd5b823561500c81614faf565b946020939093013593505050565b8015158114610f6657600080fd5b6000806040838503121561503b57600080fd5b823561504681614faf565b915060208301356150568161501a565b809150509250929050565b6000806040838503121561507457600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610ed257610ed2615083565b8082028115828204841417610ed257610ed2615083565b600082615112577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115610ed257610ed2615083565b60006020828403121561513c57600080fd5b5051919050565b60006020828403121561515557600080fd5b815161299f8161501a565b60ff8281168282160390811115610ed257610ed2615083565b600181815b808511156151d257817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156151b8576151b8615083565b808516156151c557918102915b93841c939080029061517e565b509250929050565b6000826151e957506001610ed2565b816151f657506000610ed2565b816001811461520c576002811461521657615232565b6001915050610ed2565b60ff84111561522757615227615083565b50506001821b610ed2565b5060208310610133831016604e8410600b8410161715615255575081810a610ed2565b61525f8383615179565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561529157615291615083565b029392505050565b600061299f60ff8416836151da565b60005b838110156152c35781810151838201526020016152ab565b50506000910152565b600082516152de8184602087016152a8565b9190910192915050565b60208152600082518060208401526153078160408501602087016152a8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220a392363a51b198551920ff8bf7e6aae98d6397086abb8d8407d4e6688aece8b964736f6c63430008130033

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

000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a20000000000000000000000003fefd06828689252a69207718985b9a78350561f00000000000000000000000095fe70a9449d1e8276040d29a4fdf63b94246288000000000000000000000000b5c4d8671e03fba09d467c50fc51215b77ee54540000000000000000000000001d8ecef8fcaaa50f0326d9af768809a01aae61a90000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _token (address): 0xFD8b9Ba4845fB38c779317eC134b298C064937a2
Arg [1] : _masterchefV2 (address): 0x3fefd06828689252A69207718985B9a78350561F
Arg [2] : _admin (address): 0x95Fe70a9449D1e8276040d29A4FDF63B94246288
Arg [3] : _treasury (address): 0xb5C4D8671E03FBA09D467C50FC51215b77eE5454
Arg [4] : _operator (address): 0x1d8ECEf8fcaaA50f0326D9af768809a01aaE61A9
Arg [5] : _pid (uint256): 0

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000fd8b9ba4845fb38c779317ec134b298c064937a2
Arg [1] : 0000000000000000000000003fefd06828689252a69207718985b9a78350561f
Arg [2] : 00000000000000000000000095fe70a9449d1e8276040d29a4fdf63b94246288
Arg [3] : 000000000000000000000000b5c4d8671e03fba09d467c50fc51215b77ee5454
Arg [4] : 0000000000000000000000001d8ecef8fcaaa50f0326d9af768809a01aae61a9
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000


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.