Contract Address Details

0x6bE34986Fdd1A91e4634eb6b9F8017439b7b5EDc

Contract Name
MasterMeerkat
Creator
0x61c20e–4d6b27 at 0x3b1e1d–e514e6
Balance
0 CRO ( )
Tokens
Fetching tokens...
Transactions
1,073,953 Transactions
Transfers
1,621,186 Transfers
Gas Used
217,908,030,470
Last Balance Update
13799699
Contract name:
MasterMeerkat




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
200
EVM Version
default




Verified at
2021-12-13T04:14:56.576793Z

Constructor Arguments

00000000000000000000000097749c9b61f878a880dfe312d2594ae07aed765600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Arg [0] (address) : 0x97749c9b61f878a880dfe312d2594ae07aed7656
Arg [1] (uint256) : 0
Arg [2] (uint256) : 0

              

Contract source code

// File @openzeppelin/contracts/math/[email protected]

// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.6.0 <0.8.0;

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

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

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


// File @pancakeswap/pancake-swap-lib/contracts/token/BEP20/[email protected]

pragma solidity >=0.4.0;

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

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

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

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

    /**
     * @dev Returns the bep token owner.
     */
    function getOwner() external view returns (address);

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

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

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

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

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

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

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


// File @pancakeswap/pancake-swap-lib/contracts/math/[email protected]



pragma solidity >=0.4.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, 'SafeMath: addition overflow');

        return c;
    }

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

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

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, 'SafeMath: multiplication overflow');

        return c;
    }

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

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

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

    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
        z = x < y ? x : y;
    }

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}


// File @pancakeswap/pancake-swap-lib/contracts/utils/[email protected]



pragma solidity ^0.6.2;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

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

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

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

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

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

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

    function _functionCallWithValue(
        address target,
        bytes memory data,
        uint256 weiValue,
        string memory errorMessage
    ) private returns (bytes memory) {
        require(isContract(target), 'Address: call to non-contract');

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value: weiValue}(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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


// File @pancakeswap/pancake-swap-lib/contracts/token/BEP20/[email protected]



pragma solidity ^0.6.0;



/**
 * @title SafeBEP20
 * @dev Wrappers around BEP20 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 SafeBEP20 for IBEP20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeBEP20 {
    using SafeMath for uint256;
    using Address for address;

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

    function safeTransferFrom(
        IBEP20 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
     * {IBEP20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IBEP20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            'SafeBEP20: approve from non-zero to non-zero allowance'
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IBEP20 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, 'SafeBEP20: low-level call failed');
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), 'SafeBEP20: BEP20 operation did not succeed');
        }
    }
}


// File @pancakeswap/pancake-swap-lib/contracts/GSN/[email protected]



pragma solidity >=0.4.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor() internal {}

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

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


// File @pancakeswap/pancake-swap-lib/contracts/access/[email protected]

pragma solidity >=0.4.0;

/**
 * @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.
 */
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() internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), 'Ownable: new owner is the zero address');
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}


// File @openzeppelin/contracts/utils/[email protected]



pragma solidity >=0.6.0 <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 () internal {
        _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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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


// File @openzeppelin/contracts-upgradeable/utils/[email protected]



pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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


// File @openzeppelin/contracts-upgradeable/proxy/[email protected]



// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]



pragma solidity >=0.6.0 <0.8.0;

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

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

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


// File @openzeppelin/contracts-upgradeable/access/[email protected]



pragma solidity >=0.6.0 <0.8.0;


/**
 * @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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal initializer {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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


// File contracts/library/WhitelistUpgradeable.sol


pragma solidity ^0.6.12;

contract WhitelistUpgradeable is OwnableUpgradeable {
    mapping (address => bool) private _whitelist;
    bool private _disable;                      // default - false means whitelist feature is working on. if true no more use of whitelist

    event Whitelisted(address indexed _address, bool whitelist);
    event EnableWhitelist();
    event DisableWhitelist();

    modifier onlyWhitelisted {
        require(_disable || _whitelist[msg.sender], "Whitelist: caller is not on the whitelist");
        _;
    }

    function __WhitelistUpgradeable_init() internal initializer {
        __Ownable_init();
    }

    function isWhitelist(address _address) public view returns(bool) {
        return _whitelist[_address];
    }

    function setWhitelist(address _address, bool _on) external onlyOwner {
        _whitelist[_address] = _on;

        emit Whitelisted(_address, _on);
    }

    function disableWhitelist(bool disable) external onlyOwner {
        _disable = disable;
        if (disable) {
            emit DisableWhitelist();
        } else {
            emit EnableWhitelist();
        }
    }

    uint256[49] private __gap;
}


// File contracts/ProxyMeerkat.sol


pragma solidity 0.6.12;



contract ProxyMeerkat is OwnableUpgradeable, WhitelistUpgradeable {
    using SafeBEP20 for IBEP20;

    IBEP20 private constant MMF = IBEP20(0x97749c9B61F878a880DfE312d2594AE07AEd7656);

    function initialize() external initializer {
        __Ownable_init();
    }

    function safeMeerkatTransfer(address to, uint256 amount) external onlyWhitelisted returns (uint256) {
        uint256 meerkatBal = MMF.balanceOf(address(this));
        if (amount > meerkatBal) {
            MMF.transfer(to, meerkatBal);
            return meerkatBal;
        } else {
            MMF.transfer(to, amount);
            return amount;
        }
    }

    // Owner can drain tokens that are sent here by mistake
    function drainBEP20Token(IBEP20 _token, uint256 _amount, address _to) external onlyOwner {
        require(address(_token) != address(MMF));
        _token.safeTransfer(_to, _amount);
    }
}


// File contracts/library/Whitelist.sol


pragma solidity ^0.6.12;

contract Whitelist is Ownable {
    mapping(address => bool) private _whitelist;
    bool private _disable;                      // default - false means whitelist feature is working on. if true no more use of whitelist

    event Whitelisted(address indexed _address, bool whitelist);
    event EnableWhitelist();
    event DisableWhitelist();

    modifier onlyWhitelisted {
        require(_disable || _whitelist[msg.sender], "Whitelist: caller is not on the whitelist");
        _;
    }

    function isWhitelist(address _address) public view returns (bool) {
        return _whitelist[_address];
    }

    function setWhitelist(address _address, bool _on) external onlyOwner {
        _whitelist[_address] = _on;

        emit Whitelisted(_address, _on);
    }

    function disableWhitelist(bool disable) external onlyOwner {
        _disable = disable;
        if (disable) {
            emit DisableWhitelist();
        } else {
            emit EnableWhitelist();
        }
    }
}


// File contracts/interfaces/IMeerkatReferral.sol



pragma solidity 0.6.12;

interface IMeerkatReferral {
    /**
     * @dev Record referral.
     */
    function recordReferral(address user, address referrer) external;

    /**
     * @dev Record referral commission.
     */
    function recordReferralCommission(address referrer, uint256 commission) external;

    /**
     * @dev Get the referrer address that referred the user.
     */
    function getReferrer(address user) external view returns (address);
}


// File contracts/interfaces/IERC721.sol

pragma solidity ^0.6.12;

/// @title ERC-721 Non-Fungible Token Standard
/// @dev See https://eips.ethereum.org/EIPS/eip-721
///  Note: the ERC-165 identifier for this interface is 0x80ac58cd.
interface ERC721 /* is ERC165 */ {
    /// @dev This emits when ownership of any NFT changes by any mechanism.
    ///  This event emits when NFTs are created (`from` == 0) and destroyed
    ///  (`to` == 0). Exception: during contract creation, any number of NFTs
    ///  may be created and assigned without emitting Transfer. At the time of
    ///  any transfer, the approved address for that NFT (if any) is reset to none.
    event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);

    /// @dev This emits when the approved address for an NFT is changed or
    ///  reaffirmed. The zero address indicates there is no approved address.
    ///  When a Transfer event emits, this also indicates that the approved
    ///  address for that NFT (if any) is reset to none.
    event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);

    /// @dev This emits when an operator is enabled or disabled for an owner.
    ///  The operator can manage all NFTs of the owner.
    event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);

    /// @notice Count all NFTs assigned to an owner
    /// @dev NFTs assigned to the zero address are considered invalid, and this
    ///  function throws for queries about the zero address.
    /// @param _owner An address for whom to query the balance
    /// @return The number of NFTs owned by `_owner`, possibly zero
    function balanceOf(address _owner) external view returns (uint256);

    /// @notice Find the owner of an NFT
    /// @dev NFTs assigned to zero address are considered invalid, and queries
    ///  about them do throw.
    /// @param _tokenId The identifier for an NFT
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 _tokenId) external view returns (address);

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT. When transfer is complete, this function
    ///  checks if `_to` is a smart contract (code size > 0). If so, it calls
    ///  `onERC721Received` on `_to` and throws if the return value is not
    ///  `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    /// @param data Additional data with no specified format, sent in call to `_to`
    function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory data) external payable;

    /// @notice Transfers the ownership of an NFT from one address to another address
    /// @dev This works identically to the other function with an extra data parameter,
    ///  except this function just sets data to "".
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function safeTransferFrom(address _from, address _to, uint256 _tokenId) external payable;

    /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
    ///  TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
    ///  THEY MAY BE PERMANENTLY LOST
    /// @dev Throws unless `msg.sender` is the current owner, an authorized
    ///  operator, or the approved address for this NFT. Throws if `_from` is
    ///  not the current owner. Throws if `_to` is the zero address. Throws if
    ///  `_tokenId` is not a valid NFT.
    /// @param _from The current owner of the NFT
    /// @param _to The new owner
    /// @param _tokenId The NFT to transfer
    function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

    /// @notice Change or reaffirm the approved address for an NFT
    /// @dev The zero address indicates there is no approved address.
    ///  Throws unless `msg.sender` is the current NFT owner, or an authorized
    ///  operator of the current owner.
    /// @param _approved The new approved NFT controller
    /// @param _tokenId The NFT to approve
    function approve(address _approved, uint256 _tokenId) external payable;

    /// @notice Enable or disable approval for a third party ("operator") to manage
    ///  all of `msg.sender`'s assets
    /// @dev Emits the ApprovalForAll event. The contract MUST allow
    ///  multiple operators per owner.
    /// @param _operator Address to add to the set of authorized operators
    /// @param _approved True if the operator is approved, false to revoke approval
    function setApprovalForAll(address _operator, bool _approved) external;

    /// @notice Get the approved address for a single NFT
    /// @dev Throws if `_tokenId` is not a valid NFT.
    /// @param _tokenId The NFT to find the approved address for
    /// @return The approved address for this NFT, or the zero address if there is none
    function getApproved(uint256 _tokenId) external view returns (address);

    /// @notice Query if an address is an authorized operator for another address
    /// @param _owner The address that owns the NFTs
    /// @param _operator The address that acts on behalf of the owner
    /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
    function isApprovedForAll(address _owner, address _operator) external view returns (bool);

    function tokenURI(uint256 _tokenId) external view returns (string memory);

    /// @notice Count NFTs tracked by this contract
    /// @return A count of valid NFTs tracked by this contract, where each one of
    ///  them has an assigned and queryable owner not equal to the zero address
    function totalSupply() external view returns (uint256);

    /// @notice Enumerate valid NFTs
    /// @dev Throws if `_index` >= `totalSupply()`.
    /// @param _index A counter less than `totalSupply()`
    /// @return The token identifier for the `_index`th NFT,
    ///  (sort order not specified)
    function tokenByIndex(uint256 _index) external view returns (uint256);

    /// @notice Enumerate NFTs assigned to an owner
    /// @dev Throws if `_index` >= `balanceOf(_owner)` or if
    ///  `_owner` is the zero address, representing invalid NFTs.
    /// @param _owner An address where we are interested in NFTs owned by them
    /// @param _index A counter less than `balanceOf(_owner)`
    /// @return The token identifier for the `_index`th NFT assigned to `_owner`,
    ///   (sort order not specified)
    function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);

    function burn(uint256 tokenId) external;
}

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}


// File contracts/MasterMeerkat.sol



pragma solidity 0.6.12;








interface IMeerkatToken {
    function mint(address _to, uint256 _amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
}

interface NFTController {
    function getBoostRate(address token, uint tokenId) external view returns (uint boostRate);
    function isWhitelistedNFT(address token) external view returns (bool);
}

contract MasterMeerkat is Ownable, ReentrancyGuard, Whitelist {
    using SafeMath for uint256;
    using SafeBEP20 for IBEP20;

    // Bonus muliplier for early meerkat makers.
    uint256 public constant BONUS_MULTIPLIER = 1;

    // Info of each user.
    struct UserInfo {
        uint256 amount;         // How many LP tokens the user has provided.
        uint256 rewardDebt;     // Reward debt. See explanation below.
    }

    // Info of each pool.
    struct PoolInfo {
        IBEP20 lpToken;           // Address of LP token contract.
        uint256 allocPoint;       // How many allocation points assigned to this pool. MMF to distribute per block.
        uint256 lastRewardBlock;  // Last block number that MMF distribution occurs.
        uint256 accMeerkatPerShare;   // Accumulated MMF per share, times 1e18. See below.
    }

    struct NFTSlot {
        address slot1;
        uint256 tokenId1;
        address slot2;
        uint256 tokenId2;
        address slot3;
        uint256 tokenId3;
    }

    // The MMF TOKEN!
    IMeerkatToken public meerkat;
    // MMF tokens created per block.
    uint256 public meerkatPerBlock;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint;
    // The block number when MMF mining starts.
    uint256 public startBlock;

    mapping(IBEP20 => bool) public poolExistence;
    mapping(address => mapping(uint256 => NFTSlot)) private _depositedNFT; // user => pid => nft slot;

    bool public whitelistAll;
    NFTController public controller = NFTController(address(0));
    uint public nftBoostRate = 100;

    // Meerkat referral contract address.
    IMeerkatReferral public meerkatReferral;
    // Referral commission rate in basis points.
    uint16 public referralCommissionRate = 100; // 1%
    // Max referral commission rate: 10%.
    uint16 public constant MAXIMUM_REFERRAL_COMMISSION_RATE = 1000;
    // Proxy to hold MMF
    ProxyMeerkat public proxy = ProxyMeerkat(0xcAa8c10B81DDD462AFf6bA33aC8242255504B3Db);

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event UpdateEmissionRate(address indexed user, uint256 meerkatPerBlock);
    event UpdateNFTController(address indexed user, address controller);
    event UpdateNFTBoostRate(address indexed user, uint256 controller);
    event ReferralCommissionPaid(address indexed user, address indexed referrer, uint256 commissionAmount);

    constructor(
        IMeerkatToken _meerkat,
        uint256 _meerkatPerBlock,
        uint256 _startBlock
    ) public {
        meerkat = _meerkat;
        meerkatPerBlock = _meerkatPerBlock;
        startBlock = _startBlock;
        totalAllocPoint = 0;
        whitelistAll = false;
    }

    /* ========== Modifiers ========== */

    modifier nonDuplicated(IBEP20 _lpToken) {
        require(poolExistence[_lpToken] == false, "nonDuplicated: duplicated");
        _;
    }

    modifier nonContract() {
        if (!isWhitelist(msg.sender) && !whitelistAll) {
            require(tx.origin == msg.sender);
        }
        _;
    }

    /* ========== NFT View Functions ========== */

    function getBoost(address _account, uint256 _pid) public view returns (uint256) {
        if (address(controller) == address(0)) return 0;
        NFTSlot memory slot = _depositedNFT[_account][_pid];
        uint boost1 = controller.getBoostRate(slot.slot1, slot.tokenId1);
        uint boost2 = controller.getBoostRate(slot.slot2, slot.tokenId2);
        uint boost3 = controller.getBoostRate(slot.slot3, slot.tokenId3);
        uint boost = boost1 + boost2 + boost3;
        return boost.mul(nftBoostRate).div(100); // boosts from 0% onwards
    }

    function getSlots(address _account, uint256 _pid) public view returns (address, address, address) {
        NFTSlot memory slot = _depositedNFT[_account][_pid];
        return (slot.slot1, slot.slot2, slot.slot3);
    }

    function getTokenIds(address _account, uint256 _pid) public view returns (uint256, uint256, uint256) {
        NFTSlot memory slot = _depositedNFT[_account][_pid];
        return (slot.tokenId1, slot.tokenId2, slot.tokenId3);
    }

    /* ========== View Functions ========== */

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Return reward multiplier over the given _from to _to block.
    function getMultiplier(uint256 _from, uint256 _to) public pure returns (uint256) {
        return _to.sub(_from).mul(BONUS_MULTIPLIER);
    }

    // View function to see pending MMF on frontend.
    function pendingMeerkat(uint256 _pid, address _user) external view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accMeerkatPerShare = pool.accMeerkatPerShare;
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 meerkatReward = multiplier.mul(meerkatPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
            accMeerkatPerShare = accMeerkatPerShare.add(meerkatReward.mul(1e18).div(lpSupply));
        }
        return user.amount.mul(accMeerkatPerShare).div(1e18).sub(user.rewardDebt);
    }

    /* ========== Owner Functions ========== */

    // Add a new lp to the pool. Can only be called by the owner.
    function add(uint256 _allocPoint, IBEP20 _lpToken, bool _withUpdate) public onlyOwner nonDuplicated(_lpToken) {
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);
        poolExistence[_lpToken] = true;
        poolInfo.push(PoolInfo({
            lpToken : _lpToken,
            allocPoint : _allocPoint,
            lastRewardBlock : lastRewardBlock,
            accMeerkatPerShare : 0
        }));
    }

    // Update the given pool's MMF allocation point and deposit fee. Can only be called by the owner.
    function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public onlyOwner {
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
        poolInfo[_pid].allocPoint = _allocPoint;
    }

    /* ========== NFT External Functions ========== */

    // Depositing of NFTs
    function depositNFT(address _nft, uint256 _tokenId, uint256 _slot, uint256 _pid) public nonContract {
        require(controller.isWhitelistedNFT(_nft), "only approved NFTs");
        require(ERC721(_nft).balanceOf(msg.sender) > 0, "user does not have specified NFT");
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount == 0, "not allowed to deposit");
        
        ERC721(_nft).transferFrom(msg.sender, address(this), _tokenId);
        
        NFTSlot memory slot = _depositedNFT[msg.sender][_pid];

        if (_slot == 1) slot.slot1 = _nft;
        else if (_slot == 2) slot.slot2 = _nft;
        else if (_slot == 3) slot.slot3 = _nft;
        
        if (_slot == 1) slot.tokenId1 = _tokenId;
        else if (_slot == 2) slot.tokenId2 = _tokenId;
        else if (_slot == 3) slot.tokenId3 = _tokenId;

        _depositedNFT[msg.sender][_pid] = slot;
    }

    // Withdrawing of NFTs
    function withdrawNFT(uint256 _slot, uint256 _pid) public nonContract {
        address _nft;
        uint256 _tokenId;
        
        NFTSlot memory slot = _depositedNFT[msg.sender][_pid];

        if (_slot == 1) _nft = slot.slot1;
        else if (_slot == 2) _nft = slot.slot2;
        else if (_slot == 3) _nft = slot.slot3;
        
        if (_slot == 1) _tokenId = slot.tokenId1;
        else if (_slot == 2) _tokenId = slot.tokenId2;
        else if (_slot == 3) _tokenId = slot.tokenId3;

        if (_slot == 1) slot.slot1 = address(0);
        else if (_slot == 2) slot.slot2 = address(0);
        else if (_slot == 3) slot.slot3 = address(0);
        
        if (_slot == 1) slot.tokenId1 = uint(0);
        else if (_slot == 2) slot.tokenId2 = uint(0);
        else if (_slot == 3) slot.tokenId3 = uint(0);

        _depositedNFT[msg.sender][_pid] = slot;
        
        ERC721(_nft).transferFrom(address(this), msg.sender, _tokenId);
    }

    /* ========== External Functions ========== */

    // Update reward variables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (lpSupply == 0 || pool.allocPoint == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 meerkatReward = multiplier.mul(meerkatPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
        meerkat.mint(address(proxy), meerkatReward);

        pool.accMeerkatPerShare = pool.accMeerkatPerShare.add(meerkatReward.mul(1e18).div(lpSupply));
        pool.lastRewardBlock = block.number;
    }

    // Deposit LP tokens to MasterChef for MMF allocation.
    function deposit(uint256 _pid, uint256 _amount, address _referrer) public nonReentrant nonContract {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (_amount > 0 && address(meerkatReferral) != address(0) && _referrer != address(0) && _referrer != msg.sender) {
            meerkatReferral.recordReferral(msg.sender, _referrer);
        }
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accMeerkatPerShare).div(1e18).sub(user.rewardDebt);
            if (pending > 0) {
                safeMeerkatTransfer(msg.sender, pending, _pid);
            }
        }
        if (_amount > 0) {
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            user.amount = user.amount.add(_amount);
        }
        user.rewardDebt = user.amount.mul(pool.accMeerkatPerShare).div(1e18);
        emit Deposit(msg.sender, _pid, _amount);
    }

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) public nonReentrant nonContract {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accMeerkatPerShare).div(1e18).sub(user.rewardDebt);
        if (pending > 0) {
            safeMeerkatTransfer(msg.sender, pending, _pid);
        }
        if (_amount > 0) {
            user.amount = user.amount.sub(_amount);
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
        }
        user.rewardDebt = user.amount.mul(pool.accMeerkatPerShare).div(1e18);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public nonReentrant {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;
        pool.lpToken.safeTransfer(address(msg.sender), amount);
        emit EmergencyWithdraw(msg.sender, _pid, amount);
    }

    // Safe MMF transfer function, just in case if rounding error causes pool to not have enough MMF.
    function safeMeerkatTransfer(address _to, uint256 _amount, uint256 _pid) internal {
        uint256 boost = 0;
        proxy.safeMeerkatTransfer(_to, _amount);
        boost = getBoost(_to, _pid).mul(_amount).div(100);
        payReferralCommission(msg.sender, _amount);
        if (boost > 0) meerkat.mint(_to, boost);
    }

    /* ========== Set Variable Functions ========== */

    function updateEmissionRate(uint256 _meerkatPerBlock) public onlyOwner {
        massUpdatePools();
        meerkatPerBlock = _meerkatPerBlock;
        emit UpdateEmissionRate(msg.sender, _meerkatPerBlock);
    }

    function setNftController(address _controller) public onlyOwner {
        controller = NFTController(_controller);
        emit UpdateNFTController(msg.sender, _controller);
    }

    function setNftBoostRate(uint256 _rate) public onlyOwner {
        require(_rate > 50 && _rate < 500, "boost must be within range");
        nftBoostRate = _rate;
        emit UpdateNFTBoostRate(msg.sender, _rate);
    }

    function setMeerkatReferral(IMeerkatReferral _meerkatReferral) public onlyOwner {
        meerkatReferral = _meerkatReferral;
    }
    
    function flipWhitelistAll() public onlyOwner {
        whitelistAll = !whitelistAll;
    }

    function setReferralCommissionRate(uint16 _referralCommissionRate) public onlyOwner {
        require(_referralCommissionRate <= MAXIMUM_REFERRAL_COMMISSION_RATE, "setReferralCommissionRate: invalid referral commission rate basis points");
        referralCommissionRate = _referralCommissionRate;
    }

    /* ========== Internal Functions ========== */

    // Pay referral commission to the referrer who referred this user
    function payReferralCommission(address _user, uint256 _pending) internal {
        if (address(meerkatReferral) != address(0) && referralCommissionRate > 0) {
            address referrer = meerkatReferral.getReferrer(_user);
            uint256 commissionAmount = _pending.mul(referralCommissionRate).div(10000);

            if (referrer != address(0) && commissionAmount > 0) {
                meerkat.mint(referrer, commissionAmount);
                meerkatReferral.recordReferralCommission(referrer, commissionAmount);
                emit ReferralCommissionPaid(_user, referrer, commissionAmount);
            }
        }
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_meerkat","internalType":"contract IMeerkatToken"},{"type":"uint256","name":"_meerkatPerBlock","internalType":"uint256"},{"type":"uint256","name":"_startBlock","internalType":"uint256"}]},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"DisableWhitelist","inputs":[],"anonymous":false},{"type":"event","name":"EmergencyWithdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"EnableWhitelist","inputs":[],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReferralCommissionPaid","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"address","name":"referrer","internalType":"address","indexed":true},{"type":"uint256","name":"commissionAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateEmissionRate","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"meerkatPerBlock","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateNFTBoostRate","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"controller","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UpdateNFTController","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"address","name":"controller","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Whitelisted","inputs":[{"type":"address","name":"_address","internalType":"address","indexed":true},{"type":"bool","name":"whitelist","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"pid","internalType":"uint256","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BONUS_MULTIPLIER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"MAXIMUM_REFERRAL_COMMISSION_RATE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"add","inputs":[{"type":"uint256","name":"_allocPoint","internalType":"uint256"},{"type":"address","name":"_lpToken","internalType":"contract IBEP20"},{"type":"bool","name":"_withUpdate","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract NFTController"}],"name":"controller","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deposit","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_referrer","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"depositNFT","inputs":[{"type":"address","name":"_nft","internalType":"address"},{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"uint256","name":"_slot","internalType":"uint256"},{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableWhitelist","inputs":[{"type":"bool","name":"disable","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"emergencyWithdraw","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"flipWhitelistAll","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getBoost","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getMultiplier","inputs":[{"type":"uint256","name":"_from","internalType":"uint256"},{"type":"uint256","name":"_to","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}],"name":"getSlots","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTokenIds","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isWhitelist","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"massUpdatePools","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IMeerkatToken"}],"name":"meerkat","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"meerkatPerBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IMeerkatReferral"}],"name":"meerkatReferral","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nftBoostRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingMeerkat","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"poolExistence","inputs":[{"type":"address","name":"","internalType":"contract IBEP20"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"lpToken","internalType":"contract IBEP20"},{"type":"uint256","name":"allocPoint","internalType":"uint256"},{"type":"uint256","name":"lastRewardBlock","internalType":"uint256"},{"type":"uint256","name":"accMeerkatPerShare","internalType":"uint256"}],"name":"poolInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"poolLength","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ProxyMeerkat"}],"name":"proxy","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"referralCommissionRate","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"set","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_allocPoint","internalType":"uint256"},{"type":"bool","name":"_withUpdate","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMeerkatReferral","inputs":[{"type":"address","name":"_meerkatReferral","internalType":"contract IMeerkatReferral"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNftBoostRate","inputs":[{"type":"uint256","name":"_rate","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNftController","inputs":[{"type":"address","name":"_controller","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReferralCommissionRate","inputs":[{"type":"uint16","name":"_referralCommissionRate","internalType":"uint16"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setWhitelist","inputs":[{"type":"address","name":"_address","internalType":"address"},{"type":"bool","name":"_on","internalType":"bool"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startBlock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalAllocPoint","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateEmissionRate","inputs":[{"type":"uint256","name":"_meerkatPerBlock","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePool","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"uint256","name":"rewardDebt","internalType":"uint256"}],"name":"userInfo","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"whitelistAll","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_pid","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawNFT","inputs":[{"type":"uint256","name":"_slot","internalType":"uint256"},{"type":"uint256","name":"_pid","internalType":"uint256"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061025e5760003560e01c80635d54e61211610146578063c0676ee8116100c3578063e543809711610087578063e543809714610737578063ec5568891461075d578063f2fde38b14610765578063f46ed1e31461078b578063f77c479114610793578063f8dfc2e41461079b5761025e565b8063c0676ee8146106af578063c683630d146106db578063cbd258b514610701578063d30ef61b14610727578063e0283faf1461072f5761025e565b80638da5cb5b1161010a5780638da5cb5b146105d55780638dbb1e3a146105dd5780638dbdbe6d1461060057806393f1a40b14610632578063b779e987146106775761025e565b80635d54e61214610576578063630b5ba11461059257806364482f791461059a578063715018a6146105c55780638aa28550146105cd5761025e565b8063441a3e70116101df57806349ba1b49116101a357806349ba1b491461048457806351eb05a6146104a35780635312ea8e146104c057806353d6fd59146104dd57806355dbc8261461050b578063570d2f201461052c5761025e565b8063441a3e70146103ea57806345a639141461040d57806345b373d31461043157806348b22bfb1461045d57806348cd4cb11461047c5761025e565b806317caf6f11161022657806317caf6f1146103665780631eaaa0451461036e5780633a0196af146103a25780633b1e3eb8146103c55780634031a120146103e25761025e565b80630695dc5614610263578063081e3eda146102ba578063088f7e4d146102d45780630ba84cd2146102fc5780631526fe2714610319575b600080fd5b61028f6004803603604081101561027957600080fd5b506001600160a01b0381351690602001356107a3565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190f35b6102c2610830565b60408051918252519081900360200190f35b6102fa600480360360208110156102ea57600080fd5b50356001600160a01b0316610836565b005b6102fa6004803603602081101561031257600080fd5b50356108b0565b6103366004803603602081101561032f57600080fd5b503561094e565b604080516001600160a01b0390951685526020850193909352838301919091526060830152519081900360800190f35b6102c261098f565b6102fa6004803603606081101561038457600080fd5b508035906001600160a01b0360208201351690604001351515610995565b6102fa600480360360408110156103b857600080fd5b5080359060200135610b9b565b6102fa600480360360208110156103db57600080fd5b5035610e14565b6102fa610f0c565b6102fa6004803603604081101561040057600080fd5b5080359060200135610f78565b610415611169565b604080516001600160a01b039092168252519081900360200190f35b6102c26004803603604081101561044757600080fd5b506001600160a01b03813516906020013561117d565b6104656113dc565b6040805161ffff9092168252519081900360200190f35b6102c26113e2565b6102fa6004803603602081101561049a57600080fd5b503515156113e8565b6102fa600480360360208110156104b957600080fd5b50356114b2565b6102fa600480360360208110156104d657600080fd5b503561167e565b6102fa600480360360408110156104f357600080fd5b506001600160a01b038135169060200135151561177e565b6102fa6004803603602081101561052157600080fd5b503561ffff16611836565b6105586004803603604081101561054257600080fd5b506001600160a01b0381351690602001356118f5565b60408051938452602084019290925282820152519081900360600190f35b61057e61197b565b604080519115158252519081900360200190f35b6102fa611984565b6102fa600480360360608110156105b057600080fd5b508035906020810135906040013515156119a7565b6102fa611a78565b6102c2611b1a565b610415611b1f565b6102c2600480360360408110156105f357600080fd5b5080359060200135611b2e565b6102fa6004803603606081101561061657600080fd5b50803590602081013590604001356001600160a01b0316611b46565b61065e6004803603604081101561064857600080fd5b50803590602001356001600160a01b0316611da0565b6040805192835260208301919091528051918290030190f35b6102fa6004803603608081101561068d57600080fd5b506001600160a01b038135169060208101359060408101359060600135611dc4565b6102c2600480360360408110156106c557600080fd5b50803590602001356001600160a01b03166121eb565b61057e600480360360208110156106f157600080fd5b50356001600160a01b0316612353565b61057e6004803603602081101561071757600080fd5b50356001600160a01b0316612371565b610465612386565b6102c2612397565b6102fa6004803603602081101561074d57600080fd5b50356001600160a01b031661239d565b610415612454565b6102fa6004803603602081101561077b57600080fd5b50356001600160a01b0316612463565b6104156124c4565b6104156124d3565b6102c26124e7565b60008060006107b0612e48565b505050506001600160a01b039182166000908152600a6020908152604080832093835292815290829020825160c08101845281548516808252600183015493820193909352600282015485169381018490526003820154606082015260048201549094166080850181905260059091015460a09094019390935292909190565b60055490565b61083e6124ed565b6000546001600160a01b0390811691161461088e576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6108b86124ed565b6000546001600160a01b03908116911614610908576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b610910611984565b600481905560408051828152905133917fe2492e003bbe8afa53088b406f0c1cb5d9e280370fc72a74cf116ffd343c4053919081900360200190a250565b6005818154811061095b57fe5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b60075481565b61099d6124ed565b6000546001600160a01b039081169116146109ed576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b6001600160a01b038216600090815260096020526040902054829060ff1615610a5d576040805162461bcd60e51b815260206004820152601960248201527f6e6f6e4475706c6963617465643a206475706c69636174656400000000000000604482015290519081900360640190fd5b8115610a6b57610a6b611984565b60006008544311610a7e57600854610a80565b435b600754909150610a9090866124f1565b6007556001600160a01b0393841660008181526009602090815260408083208054600160ff199091168117909155815160808101835294855291840198895283019384526060830182815260058054928301815590925291517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0600490930292830180546001600160a01b031916919097161790955594517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db1860155517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db28501555050517f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db390910155565b610ba433612353565b158015610bb45750600b5460ff16155b15610bc557323314610bc557600080fd5b600080610bd0612e48565b50336000908152600a60209081526040808320868452825291829020825160c08101845281546001600160a01b03908116825260018084015494830194909452600283015481169482019490945260038201546060820152600482015490931660808401526005015460a0830152851415610c4e5780519250610c74565b8460021415610c635780604001519250610c74565b8460031415610c7457806080015192505b8460011415610c895780602001519150610caf565b8460021415610c9e5780606001519150610caf565b8460031415610caf578060a0015191505b8460011415610cc15760008152610ce7565b8460021415610cd65760006040820152610ce7565b8460031415610ce757600060808201525b8460011415610cfc5760006020820152610d22565b8460021415610d115760006060820152610d22565b8460031415610d2257600060a08201525b336000818152600a602090815260408083208884528252808320855181546001600160a01b03199081166001600160a01b03928316178355938701516001830155868301516002830180548616918316919091179055606087015160038301556080870151600480840180549096169183169190911790945560a087015160059092019190915581516323b872dd60e01b8152309381019390935260248301949094526044820186905251928616926323b872dd9260648084019391929182900301818387803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b505050505050505050565b610e1c6124ed565b6000546001600160a01b03908116911614610e6c576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b603281118015610e7d57506101f481105b610ece576040805162461bcd60e51b815260206004820152601a60248201527f626f6f7374206d7573742062652077697468696e2072616e6765000000000000604482015290519081900360640190fd5b600c81905560408051828152905133917f7e10cb5e85e8940bf0ce60fffe269453dc77c2580950f4fecea7e42b5bb61a7b919081900360200190a250565b610f146124ed565b6000546001600160a01b03908116911614610f64576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b600b805460ff19811660ff90911615179055565b60026001541415610fd0576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155610fde33612353565b158015610fee5750600b5460ff16155b15610fff57323314610fff57600080fd5b60006005838154811061100e57fe5b600091825260208083208684526006825260408085203386529092529220805460049092029092019250831115611081576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b61108a846114b2565b60006110c782600101546110c1670de0b6b3a76400006110bb8760030154876000015461254b90919063ffffffff16565b906125a4565b906125e6565b905080156110da576110da338287612628565b83156111045781546110ec90856125e6565b82558254611104906001600160a01b03163386612762565b6003830154825461112291670de0b6b3a7640000916110bb9161254b565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a3505060018055505050565b60035461010090046001600160a01b031681565b600b5460009061010090046001600160a01b031661119d575060006113d6565b6111a5612e48565b506001600160a01b038084166000908152600a602090815260408083208684528252808320815160c0810183528154861680825260018301548286018190526002840154881683860152600384015460608401526004808501548916608085015260059094015460a0840152600b54855163a45d503960e01b8152948501929092526024840152925190956101009093049092169263a45d503992604480840193829003018186803b15801561125a57600080fd5b505afa15801561126e573d6000803e3d6000fd5b505050506040513d602081101561128457600080fd5b5051600b546040808501516060860151825163a45d503960e01b81526001600160a01b03928316600482015260248101919091529151939450600093610100909304169163a45d503991604480820192602092909190829003018186803b1580156112ee57600080fd5b505afa158015611302573d6000803e3d6000fd5b505050506040513d602081101561131857600080fd5b5051600b54608085015160a08601516040805163a45d503960e01b81526001600160a01b0393841660048201526024810192909252519394506000936101009093049091169163a45d503991604480820192602092909190829003018186803b15801561138457600080fd5b505afa158015611398573d6000803e3d6000fd5b505050506040513d60208110156113ae57600080fd5b5051600c549091508383018201906113ce906064906110bb90849061254b565b955050505050505b92915050565b6103e881565b60085481565b6113f06124ed565b6000546001600160a01b03908116911614611440576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b6003805460ff19168215801591909117909155611485576040517f508560e15717a4e9058b9a19d806cb679004a1bd953376f71fda71c141e5dc5390600090a16114af565b6040517fa2927d972f7cfc5ff8b7ad79f9adf0bdb885d0e569f40d0037df2e1299616ae090600090a15b50565b6000600582815481106114c157fe5b90600052602060002090600402019050806002015443116114e257506114af565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561152c57600080fd5b505afa158015611540573d6000803e3d6000fd5b505050506040513d602081101561155657600080fd5b5051905080158061156957506001820154155b1561157b5750436002909101556114af565b600061158b836002015443611b2e565b905060006115b86007546110bb86600101546115b26004548761254b90919063ffffffff16565b9061254b565b600354600e54604080516340c10f1960e01b81526001600160a01b03928316600482015260248101859052905193945061010090920416916340c10f19916044808201926020929091908290030181600087803b15801561161857600080fd5b505af115801561162c573d6000803e3d6000fd5b505050506040513d602081101561164257600080fd5b50611669905061165e846110bb84670de0b6b3a764000061254b565b6003860154906124f1565b60038501555050436002909201919091555050565b600260015414156116d6576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001819055506000600582815481106116ed57fe5b60009182526020808320858452600682526040808520338087529352842080548582556001820195909555600490930201805490945091929161173d916001600160a01b03919091169083612762565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a35050600180555050565b6117866124ed565b6000546001600160a01b039081169116146117d6576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b6001600160a01b038216600081815260026020908152604091829020805460ff1916851515908117909155825190815291517fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f264409281900390910190a25050565b61183e6124ed565b6000546001600160a01b0390811691161461188e576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b6103e861ffff821611156118d35760405162461bcd60e51b8152600401808060200182810382526048815260200180612e9a6048913960600191505060405180910390fd5b600d805461ffff909216600160a01b0261ffff60a01b19909216919091179055565b6000806000611902612e48565b505050506001600160a01b039182166000908152600a6020908152604080832093835292815290829020825160c08101845281548516815260018201549281018390526002820154851693810193909352600381015460608401819052600482015490941660808401526005015460a090920182905292565b600b5460ff1681565b60055460005b818110156119a35761199b816114b2565b60010161198a565b5050565b6119af6124ed565b6000546001600160a01b039081169116146119ff576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b8015611a0d57611a0d611984565b611a4a82611a4460058681548110611a2157fe5b9060005260206000209060040201600101546007546125e690919063ffffffff16565b906124f1565b6007819055508160058481548110611a5e57fe5b906000526020600020906004020160010181905550505050565b611a806124ed565b6000546001600160a01b03908116911614611ad0576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600181565b6000546001600160a01b031690565b6000611b3f60016115b284866125e6565b9392505050565b60026001541415611b9e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155611bac33612353565b158015611bbc5750600b5460ff16155b15611bcd57323314611bcd57600080fd5b600060058481548110611bdc57fe5b60009182526020808320878452600682526040808520338652909252922060049091029091019150611c0d856114b2565b600084118015611c275750600d546001600160a01b031615155b8015611c3b57506001600160a01b03831615155b8015611c5057506001600160a01b0383163314155b15611cc257600d5460408051630c7f7b6b60e01b81523360048201526001600160a01b03868116602483015291519190921691630c7f7b6b91604480830192600092919082900301818387803b158015611ca957600080fd5b505af1158015611cbd573d6000803e3d6000fd5b505050505b805415611d0f576000611cfa82600101546110c1670de0b6b3a76400006110bb8760030154876000015461254b90919063ffffffff16565b90508015611d0d57611d0d338288612628565b505b8315611d3b578154611d2c906001600160a01b03163330876127b9565b8054611d3890856124f1565b81555b60038201548154611d5991670de0b6b3a7640000916110bb9161254b565b6001820155604080518581529051869133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a3505060018055505050565b60066020908152600092835260408084209091529082529020805460019091015482565b611dcd33612353565b158015611ddd5750600b5460ff16155b15611dee57323314611dee57600080fd5b600b60019054906101000a90046001600160a01b03166001600160a01b031663138b7338856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611e5057600080fd5b505afa158015611e64573d6000803e3d6000fd5b505050506040513d6020811015611e7a57600080fd5b5051611ec2576040805162461bcd60e51b81526020600482015260126024820152716f6e6c7920617070726f766564204e46547360701b604482015290519081900360640190fd5b6000846001600160a01b03166370a08231336040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611f1157600080fd5b505afa158015611f25573d6000803e3d6000fd5b505050506040513d6020811015611f3b57600080fd5b505111611f8f576040805162461bcd60e51b815260206004820181905260248201527f7573657220646f6573206e6f74206861766520737065636966696564204e4654604482015290519081900360640190fd5b60008181526006602090815260408083203384529091529020805415611ff5576040805162461bcd60e51b81526020600482015260166024820152751b9bdd08185b1b1bddd959081d1bc819195c1bdcda5d60521b604482015290519081900360640190fd5b604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b038716916323b872dd91606480830192600092919082900301818387803b15801561204957600080fd5b505af115801561205d573d6000803e3d6000fd5b50505050612069612e48565b50336000908152600a60209081526040808320858452825291829020825160c08101845281546001600160a01b03908116825260018084015494830194909452600283015481169482019490945260038201546060820152600482015490931660808401526005015460a08301528414156120ef576001600160a01b0386168152612125565b836002141561210c576001600160a01b0386166040820152612125565b8360031415612125576001600160a01b03861660808201525b836001141561213a5760208101859052612160565b836002141561214f5760608101859052612160565b83600314156121605760a081018590525b336000908152600a6020908152604080832095835294815290849020825181546001600160a01b03199081166001600160a01b03928316178355928401516001830155948301516002820180548416918716919091179055606083015160038201556080830151600482018054909316951694909417905560a0015160059092019190915550505050565b600080600584815481106121fb57fe5b600091825260208083208784526006825260408085206001600160a01b03898116875290845281862060049586029093016003810154815484516370a0823160e01b81523098810198909852935191985093969395939492909116926370a08231926024808301939192829003018186803b15801561227957600080fd5b505afa15801561228d573d6000803e3d6000fd5b505050506040513d60208110156122a357600080fd5b50516002850154909150431180156122ba57508015155b1561231d5760006122cf856002015443611b2e565b905060006122f66007546110bb88600101546115b26004548761254b90919063ffffffff16565b9050612318612311846110bb84670de0b6b3a764000061254b565b85906124f1565b935050505b61234883600101546110c1670de0b6b3a76400006110bb86886000015461254b90919063ffffffff16565b979650505050505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60096020526000908152604090205460ff1681565b600d54600160a01b900461ffff1681565b600c5481565b6123a56124ed565b6000546001600160a01b039081169116146123f5576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b600b80546001600160a01b0383166101008102610100600160a81b031990921691909117909155604080519182525133917ffc9ae9e2d54c8ba3ae37c8a337ab3650824f22456385a15a268e231f48494370919081900360200190a250565b600e546001600160a01b031681565b61246b6124ed565b6000546001600160a01b039081169116146124bb576040805162461bcd60e51b81526020600482018190526024820152600080516020612f53833981519152604482015290519081900360640190fd5b6114af81612813565b600d546001600160a01b031681565b600b5461010090046001600160a01b031681565b60045481565b3390565b600082820183811015611b3f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261255a575060006113d6565b8282028284828161256757fe5b0414611b3f5760405162461bcd60e51b8152600401808060200182810382526021815260200180612f326021913960400191505060405180910390fd5b6000611b3f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128b3565b6000611b3f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612955565b600e5460408051630c5601e760e21b81526001600160a01b0386811660048301526024820186905291516000939290921691633158079c9160448082019260209290919082900301818787803b15801561268157600080fd5b505af1158015612695573d6000803e3d6000fd5b505050506040513d60208110156126ab57600080fd5b506126c1905060646110bb856115b2888761117d565b90506126cd33846129af565b801561275c57600354604080516340c10f1960e01b81526001600160a01b038781166004830152602482018590529151610100909304909116916340c10f19916044808201926020929091908290030181600087803b15801561272f57600080fd5b505af1158015612743573d6000803e3d6000fd5b505050506040513d602081101561275957600080fd5b50505b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526127b4908490612bda565b505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261275c908590612bda565b6001600160a01b0381166128585760405162461bcd60e51b8152600401808060200182810382526026815260200180612f0c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000818361293f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129045781810151838201526020016128ec565b50505050905090810190601f1680156129315780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161294b57fe5b0495945050505050565b600081848411156129a75760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156129045781810151838201526020016128ec565b505050900390565b600d546001600160a01b0316158015906129d55750600d54600160a01b900461ffff1615155b156119a357600d5460408051634a9fefc760e01b81526001600160a01b03858116600483015291516000939290921691634a9fefc791602480820192602092909190829003018186803b158015612a2b57600080fd5b505afa158015612a3f573d6000803e3d6000fd5b505050506040513d6020811015612a5557600080fd5b5051600d54909150600090612a7e90612710906110bb908690600160a01b900461ffff1661254b565b90506001600160a01b03821615801590612a985750600081115b1561275c57600354604080516340c10f1960e01b81526001600160a01b038581166004830152602482018590529151610100909304909116916340c10f19916044808201926020929091908290030181600087803b158015612af957600080fd5b505af1158015612b0d573d6000803e3d6000fd5b505050506040513d6020811015612b2357600080fd5b5050600d5460408051631b82d29760e31b81526001600160a01b038581166004830152602482018590529151919092169163dc1694b891604480830192600092919082900301818387803b158015612b7a57600080fd5b505af1158015612b8e573d6000803e3d6000fd5b50506040805184815290516001600160a01b038087169450881692507f86ddab457291316e0f5496737e5ca67c4037234c32c3be04c48ae96186893a7b9181900360200190a350505050565b6060612c2f826040518060400160405280602081526020017f5361666542455032303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612c8b9092919063ffffffff16565b8051909150156127b457808060200190516020811015612c4e57600080fd5b50516127b45760405162461bcd60e51b815260040180806020018281038252602a815260200180612ee2602a913960400191505060405180910390fd5b6060612c9a8484600085612ca2565b949350505050565b6060612cad85612e0f565b612cfe576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612d3d5780518252601f199092019160209182019101612d1e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612d9f576040519150601f19603f3d011682016040523d82523d6000602084013e612da4565b606091505b50915091508115612db8579150612c9a9050565b805115612dc85780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156129045781810151838201526020016128ec565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590612c9a575050151592915050565b6040518060c0016040528060006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b0316815260200160008152509056fe736574526566657272616c436f6d6d697373696f6e526174653a20696e76616c696420726566657272616c20636f6d6d697373696f6e207261746520626173697320706f696e74735361666542455032303a204245503230206f7065726174696f6e20646964206e6f7420737563636565644f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220ab00c4d4730234023494f6c9f5f415e7a9b0e299b7d6b2bd8b57b013051846d364736f6c634300060c0033