Contract 0x83053944b99c4f25557570b301106f2fcf5019a2 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xefdb0ef2e5e9c121e123d3ba35058653b213491935f0a813acef9b6eebb16e60Set Manager225020182023-06-01 1:07:41322 days 15 hrs ago0xf8e8cc9607bd51f16cecc022775da879447e1fe5 IN  0x83053944b99c4f25557570b301106f2fcf5019a20 BTT23.5855
0x66791de443b5e14938750a6f7313118b9f2bd09d16aba9d01f24b52de19e7a050x60806040225017002023-06-01 0:56:45322 days 15 hrs ago0xf8e8cc9607bd51f16cecc022775da879447e1fe5 IN  Create: ElkSingleStakeFactory0 BTT2,175.4335
[ Download CSV Export 
Parent Txn Hash Block From To Value
Index Block
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ElkSingleStakeFactory

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion, BSL 1.1 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at bttcscan.com on 2023-06-01
*/

// SPDX-License-Identifier: BUSL-1.1
//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>
// - Elijah <[email protected]>
// - Snake <[email protected]>

// File: contracts/interfaces/ISingleStakeFactory.sol

pragma solidity >=0.8.0;

interface ISingleStakeFactory {
    event ContractCreated(address _newContract);
    event ManagerSet(address _farmManager);
    event FeeSet(uint256 _newFee);
    event FeesRecovered(uint256 _balanceRecovered);

    function getSingleStake(
        address _creator,
        address _stakingToken
    ) external view returns (address);

    function allFarms(uint _index) external view returns (address);

    function farmManager() external view returns (address);

    function getCreator(address _farmAddress) external view returns (address);

    function fee() external view returns (uint256);

    function maxFee() external view returns (uint256);

    function createNewSingleStake(
        address _stakingTokenAddress,
        address[] memory _rewardTokenAddresses,
        uint256 _rewardsDuration,
        uint16 _depositFeeBps,
        uint16[] memory _withdrawalFeesBps,
        uint32[] memory _withdrawalFeeSchedule
    ) external;

    function allFarmsLength() external view returns (uint);

    function setManager(address _managerAddress) external;

    function setFee(uint256 _newFee) external;

    function withdrawFees() external;

    function overrideOwnership(address _farmAddress) external;
}

// File: @openzeppelin/[email protected]/security/ReentrancyGuard.sol


// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

// File: @openzeppelin/[email protected]/utils/Address.sol


// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

// File: @openzeppelin/[email protected]/token/ERC20/extensions/draft-IERC20Permit.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

// File: @openzeppelin/[email protected]/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// File: contracts/interfaces/IStaking.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>

pragma solidity >=0.8.0;


interface IStaking {
    /* ========== STATE VARIABLES ========== */
    function stakingToken() external returns (IERC20);

    function totalSupply() external returns (uint256);

    function balances(address _account) external returns (uint256);

    /* ========== MUTATIVE FUNCTIONS ========== */
    function stake(uint256 _amount) external;

    function withdraw(uint256 _amount) external;

    function exit() external;

    function recoverERC20(
        address _tokenAddress,
        address _recipient,
        uint256 _amount
    ) external;

    /* ========== EVENTS ========== */

    // Emitted on staking
    event Staked(address indexed account, uint256 amount);

    // Emitted on withdrawal (including exit)
    event Withdrawn(address indexed account, uint256 amount);

    // Emitted on token recovery
    event Recovered(
        address indexed token,
        address indexed recipient,
        uint256 amount
    );
}

// File: contracts/interfaces/IStakingFee.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>

pragma solidity >=0.8.0;


interface IStakingFee is IStaking {
    /* ========== STATE VARIABLES ========== */
    function feesUnit() external returns (uint256);

    function maxFee() external returns (uint256);

    function withdrawalFeeSchedule(uint256) external returns (uint256);

    function withdrawalFeesBps(uint256) external returns (uint256);

    function depositFeeBps() external returns (uint256);

    function collectedFees() external returns (uint256);

    function userLastStakedTime(address _user) external view returns (uint32);

    /* ========== VIEWS ========== */

    function depositFee(uint256 _depositAmount) external view returns (uint256);

    function withdrawalFee(
        address _account,
        uint256 _withdrawalAmount
    ) external view returns (uint256);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function recoverFees(address _recipient) external;
    
    /* ========== EVENTS ========== */

    // Emitted when fees are (re)configured
    event FeesSet(
        uint16 _depositFeeBps,
        uint16[] _withdrawalFeesBps,
        uint32[] _feeSchedule
    );

    // Emitted when a deposit fee is collected
    event DepositFeesCollected(address indexed _user, uint256 _amount);

    // Emitted when a withdrawal fee is collected
    event WithdrawalFeesCollected(address indexed _user, uint256 _amount);

    // Emitted when fees are recovered by governance
    event FeesRecovered(uint256 _amount);
}

// File: contracts/interfaces/IStakingRewards.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>

pragma solidity >=0.8.0;


interface IStakingRewards is IStakingFee {
    /* ========== STATE VARIABLES ========== */

    function rewardTokens(uint256) external view returns (IERC20);

    function rewardTokenAddresses(
        address _rewardAddress
    ) external view returns (bool);

    function periodFinish() external view returns (uint256);

    function rewardsDuration() external view returns (uint256);

    function lastUpdateTime() external view returns (uint256);

    function rewardRates(
        address _rewardAddress
    ) external view returns (uint256);

    function rewardPerTokenStored(
        address _rewardAddress
    ) external view returns (uint256);

    // wallet address => token address => amount
    function userRewardPerTokenPaid(
        address _walletAddress,
        address _tokenAddress
    ) external view returns (uint256);

    function rewards(
        address _walletAddress,
        address _tokenAddress
    ) external view returns (uint256);

    /* ========== VIEWS ========== */

    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken(
        address _tokenAddress
    ) external view returns (uint256);

    function earned(
        address _tokenAddress,
        address _account
    ) external view returns (uint256);

    /* ========== MUTATIVE FUNCTIONS ========== */

    function getReward(address _tokenAddress, address _recipient) external;

    function getRewards(address _recipient) external;

    // Must send reward before calling this!
    function startEmission(
        uint256[] memory _rewards,
        uint256 _duration
    ) external;

    function stopEmission(address _refundAddress) external;

    function recoverLeftoverReward(
        address _tokenAddress,
        address _recipient
    ) external;

    function addRewardToken(address _tokenAddress) external;

    function rewardTokenIndex(
        address _tokenAddress
    ) external view returns (int8);

    /* ========== EVENTS ========== */

    // Emitted when a reward is paid to an account
    event RewardPaid(
        address indexed _token,
        address indexed _account,
        uint256 _reward
    );

    // Emitted when a leftover reward is recovered
    event LeftoverRewardRecovered(address indexed _recipient, uint256 _amount);

    // Emitted when rewards emission is started
    event RewardsEmissionStarted(uint256[] _rewards, uint256 _duration);

    // Emitted when rewards emission ends
    event RewardsEmissionEnded();
}

// File: contracts/interfaces/ISingleStakingRewards.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>

pragma solidity >=0.8.0;


interface ISingleStakingRewards is IStakingRewards {
    event CompoundedReward(uint256 oldBalance, uint256 newBalance);

    function compoundSingleStakingRewards() external;
}

// File: @openzeppelin/[email protected]/token/ERC20/extensions/IERC20Metadata.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;


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

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

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

// File: @openzeppelin/[email protected]/token/ERC20/utils/SafeERC20.sol


// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;




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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

// File: @openzeppelin/[email protected]/utils/Context.sol


// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

// File: @openzeppelin/[email protected]/token/ERC20/ERC20.sol


// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;




/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

// File: @openzeppelin/[email protected]/access/Ownable.sol


// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^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 Ownable is Context {
    address private _owner;

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

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

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

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

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

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

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

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

// File: contracts/Staking.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>
// - Elijah <[email protected]>
// - Snake <[email protected]>

pragma solidity >=0.8.0;






/**
 * Base contract implementing simple ERC20 token staking functionality (no staking rewards).
 */
contract Staking is ReentrancyGuard, Ownable, IStaking {
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    /// @notice Staking token interface
    IERC20 public immutable stakingToken;

    /// @notice Total supply of the staking token
    uint256 public totalSupply;

    /// @notice Account balances
    mapping(address => uint256) public balances;

    // Scaling factor: supply is always stored as wei (10**18) regardless of the token's decimals
    uint256 private supplyScalingFactor;

    /* ========== CONSTRUCTOR ========== */

    /// @param _stakingTokenAddress address of the token used for staking (must be ERC20)
    constructor(address _stakingTokenAddress) {
        require(_stakingTokenAddress != address(0), "E1");
        stakingToken = IERC20(_stakingTokenAddress);
        supplyScalingFactor = 1e18 / 10**ERC20(_stakingTokenAddress).decimals();
    }

    /**
     * @dev Stake tokens.
     * Note: the contract must have sufficient allowance for the staking token.
     * @param _amount amount to stake
     */
    function stake(uint256 _amount) public nonReentrant {
        uint256 originalAmount = _amount;
        _amount = _beforeStake(msg.sender, _amount);
        require(_amount > 0 && originalAmount > 0, "E2"); // Check after the hook
        totalSupply += _amount * supplyScalingFactor;
        balances[msg.sender] += _amount;
        stakingToken.safeTransferFrom(msg.sender, address(this), originalAmount);
        emit Staked(msg.sender, _amount);
    }

    /**
     * @dev Withdraw previously staked tokens.
     * @param _amount amount to withdraw
     */
    function withdraw(uint256 _amount) public nonReentrant {
        uint256 originalAmount = _amount;
        _amount = _beforeWithdraw(msg.sender, _amount);
        require(
            _amount > 0 && _amount <= balances[msg.sender] && originalAmount <= balances[msg.sender],
            "E3"
        ); // Check after the hook
        totalSupply -= originalAmount * supplyScalingFactor;
        balances[msg.sender] -= originalAmount;
        stakingToken.safeTransfer(msg.sender, _amount);
        emit Withdrawn(msg.sender, _amount);
    }

    /**
     * @dev Exit the farm, i.e., withdraw the entire token balance of the calling account
     */
    function exit() external {
        _beforeExit(msg.sender);
        withdraw(balances[msg.sender]);
    }

    /* ========== RESTRICTED FUNCTIONS ========== */

    /**
     * @dev Recover ERC20 tokens held in the contract.
     * Note: privileged governance function to recover tokens mistakenly sent to this contract address.
     * This function cannot be used to withdraw staking tokens.
     * @param _tokenAddress address of the token to recover
     * @param _recipient recovery address
     * @param _amount amount to withdraw
     * @ return withdrawn amount (may differ from input amount due to e.g., fees)
     */
    function recoverERC20(
        address _tokenAddress,
        address _recipient,
        uint256 _amount
    ) external nonReentrant onlyOwner {
        require(
            _tokenAddress != address(stakingToken),
            "E4"
        );
        _beforeRecoverERC20(_tokenAddress, _recipient, _amount);
        IERC20 token = IERC20(_tokenAddress);
        token.safeTransfer(_recipient, _amount);
        emit Recovered(_tokenAddress, _recipient, _amount);
    }

    /* ========== HOOKS ========== */

    /**
     * @dev Internal hook called before staking (in the stake() function).
     * @ param _account staker address
     * @param _amount amount being staken
     * @return amount to stake (may be changed by the hook)
     */
    function _beforeStake(
        address /*_account*/,
        uint256 _amount
    ) internal virtual returns (uint256) {
        return _amount;
    }

    /**
     * @dev Internal hook called before withdrawing (in the withdraw() function).
     * @ param _account withdrawer address
     * @param _amount amount being withdrawn
     * @return amount to withdraw (may be changed by the hook)
     */
    function _beforeWithdraw(
        address /*_account*/,
        uint256 _amount
    ) internal virtual returns (uint256) {
        return _amount;
    }

    /**
     * @dev Internal hook called before exiting (in the exit() function).
     * Note: since exit() calls withdraw() internally, the _beforeWithdraw() hook fill fire too.
     * @param _account address exiting
     */
    function _beforeExit(address _account) internal virtual {}

    /**
     * @dev Internal hook called before recovering tokens (in the recoverERC20() function).
     * @param _tokenAddress address of the token being recovered
     * @param _recipient recovery address
     * @param _amount amount being withdrawn
     */
    function _beforeRecoverERC20(
        address _tokenAddress,
        address _recipient,
        uint256 _amount
    ) internal virtual {}
}

// File: contracts/StakingFee.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>
// - Elijah <[email protected]>
// - Snake <[email protected]>

pragma solidity >=0.8.0;



/**
 * Contract implementing simple ERC20 token staking functionality and supporting deposit/withdrawal fees (no staking rewards).
 */
contract StakingFee is Staking, IStakingFee {
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    /// @notice Constant Fee Unit (1e4)
    uint256 public constant feesUnit = 10000;

    /// @notice Maximum fee (20%)
    uint256 public constant maxFee = 2000;

    /// @notice Schedule of withdrawal fees represented as a sorted array of durations
    /// @dev example: 10% after 1 hour, 1% after a day, 0% after a week => [3600, 86400]
    uint256[] public withdrawalFeeSchedule;

    /// @notice Withdrawal fees described in basis points (fee unit) represented as an array of the same length as withdrawalFeeSchedule
    /// @dev example: 10% after 1 hour, 1% after a day, 0% after a week => [1000, 100]
    uint256[] public withdrawalFeesBps;

    /// @notice Deposit (staking) fee in basis points (fee unit)
    uint256 public depositFeeBps;

    /// @notice Counter of collected fees
    uint256 public collectedFees;

    /// @notice Last staking time for each user
    mapping(address => uint32) public userLastStakedTime;

    /* ========== CONSTRUCTOR ========== */

    /**
     * @param _stakingTokenAddress address of the token used for staking (must be ERC20)
     * @param _depositFeeBps deposit fee in basis points
     * @param _withdrawalFeesBps aligned to fee schedule
     * @param _withdrawalFeeSchedule assumes a sorted array
     */
    constructor(
        address _stakingTokenAddress,
        uint16 _depositFeeBps,
        uint16[] memory _withdrawalFeesBps,
        uint32[] memory _withdrawalFeeSchedule
    ) Staking(_stakingTokenAddress) {
        _setFees(_depositFeeBps, _withdrawalFeesBps, _withdrawalFeeSchedule);
    }

    /* ========== VIEWS ========== */

    /**
     * @dev Calculate the deposit fee for a given amount.
     * @param _depositAmount amount to stake
     * @return fee paid upon deposit
     */
    function depositFee(uint256 _depositAmount) public view returns (uint256) {
        return depositFeeBps > 0 ? (_depositAmount * depositFeeBps) / feesUnit : 0;
    }

    /**
     * @dev Calculate the withdrawal fee for a given amount.
     * @param _account user wallet address
     * @param _withdrawalAmount amount to withdraw
     * @return fee paid upon withdrawal
     */
    function withdrawalFee(
        address _account,
        uint256 _withdrawalAmount
    ) public view returns (uint256) {
        uint256 userLastStakedTimestampDiff = block.timestamp - userLastStakedTime[_account];
        uint256 withdrawalFeeAmount;
        for (uint i = 0; i < withdrawalFeeSchedule.length; ++i) {
            if (userLastStakedTimestampDiff < withdrawalFeeSchedule[i]) {
                withdrawalFeeAmount = (_withdrawalAmount * withdrawalFeesBps[i]) / feesUnit;
                break;
            }
        }
        return withdrawalFeeAmount;
    }


    /* ========== RESTRICTED FUNCTIONS ========== */

    /**
     * @dev Recover collected fees held in the contract.
     * Note: privileged function for governance
     * @param _recipient fee recovery address
     */
    function recoverFees(address _recipient) external onlyOwner nonReentrant {
        _beforeRecoverFees(_recipient);
        uint256 previousFees = collectedFees;
        collectedFees = 0;
        emit FeesRecovered(previousFees);
        stakingToken.safeTransfer(_recipient, previousFees);
    }

    /* ========== PRIVATE FUNCTIONS ========== */

    /**
     * @dev Configure the fees for this contract.
     * @param _depositFeeBps deposit fee in basis points
     * @param _withdrawalFeesBps withdrawal fees in basis points
     * @param _withdrawalFeeSchedule withdrawal fees schedule
     */
    function _setFees(
        uint16 _depositFeeBps,
        uint16[] memory _withdrawalFeesBps,
        uint32[] memory _withdrawalFeeSchedule
    ) private {
        require(_withdrawalFeeSchedule.length == _withdrawalFeesBps.length && _withdrawalFeeSchedule.length <= 10 && _depositFeeBps <= maxFee, "E5");

        uint32 lastFeeSchedule = 0;
        uint256 lastWithdrawalFee = maxFee + 1;

        for (uint i = 0; i < _withdrawalFeeSchedule.length; ++i) {
            require(_withdrawalFeeSchedule[i] > lastFeeSchedule, "E7");
            require(_withdrawalFeesBps[i] < lastWithdrawalFee, "E8");
            lastFeeSchedule = _withdrawalFeeSchedule[i];
            lastWithdrawalFee = _withdrawalFeesBps[i];
        }

        withdrawalFeeSchedule = _withdrawalFeeSchedule;
        withdrawalFeesBps = _withdrawalFeesBps;
        depositFeeBps = _depositFeeBps;

        emit FeesSet(
            _depositFeeBps,
            _withdrawalFeesBps,
            _withdrawalFeeSchedule
        );
    }

    /* ========== HOOKS ========== */

    /**
     * @dev Override _beforeStake() hook to collect the deposit fee and update associated state
     */
    function _beforeStake(
        address _account,
        uint256 _amount
    ) internal virtual override returns (uint256) {
        uint256 fee = depositFee(_amount);
        userLastStakedTime[_account] = uint32(block.timestamp);
        if (fee > 0) {
            collectedFees += fee;
            emit DepositFeesCollected(_account, fee);
        }
        return super._beforeStake(_account, _amount - fee);
    }

    /**
     * @dev Override _beforeWithdrawl() hook to collect the withdrawal fee and update associated state
     */
    function _beforeWithdraw(
        address _account,
        uint256 _amount
    ) internal virtual override returns (uint256) {
        uint256 fee = withdrawalFee(_account, _amount);
        if (fee > 0) {
            collectedFees += fee;
            emit WithdrawalFeesCollected(_account, fee);
        }
        return super._beforeWithdraw(_account, _amount - fee);
    }

    /**
     * @dev Internal hook called before recovering fees (in the recoverFees() function).
     * @param _recipient recovery address
     */
    function _beforeRecoverFees(address _recipient) internal virtual {}
}

// File: contracts/StakingRewards.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>
// - Elijah <[email protected]>
// - Snake <[email protected]>

pragma solidity >=0.8.0;



/**
 * Contract implementing simple ERC20 token staking functionality with staking rewards and deposit/withdrawal fees.
 */
contract StakingRewards is StakingFee, IStakingRewards {
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    /// @notice List of reward token interfaces
    IERC20[] public rewardTokens;

    /// @notice Reward token addresses (maps every reward token address to true, others to false)
    mapping(address => bool) public rewardTokenAddresses;

    /// @notice Timestamp when rewards stop emitting
    uint256 public periodFinish;

    /// @notice Duration for reward emission
    uint256 public rewardsDuration;

    /// @notice Last time the rewards were updated
    uint256 public lastUpdateTime;

    /// @notice Reward token rates (maps every reward token to an emission rate, i.e., how many tokens emitted per second)
    mapping(address => uint256) public rewardRates;

    /// @notice How many tokens are emitted per staked token
    mapping(address => uint256) public rewardPerTokenStored;

    /// @notice How many reward tokens were paid per user (token address => wallet address => amount)
    mapping(address => mapping(address => uint256))
        public userRewardPerTokenPaid;

    /// @notice Accumulator of reward tokens per user (token address => wallet address => amount)
    mapping(address => mapping(address => uint256)) public rewards;

    /* ========== CONSTRUCTOR ========== */

    /**
     * @param _stakingTokenAddress address of the token used for staking (must be ERC20)
     * @param _rewardTokenAddresses addresses the reward tokens (must be ERC20)
     * @param _rewardsDuration reward emission duration
     * @param _depositFeeBps deposit fee in basis points
     * @param _withdrawalFeesBps aligned to fee schedule
     * @param _withdrawalFeeSchedule assumes a sorted array
     */
    constructor(
        address _stakingTokenAddress,
        address[] memory _rewardTokenAddresses,
        uint256 _rewardsDuration,
        uint16 _depositFeeBps,
        uint16[] memory _withdrawalFeesBps,
        uint32[] memory _withdrawalFeeSchedule
    )
        StakingFee(
            _stakingTokenAddress,
            _depositFeeBps,
            _withdrawalFeesBps,
            _withdrawalFeeSchedule
        )
    {
        require(_rewardTokenAddresses.length > 0, "E9");
        // update reward data structures
        for (uint i = 0; i < _rewardTokenAddresses.length; ++i) {
            address tokenAddress = _rewardTokenAddresses[i];
            _addRewardToken(tokenAddress);
        }
        rewardsDuration = _rewardsDuration;
    }

    /* ========== VIEWS ========== */

    /**
     * @notice Return the last time rewards are applicable (the lowest of the current timestamp and the rewards expiry timestamp).
     * @return timestamp
     */
    function lastTimeRewardApplicable() public view returns (uint256) {
        return block.timestamp < periodFinish ? block.timestamp : periodFinish;
    }

    /**
     * @notice Return the reward per staked token for a given reward token address.
     * @param _tokenAddress reward token address
     * @return amount of reward per staked token
     */
    function rewardPerToken(
        address _tokenAddress
    ) public view returns (uint256) {
        if (totalSupply == 0) {
            return rewardPerTokenStored[_tokenAddress];
        }
        return
            rewardPerTokenStored[_tokenAddress] +
            ((lastTimeRewardApplicable() - lastUpdateTime) *
                rewardRates[_tokenAddress] *
                10**ERC20(_tokenAddress).decimals()) /
            totalSupply;
    }

    /**
     * @notice Return the total reward earned by a user for a given reward token address.
     * @param _tokenAddress reward token address
     * @param _account user wallet address
     * @return amount earned
     */
    function earned(
        address _tokenAddress,
        address _account
    ) public view returns (uint256) {
        return
            (balances[_account] *
                (rewardPerToken(_tokenAddress) -
                    userRewardPerTokenPaid[_tokenAddress][_account])) /
            10**ERC20(_tokenAddress).decimals() +
            rewards[_tokenAddress][_account];
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    /**
     * @dev claim the specified token reward for a staker
     * @param _tokenAddress the address of the reward token
     * @param _recipient the address of the staker that should receive the reward
     * @ return amount of reward received
     */
    function getReward(
        address _tokenAddress,
        address _recipient
    ) public nonReentrant updateRewards(_recipient) {
        return _getReward(_tokenAddress, _recipient);
    }

    /**
     * @dev claim rewards for all the reward tokens for the staker
     * @param _recipient address of the recipient to receive the rewards
     */
    function getRewards(
        address _recipient
    ) public nonReentrant updateRewards(_recipient) {
        for (uint i = 0; i < rewardTokens.length; ++i) {
            _getReward(address(rewardTokens[i]), _recipient);
        }
    }

    /**
     * @dev Start the emission of rewards to stakers. The owner must send reward tokens to the contract before calling this function.
     * Note: Can only be called by owner when the contract is not emitting rewards.
     * @param _rewards array of rewards amounts for each reward token
     * @param _duration duration in seconds for which rewards will be emitted
     */
    function startEmission(
        uint256[] memory _rewards,
        uint256 _duration
    )
        public
        virtual
        nonReentrant
        onlyOwner
        whenNotEmitting
        updateRewards(address(0))
    {
        require(_duration > 0, "E10");
        require(_rewards.length == rewardTokens.length, "E11");

        _beforeStartEmission(_rewards, _duration);

        rewardsDuration = _duration;

        for (uint i = 0; i < rewardTokens.length; ++i) {
            IERC20 token = rewardTokens[i];
            address tokenAddress = address(token);
            rewardRates[tokenAddress] = _rewards[i] / rewardsDuration;

            // Ensure the provided reward amount is not more than the balance in the contract.
            // This keeps the reward rate in the right range, preventing overflows due to
            // very high values of rewardRate in the earned and rewardsPerToken functions;
            // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
            uint256 balance = rewardTokens[i].balanceOf(address(this));
            if (tokenAddress != address(stakingToken)) {
                require(
                    rewardRates[tokenAddress] <= balance / rewardsDuration,
                    "E3"
                );
            } else {
                // Handle carefully where rewardsToken is the same as stakingToken (need to subtract total supply)
                require(
                    rewardRates[tokenAddress] <=
                        (balance - totalSupply) / rewardsDuration,
                    "E3"
                );
            }
        }

        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp + rewardsDuration;

        emit RewardsEmissionStarted(_rewards, _duration);
    }

    /**
     * @dev stop the reward emission process and transfer the remaining reward tokens to a specified address
     * Note: can only be called by owner when the contract is currently emitting rewards
     * @param _refundAddress the address to receive the remaining reward tokens
     */
    function stopEmission(
        address _refundAddress
    ) external nonReentrant onlyOwner whenEmitting {
        _beforeStopEmission(_refundAddress);
        uint256 remaining = 0;
        if (periodFinish > block.timestamp) {
            remaining = periodFinish - block.timestamp;
        }

        periodFinish = block.timestamp;

        for (uint i = 0; i < rewardTokens.length; ++i) {
            IERC20 token = rewardTokens[i];
            address tokenAddress = address(token);
            uint256 refund = rewardRates[tokenAddress] * remaining;
            if (refund > 0) {
                token.safeTransfer(_refundAddress, refund);
            }
        }

        emit RewardsEmissionEnded();
    }

    /**
     * @dev recover leftover reward tokens and transfer them to a specified recipient
     * Note: can only be called by owner when the contract is not emitting rewards
     * @param _tokenAddress address of the reward token to be recovered
     * @param _recipient address to receive the recovered reward tokens
     */
    function recoverLeftoverReward(
        address _tokenAddress,
        address _recipient
    ) external onlyOwner whenNotEmitting {
        require(totalSupply == 0, "E12");
        if (rewardTokenAddresses[_tokenAddress]) {
            _beforeRecoverLeftoverReward(_tokenAddress, _recipient);
            IERC20 token = IERC20(_tokenAddress);
            uint256 amount = token.balanceOf(address(this));
            if (amount > 0) {
                token.safeTransfer(_recipient, amount);
            }
            emit LeftoverRewardRecovered(_recipient, amount);
        }
    }

    /**
     * @dev add a reward token to the contract
     * Note: can only be called by owner when the contract is not emitting rewards
     * @param _tokenAddress address of the new reward token
     */
    function addRewardToken(
        address _tokenAddress
    ) external onlyOwner whenNotEmitting {
        _addRewardToken(_tokenAddress);
    }

    /**
     * @dev Return the array index of the provided token address (if applicable)
     * @param _tokenAddress address of the LP token
     * @return the array index for _tokenAddress or -1 if it is not a reward token
     */
    function rewardTokenIndex(
        address _tokenAddress
    ) public view returns (int8) {
        if (rewardTokenAddresses[_tokenAddress]) {
            for (uint i = 0; i < rewardTokens.length; ++i) {
                if (address(rewardTokens[i]) == _tokenAddress) {
                    return int8(int256(i));
                }
            }
        }
        return -1;
    }

    /* ========== PRIVATE FUNCTIONS ========== */

    /**
     * @dev Get the reward amount of a token for a specific recipient
     * @param _tokenAddress address of the token
     * @param _recipient address of the recipient
     */
    function _getReward(address _tokenAddress, address _recipient) private {
        require(msg.sender == owner() || msg.sender == _recipient, "E14");
        require(rewardTokenAddresses[_tokenAddress], "E13");
        uint256 reward = rewards[_tokenAddress][_recipient];
        if (reward > 0) {
            rewards[_tokenAddress][_recipient] = 0;
            IERC20(_tokenAddress).safeTransfer(_recipient, reward);
            emit RewardPaid(_tokenAddress, _recipient, reward);
        }
    }

    /**
     * @dev Add a token as a reward token
     * @param _tokenAddress address of the token to be added as a reward token
     */
    function _addRewardToken(address _tokenAddress) private {
        require(rewardTokens.length <= 15, "E15");
        require(_tokenAddress != address(0), "E1");
        if (!rewardTokenAddresses[_tokenAddress]) {
            rewardTokens.push(IERC20(_tokenAddress));
            rewardTokenAddresses[_tokenAddress] = true;
        }
    }

    /* ========== HOOKS ========== */

    /**
     * @dev Override _beforeStake() hook to ensure staking is only possible when rewards are emitting and update the rewards
     */
    function _beforeStake(
        address _account,
        uint256 _amount
    ) internal virtual override whenEmitting updateRewards(_account) returns (uint256) {
        return super._beforeStake(_account, _amount);
    }

    /**
     * @dev Override _beforeExit() hook to claim all rewards for the account exiting
     */
    function _beforeExit(address _account) internal virtual override {
        getRewards(_account); // getRewards calls updateRewards so we don't need to call it explicitly again here
        super._beforeExit(_account);
    }

    /**
     * @dev Override _beforeRecoverERC20() hook to prevent recovery of a reward token
     */
    function _beforeRecoverERC20(
        address _tokenAddress,
        address _recipient,
        uint256 _amount
    ) internal virtual override {
        require(!rewardTokenAddresses[_tokenAddress], "E16");
        super._beforeRecoverERC20(_tokenAddress, _recipient, _amount);
    }

    /**
     * @dev Internal hook called before starting the emission process (in the startEmission() function).
     * @param _rewards array of rewards per token.
     * @param _duration emission duration.
     */
    function _beforeStartEmission(
        uint256[] memory _rewards,
        uint256 _duration
    ) internal virtual {}

    /**
     * @dev Internal hook called before stopping the emission process (in the stopEmission() function).
     * @param _refundAddress address to refund the remaining reward to
     */
    function _beforeStopEmission(address _refundAddress) internal virtual {}

    /**
     * @dev Internal hook called before recovering leftover rewards (in the recoverLeftoverRewards() function).
     * @param _tokenAddress address of the token to recover
     * @param _recipient address to recover the leftover rewards to
     */
    function _beforeRecoverLeftoverReward(
        address _tokenAddress,
        address _recipient
    ) internal virtual {}

    /* ========== MODIFIERS ========== */

    /**
     * @dev Modifier to update rewards of a given account.
     * @param _account account to update rewards for
     */
    modifier updateRewards(address _account) {
        for (uint i = 0; i < rewardTokens.length; ++i) {
            address tokenAddress = address(rewardTokens[i]);
            rewardPerTokenStored[tokenAddress] = rewardPerToken(tokenAddress);
        }
        lastUpdateTime = lastTimeRewardApplicable();
        if (_account != address(0)) {
            for (uint i = 0; i < rewardTokens.length; ++i) {
                address tokenAddress = address(rewardTokens[i]);
                rewards[tokenAddress][_account] = earned(tokenAddress, _account);
                userRewardPerTokenPaid[tokenAddress][_account] = rewardPerTokenStored[tokenAddress];
            }
        }
        _;
    }

    /**
     * @dev Modifier to check if rewards are emitting.
     */
    modifier whenEmitting() {
        require(block.timestamp <= periodFinish, "E18");
        _;
    }

    /**
     * @dev Modifier to check if rewards are not emitting.
     */
    modifier whenNotEmitting() {
        require(block.timestamp > periodFinish, "E17");
        _;
    }
}

// File: contracts/SingleStakingRewards.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>
// - Elijah <[email protected]>
// - Snake <[email protected]>

pragma solidity >=0.8.0;



/**
 * Adds support for multiple booster tokens
 */
contract SingleStakingRewards is StakingRewards, ISingleStakingRewards {
    using SafeERC20 for IERC20;

    /* ========== CONSTRUCTOR ========== */

    /**
     * @param _stakingTokenAddress address of the token used for staking (must be ERC20)
     * @param _rewardTokenAddresses array of addresses of the tokens used for rewards (must be ERC20)
     * @param _rewardsDuration duration of the rewards period
     * @param _depositFeeBps deposit fee in basis points
     * @param _withdrawalFeesBps array of withdrawal fees in basis points
     * @param _withdrawalFeeSchedule array of timestamps for the fee schedule
     */
    constructor(
        address _stakingTokenAddress,
        address[] memory _rewardTokenAddresses,
        uint256 _rewardsDuration,
        uint16 _depositFeeBps,
        uint16[] memory _withdrawalFeesBps,
        uint32[] memory _withdrawalFeeSchedule
    )
        StakingRewards(
            _stakingTokenAddress,
            _rewardTokenAddresses,
            _rewardsDuration,
            _depositFeeBps,
            _withdrawalFeesBps,
            _withdrawalFeeSchedule
        )
    {
        require(
            _stakingTokenAddress != address(0),
            "SingleStakingRewards: NOT_ELKDEX_LP"
        );
    }

    /**
     * @notice Compounds the rewards for the caller
     */
    function compoundSingleStakingRewards() external updateRewards(msg.sender) {
        address stakingTokenAddress = address(stakingToken);
        require(
            rewardTokenAddresses[stakingTokenAddress],
            "SingleStakingRewards: COMPOUND_IMPOSSIBLE"
        );

        uint256 reward = rewards[stakingTokenAddress][msg.sender];

        if (reward > 0) {
            uint256 oldBalance = balances[msg.sender];
            rewards[stakingTokenAddress][msg.sender] = 0;
            balances[msg.sender] += reward;
            totalSupply += reward;

            emit CompoundedReward(oldBalance, balances[msg.sender]);
        }
    }
}

// File: contracts/SingleStakeFactory.sol


//
// Copyright (c) 2023 ElkLabs
// License terms: https://github.com/elkfinance/faas/blob/main/LICENSE
//
// Authors:
// - Seth <[email protected]>
// - Baal <[email protected]>
// - Elijah <[email protected]>
// - Snake <[email protected]>

pragma solidity >=0.8.0;





/**
 * Contract that is used by users to create SingleStakingRewards contracts.
 * It stores each farm as it's created, as well as the current owner of each farm.
 * It also contains various uitlity functions for use by Elk.
 */
contract ElkSingleStakeFactory is ISingleStakeFactory, Ownable {
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */

    /// @notice The address of the SingleStakingRewards contract for each farm.
    mapping(address => mapping(address => address)) public override getSingleStake;

    /// @notice The address of each farm for each creator.
    address[] public override allFarms;

    /// @notice The address of the farm manager.
    address public override farmManager;

    /// @notice The address of the creator of a given farm.
    mapping(address => address) public override getCreator;

    /// @notice The address of the ElkToken contract.
    IERC20 feeToken = IERC20(0xeEeEEb57642040bE42185f49C52F7E9B38f8eeeE);

    /// @notice fee amount for creating a farm;
    uint256 public fee = 1000 ether;

    /// @notice max allowed fee in ElkToken
    uint256 public maxFee = 1000000 ether;

    /* ========== CONSTRUCTOR ========== */

    constructor() {}

    /**
     * @notice Creates a new SingleStakingRewards contract, stores the farm address by creator and the given LP token.
     * @notice stores the creator of the contract by the new farm address.  This is where the fee is taken from the user.
     * @param _stakingTokenAddress The address of the LP token to be staked.
     * @param _rewardTokenAddresses The addresses of the reward tokens to be distributed.
     * @param _rewardsDuration The duration of the rewards period.
     * @param _depositFeeBps The deposit fee in basis points.
     * @param _withdrawalFeesBps The withdrawal fee in basis points.
     * @param _withdrawalFeeSchedule The schedule for the withdrawal fee.
     */
    function createNewSingleStake(
        address _stakingTokenAddress,
        address[] memory _rewardTokenAddresses,
        uint256 _rewardsDuration,
        uint16 _depositFeeBps,
        uint16[] memory _withdrawalFeesBps,
        uint32[] memory _withdrawalFeeSchedule
    ) public override {
        require(
            getSingleStake[msg.sender][_stakingTokenAddress] == address(0),
            "ElkSingleStakeFactory: FARM_EXISTS"
        ); // single check is sufficient

        bytes memory creationCode = type(SingleStakingRewards).creationCode;
        bytes memory bytecode = abi.encodePacked(
            creationCode,
            abi.encode(
                _stakingTokenAddress,
                _rewardTokenAddresses,
                _rewardsDuration,
                _depositFeeBps,
                _withdrawalFeesBps,
                _withdrawalFeeSchedule
            )
        );
        address addr;
        bytes32 salt = keccak256(
            abi.encodePacked(_stakingTokenAddress, msg.sender)
        );

        assembly {
            addr := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
            if iszero(extcodesize(addr)) {
                revert(0, 0)
            }
        }

        getSingleStake[msg.sender][_stakingTokenAddress] = addr;
        getCreator[addr] = msg.sender;
        allFarms.push(addr);

        SingleStakingRewards(addr).transferOwnership(farmManager);

        _takeFee();

        emit ContractCreated(addr);
    }

    /**
     * @return the number of singe staking contracts created
     */
    function allFarmsLength() external view override returns (uint) {
        return allFarms.length;
    }

    /**
     * @notice Utility function to be used by Elk. Changes which manager contract will be assigned ownership of each farm on creation.
     * @notice This is available in case any updates are made to the SingleStakeManager contract.
     * @dev Ownership is not changed retroactively, so any created farms will always have the same manager contract.
     * @param _managerAddress The address of the new manager contract.
     */
    function setManager(address _managerAddress) external override onlyOwner {
        require(
            _managerAddress != address(0),
            "ElkSingleStakeFactory: ZERO_ADDRESS"
        );
        farmManager = _managerAddress;
        emit ManagerSet(_managerAddress);
    }

    /**
     * @notice Takes fee for contract creation.
     * @dev SingleStakeFactory must be approved to spend the feeToken before creating a new farm.
     */
    function _takeFee() private {
        require(
            feeToken.balanceOf(msg.sender) >= fee,
            "ElkSingleStakeFactory: INSUFFICIENT_BALANCE"
        );
        feeToken.safeTransferFrom(msg.sender, address(this), fee);
    }

    /**
     * @notice Utility function used by Elk to change the fee amount charged on contract creation.
     * @dev Can never be more than the maxFee set stored in the contract.
     * @param _newFee The new fee amount.
     */
    function setFee(uint256 _newFee) external onlyOwner {
        require(_newFee < maxFee, "ElkSingleStakeFactory: FEE_TOO_HIGH");
        fee = _newFee;
        emit FeeSet(_newFee);
    }

    /**
     * @notice Utility function used by Elk to recover the fees gathered by the factory.
     */
    function withdrawFees() external onlyOwner {
        _withdrawFees();
    }

    /**
     * @notice Change ownership of a farm
     * @param _farmAddress The address of the farm to be transferred.
     */
    function overrideOwnership(address _farmAddress) external onlyOwner {
        _overrideOwnership(_farmAddress);
    }

    function _withdrawFees() private {
        uint256 balance = feeToken.balanceOf(address(this));
        feeToken.safeTransfer(msg.sender, balance);
        emit FeesRecovered(balance);
    }

    /**
     * @notice This function is available to FaaS governance in case any "Scam" or nefarious farms are created using the contract. Governance will be able to stop the offending farm and allow users to recover funds.
     * @param _farmAddress The address of the farm to be stopped.
     */
    function _overrideOwnership(address _farmAddress) private {
        address creatorAddress = getCreator[_farmAddress];

        require(creatorAddress != msg.sender, "ElkSingleStakeFactory: ALREADY_OVERRIDEN");
        require(creatorAddress != address(0), "ElkSingleStakeFactory: UNKNOWN_FARM");

        SingleStakingRewards rewardsContract = SingleStakingRewards(
            _farmAddress
        );
        address stakingToken = address(rewardsContract.stakingToken());

        getSingleStake[creatorAddress][stakingToken] = address(0);
        getSingleStake[msg.sender][stakingToken] = _farmAddress;
        getCreator[_farmAddress] = msg.sender;
    }
}

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_newContract","type":"address"}],"name":"ContractCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"FeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_balanceRecovered","type":"uint256"}],"name":"FeesRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_farmManager","type":"address"}],"name":"ManagerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allFarms","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allFarmsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingTokenAddress","type":"address"},{"internalType":"address[]","name":"_rewardTokenAddresses","type":"address[]"},{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBps","type":"uint16"},{"internalType":"uint16[]","name":"_withdrawalFeesBps","type":"uint16[]"},{"internalType":"uint32[]","name":"_withdrawalFeeSchedule","type":"uint32[]"}],"name":"createNewSingleStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farmManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getCreator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getSingleStake","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_farmAddress","type":"address"}],"name":"overrideOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newFee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_managerAddress","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600580546001600160a01b03191673eeeeeb57642040be42185f49c52f7e9b38f8eeee179055683635c9adc5dea0000060065569d3c21bcecceda100000060075534801561005157600080fd5b5061005b33610060565b6100b0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614c5e806100bf6000396000f3fe60806040523480156200001157600080fd5b5060043610620001095760003560e01c8063715018a611620000a3578063d0ebdbe7116200006e578063d0ebdbe71462000211578063ddca3f431462000228578063eead715e1462000232578063f2fde38b146200026957600080fd5b8063715018a614620001c05780637bc6d44314620001ca5780638da5cb5b14620001d3578063a021030914620001e557600080fd5b806343acb9a911620000e457806343acb9a9146200015b578063476343ee146200018b5780634b2d07cf146200019557806369fe0e2d14620001a957600080fd5b806301f59d16146200010e5780633ae21bb1146200012b5780633be607431462000144575b600080fd5b6200011860075481565b6040519081526020015b60405180910390f35b620001426200013c366004620010c3565b62000280565b005b62000142620001553660046200127e565b62000298565b620001726200016c366004620013a7565b620005e6565b6040516001600160a01b03909116815260200162000122565b6200014262000611565b60035462000172906001600160a01b031681565b62000142620001ba366004620013a7565b62000627565b62000142620006e6565b60025462000118565b6000546001600160a01b031662000172565b62000172620001f6366004620010c3565b6004602052600090815260409020546001600160a01b031681565b6200014262000222366004620010c3565b620006fc565b6200011860065481565b6200017262000243366004620013c1565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b620001426200027a366004620010c3565b620007e0565b6200028a62000873565b6200029581620008cf565b50565b3360009081526001602090815260408083206001600160a01b038a811685529252909120541615620003375760405162461bcd60e51b815260206004820152602260248201527f456c6b53696e676c655374616b65466163746f72793a204641524d5f4558495360448201527f545300000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6000604051806020016200034b906200109f565b6020820181038252601f19601f820116604052509050600081888888888888604051602001620003819695949392919062001478565b60408051601f1981840301815290829052620003a1929160200162001540565b60408051601f19818403018152908290526bffffffffffffffffffffffff1960608b811b8216602085015233901b16603483015291506000908190604801604051602081830303815290604052805190602001209050808351602085016000f59150813b6200040f57600080fd5b8160016000336001600160a01b03166001600160a01b0316815260200190815260200160002060008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055503360046000846001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002829080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b031663f2fde38b600360009054906101000a90046001600160a01b03166040518263ffffffff1660e01b81526004016200056091906001600160a01b0391909116815260200190565b600060405180830381600087803b1580156200057b57600080fd5b505af115801562000590573d6000803e3d6000fd5b505050506200059e62000acd565b6040516001600160a01b03831681527fcf78cf0d6f3d8371e1075c69c492ab4ec5d8cf23a1a239b6a51a1d00be7ca3129060200160405180910390a150505050505050505050565b60028181548110620005f757600080fd5b6000918252602090912001546001600160a01b0316905081565b6200061b62000873565b6200062562000bd6565b565b6200063162000873565b6007548110620006aa5760405162461bcd60e51b815260206004820152602360248201527f456c6b53696e676c655374616b65466163746f72793a204645455f544f4f5f4860448201527f494748000000000000000000000000000000000000000000000000000000000060648201526084016200032e565b60068190556040518181527f20461e09b8e557b77e107939f9ce6544698123aad0fc964ac5cc59b7df2e608f906020015b60405180910390a150565b620006f062000873565b62000625600062000c93565b6200070662000873565b6001600160a01b038116620007845760405162461bcd60e51b815260206004820152602360248201527f456c6b53696e676c655374616b65466163746f72793a205a45524f5f4144445260448201527f455353000000000000000000000000000000000000000000000000000000000060648201526084016200032e565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f60a0f5b9f9e81e98216071b85826681c796256fe3d1354ecb675580fba64fa6990602001620006db565b620007ea62000873565b6001600160a01b038116620008685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016200032e565b620002958162000c93565b6000546001600160a01b03163314620006255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200032e565b6001600160a01b0380821660009081526004602052604090205416338103620009615760405162461bcd60e51b815260206004820152602860248201527f456c6b53696e676c655374616b65466163746f72793a20414c52454144595f4f60448201527f564552524944454e00000000000000000000000000000000000000000000000060648201526084016200032e565b6001600160a01b038116620009df5760405162461bcd60e51b815260206004820152602360248201527f456c6b53696e676c655374616b65466163746f72793a20554e4b4e4f574e5f4660448201527f41524d000000000000000000000000000000000000000000000000000000000060648201526084016200032e565b60008290506000816001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000a25573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a4b919062001573565b6001600160a01b039384166000908152600160208181526040808420948816808552948252808420805473ffffffffffffffffffffffffffffffffffffffff1990811690915533808652938352818520958552948252808420805499909816988516891790975596825260049096529390932080549093169093179091555050565b6006546005546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801562000b19573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b3f919062001593565b101562000bb55760405162461bcd60e51b815260206004820152602b60248201527f456c6b53696e676c655374616b65466163746f72793a20494e5355464649434960448201527f454e545f42414c414e434500000000000000000000000000000000000000000060648201526084016200032e565b60065460055462000625916001600160a01b03909116903390309062000cf0565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801562000c20573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c46919062001593565b60055490915062000c62906001600160a01b0316338362000da9565b6040518181527f6857c770f3cb43e9c19050a37dd914ec876241c1f4b487d26a1d4f5d3054f49b90602001620006db565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905262000da39085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000df9565b50505050565b6040516001600160a01b03831660248201526044810182905262000df49084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000d3e565b505050565b600062000e50826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662000ee59092919063ffffffff16565b80519091501562000df4578080602001905181019062000e719190620015ad565b62000df45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016200032e565b606062000ef6848460008562000efe565b949350505050565b60608247101562000f785760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016200032e565b600080866001600160a01b0316858760405162000f969190620015d1565b60006040518083038185875af1925050503d806000811462000fd5576040519150601f19603f3d011682016040523d82523d6000602084013e62000fda565b606091505b509150915062000fed8783838762000ff8565b979650505050505050565b606083156200106c57825160000362001064576001600160a01b0385163b620010645760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200032e565b508162000ef6565b62000ef68383815115620010835781518083602001fd5b8060405162461bcd60e51b81526004016200032e9190620015ef565b613604806200162583390190565b6001600160a01b03811681146200029557600080fd5b600060208284031215620010d657600080fd5b8135620010e381620010ad565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715620011455762001145620010ea565b604052919050565b600067ffffffffffffffff8211156200116a576200116a620010ea565b5060051b60200190565b803561ffff811681146200118757600080fd5b919050565b600082601f8301126200119e57600080fd5b81356020620011b7620011b1836200114d565b62001119565b82815260059290921b84018101918181019086841115620011d757600080fd5b8286015b84811015620011fd57620011ef8162001174565b8352918301918301620011db565b509695505050505050565b600082601f8301126200121a57600080fd5b813560206200122d620011b1836200114d565b82815260059290921b840181019181810190868411156200124d57600080fd5b8286015b84811015620011fd57803563ffffffff81168114620012705760008081fd5b835291830191830162001251565b60008060008060008060c087890312156200129857600080fd5b8635620012a581620010ad565b955060208781013567ffffffffffffffff80821115620012c457600080fd5b818a0191508a601f830112620012d957600080fd5b8135620012ea620011b1826200114d565b81815260059190911b8301840190848101908d8311156200130a57600080fd5b938501935b82851015620013355784356200132581620010ad565b825293850193908501906200130f565b9950505060408a013596506200134e60608b0162001174565b955060808a01359250808311156200136557600080fd5b620013738b848c016200118c565b945060a08a01359250808311156200138a57600080fd5b50506200139a89828a0162001208565b9150509295509295509295565b600060208284031215620013ba57600080fd5b5035919050565b60008060408385031215620013d557600080fd5b8235620013e281620010ad565b91506020830135620013f481620010ad565b809150509250929050565b600081518084526020808501945080840160005b838110156200143557815161ffff168752958201959082019060010162001413565b509495945050505050565b600081518084526020808501945080840160005b838110156200143557815163ffffffff168752958201959082019060010162001454565b600060c082016001600160a01b03808a168452602060c081860152828a5180855260e087019150828c01945060005b81811015620014c7578551851683529483019491830191600101620014a7565b5050896040870152620014e0606087018a61ffff169052565b8581036080870152620014f48189620013ff565b935050505082810360a08401526200150d818562001440565b9998505050505050505050565b60005b83811015620015375781810151838201526020016200151d565b50506000910152565b60008351620015548184602088016200151a565b8351908301906200156a8183602088016200151a565b01949350505050565b6000602082840312156200158657600080fd5b8151620010e381620010ad565b600060208284031215620015a657600080fd5b5051919050565b600060208284031215620015c057600080fd5b81518015158114620010e357600080fd5b60008251620015e58184602087016200151a565b9190910192915050565b6020815260008251806020840152620016108160408501602087016200151a565b601f01601f1916919091016040019291505056fe60a06040523480156200001157600080fd5b5060405162003604380380620036048339810160408190526200003491620007d3565b600160005585858585858585838383836200004f336200023e565b6001600160a01b038116620000905760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b03811660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015620000db573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001019190620008fb565b6200010e90600a62000a3c565b6200012290670de0b6b3a764000062000a4d565b600455506200013383838362000290565b5050505060008551116200016f5760405162461bcd60e51b8152602060048201526002602482015261453960f01b604482015260640162000087565b60005b8551811015620001c257600086828151811062000193576200019362000a70565b60200260200101519050620001ae816200048f60201b60201c565b50620001ba8162000a86565b905062000172565b505050600d919091555050506001600160a01b038616620002325760405162461bcd60e51b815260206004820152602360248201527f53696e676c655374616b696e67526577617264733a204e4f545f454c4b44455860448201526205f4c560ec1b606482015260840162000087565b50505050505062000b50565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b81518151148015620002a45750600a815111155b8015620002b757506107d08361ffff1611155b620002ea5760405162461bcd60e51b8152602060048201526002602482015261453560f01b604482015260640162000087565b600080620002fc6107d0600162000aa2565b905060005b835181101562000415578263ffffffff1684828151811062000327576200032762000a70565b602002602001015163ffffffff1611620003695760405162461bcd60e51b8152602060048201526002602482015261453760f01b604482015260640162000087565b818582815181106200037f576200037f62000a70565b602002602001015161ffff1610620003bf5760405162461bcd60e51b815260206004820152600260248201526108a760f31b604482015260640162000087565b838181518110620003d457620003d462000a70565b60200260200101519250848181518110620003f357620003f362000a70565b602002602001015161ffff169150806200040d9062000a86565b905062000301565b5082516200042b9060059060208601906200058f565b50835162000441906006906020870190620005e7565b5061ffff85166007556040517fab4c36b25b04e6f8ac9915203aba1048c17841782324a583e98128b8c1c964f390620004809087908790879062000ab8565b60405180910390a15050505050565b600a54600f1015620004ca5760405162461bcd60e51b815260206004820152600360248201526245313560e81b604482015260640162000087565b6001600160a01b038116620005075760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b0381166000908152600b602052604090205460ff166200058c57600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091556000908152600b60205260409020805460ff191690911790555b50565b828054828255906000526020600020908101928215620005d5579160200282015b82811115620005d5578251829063ffffffff16905591602001919060010190620005b0565b50620005e39291506200062b565b5090565b828054828255906000526020600020908101928215620005d5579160200282015b82811115620005d5578251829061ffff1690559160200191906001019062000608565b5b80821115620005e357600081556001016200062c565b80516001600160a01b03811681146200065a57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620006a057620006a06200065f565b604052919050565b60006001600160401b03821115620006c457620006c46200065f565b5060051b60200190565b805161ffff811681146200065a57600080fd5b600082601f830112620006f357600080fd5b815160206200070c6200070683620006a8565b62000675565b82815260059290921b840181019181810190868411156200072c57600080fd5b8286015b8481101562000752576200074481620006ce565b835291830191830162000730565b509695505050505050565b600082601f8301126200076f57600080fd5b81516020620007826200070683620006a8565b82815260059290921b84018101918181019086841115620007a257600080fd5b8286015b848110156200075257805163ffffffff81168114620007c55760008081fd5b8352918301918301620007a6565b60008060008060008060c08789031215620007ed57600080fd5b620007f88762000642565b602088810151919750906001600160401b03808211156200081857600080fd5b818a0191508a601f8301126200082d57600080fd5b81516200083e6200070682620006a8565b81815260059190911b8301840190848101908d8311156200085e57600080fd5b938501935b828510156200088757620008778562000642565b8252938501939085019062000863565b809a5050505060408a01519650620008a260608b01620006ce565b955060808a0151925080831115620008b957600080fd5b620008c78b848c01620006e1565b945060a08a0151925080831115620008de57600080fd5b5050620008ee89828a016200075d565b9150509295509295509295565b6000602082840312156200090e57600080fd5b815160ff811681146200092057600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200097e57816000190482111562000962576200096262000927565b808516156200097057918102915b93841c939080029062000942565b509250929050565b600082620009975750600162000a36565b81620009a65750600062000a36565b8160018114620009bf5760028114620009ca57620009ea565b600191505062000a36565b60ff841115620009de57620009de62000927565b50506001821b62000a36565b5060208310610133831016604e8410600b841016171562000a0f575081810a62000a36565b62000a1b83836200093d565b806000190482111562000a325762000a3262000927565b0290505b92915050565b60006200092060ff84168362000986565b60008262000a6b57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006001820162000a9b5762000a9b62000927565b5060010190565b8082018082111562000a365762000a3662000927565b60006060820161ffff80871684526020606081860152828751808552608087019150828901945060005b8181101562000b0257855185168352948301949183019160010162000ae2565b5050858103604087015286518082529082019350915080860160005b8381101562000b4257815163ffffffff168552938201939082019060010162000b1e565b509298975050505050505050565b608051612a6e62000b9660003960008181610481015281816107600152818161090101528181610c3c01528181610fc501528181611757015261185f0152612a6e6000f3fe608060405234801561001057600080fd5b50600436106102c85760003560e01c806379ee54f71161017b578063a694fc3a116100d8578063e9fad8ee1161008c578063f122977711610071578063f122977714610601578063f2d1763914610614578063f2fde38b1461062757600080fd5b8063e9fad8ee146105f0578063ebe2b12b146105f857600080fd5b8063ab879827116100bd578063ab879827146105b3578063c8f33c91146105bc578063e70b9e27146105c557600080fd5b8063a694fc3a14610565578063a7309d7d1461057857600080fd5b806387e7ed3a1161012f5780639003adfe116101145780639003adfe146105295780639ce43f90146105325780639e3582c81461055257600080fd5b806387e7ed3a146105055780638da5cb5b1461051857600080fd5b80637bb7bed1116101605780637bb7bed1146104e15780637beb3d9f146104f457806380faa57d146104fd57600080fd5b806379ee54f7146104bb5780637aaeaf7f146104ce57600080fd5b8063386a9525116102295780636b091695116101dd5780637035ab98116101c25780637035ab9814610449578063715018a61461047457806372f702f31461047c57600080fd5b80636b091695146104235780636da9c58e1461043657600080fd5b8063415be3b51161020e578063415be3b5146103d7578063423c485a146103fd57806354feec3e1461041057600080fd5b8063386a9525146103ae5780633d3b2603146103b757600080fd5b80631db7efd81161028057806327e235e31161026557806327e235e3146103685780632e1a7d4d146103885780632e9f06021461039b57600080fd5b80631db7efd814610322578063211dc32d1461035557600080fd5b80631171bda9116102b15780631171bda9146102f357806318160ddd146103065780631c03e6cc1461030f57600080fd5b806301f59d16146102cd57806302329e17146102e9575b600080fd5b6102d66107d081565b6040519081526020015b60405180910390f35b6102f161063a565b005b6102f16103013660046125da565b6108ef565b6102d660025481565b6102f161031d366004612616565b6109f8565b610345610330366004612616565b600b6020526000908152604090205460ff1681565b60405190151581526020016102e0565b6102d6610363366004612631565b610a43565b6102d6610376366004612616565b60036020526000908152604090205481565b6102f1610396366004612664565b610b67565b6102f16103a9366004612693565b610ca4565b6102d6600d5481565b6102d66103c5366004612616565b600f6020526000908152604090205481565b6103ea6103e5366004612616565b611133565b60405160009190910b81526020016102e0565b6102d661040b366004612664565b6111b9565b6102d661041e366004612664565b6111e6565b6102f1610431366004612631565b611207565b6102f1610444366004612616565b611348565b6102d6610457366004612631565b601160209081526000928352604080842090915290825290205481565b6102f161146d565b6104a37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102e0565b6102f16104c9366004612616565b611481565b6102d66104dc366004612757565b611607565b6104a36104ef366004612664565b6116bd565b6102d661271081565b6102d66116e7565b6102f1610513366004612616565b6116fe565b6001546001600160a01b03166104a3565b6102d660085481565b6102d6610540366004612616565b60106020526000908152604090205481565b6102d6610560366004612664565b611789565b6102f1610573366004612664565b611799565b61059e610586366004612616565b60096020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102e0565b6102d660075481565b6102d6600e5481565b6102d66105d3366004612631565b601260209081526000928352604080842090915290825290205481565b6102f16118b9565b6102d6600c5481565b6102d661060f366004612616565b6118db565b6102f1610622366004612631565b6119e2565b6102f1610635366004612616565b611b64565b3360005b600a548110156106a7576000600a828154811061065d5761065d612781565b6000918252602090912001546001600160a01b0316905061067d816118db565b6001600160a01b039091166000908152601060205260409020556106a0816127ad565b905061063e565b506106b06116e7565b600e556001600160a01b0381161561075e5760005b600a5481101561075c576000600a82815481106106e4576106e4612781565b6000918252602090912001546001600160a01b031690506107058184610a43565b6001600160a01b03918216600081815260126020908152604080832095881680845295825280832094909455918152601082528281205460118352838220948252939091522055610755816127ad565b90506106c5565b505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0381166000908152600b602052604090205460ff166108125760405162461bcd60e51b815260206004820152602960248201527f53696e676c655374616b696e67526577617264733a20434f4d504f554e445f4960448201527f4d504f535349424c45000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038116600090815260126020908152604080832033845290915290205480156108ea5733600081815260036020818152604080842080546001600160a01b03891686526012845282862096865295835290842084905591905280548492906108829084906127c6565b92505081905550816002600082825461089b91906127c6565b909155505033600090815260036020908152604091829020548251848152918201527fc0dbba536f9e895f506b05695b6beb91b0c1a820932d2d7ecf4a941dbdd1fb55910160405180910390a1505b505050565b6108f7611bf1565b6108ff611c4a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036109805760405162461bcd60e51b815260206004820152600260248201527f45340000000000000000000000000000000000000000000000000000000000006044820152606401610809565b61098b838383611ca4565b826109a06001600160a01b0382168484611d0d565b826001600160a01b0316846001600160a01b03167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b648846040516109e591815260200190565b60405180910390a3506108ea6001600055565b610a00611c4a565b600c544211610a375760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610809565b610a4081611db6565b50565b6001600160a01b03808316600081815260126020908152604080832094861683529381528382205484517f313ce5670000000000000000000000000000000000000000000000000000000081529451929490939263313ce567926004808401939192918290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae391906127d9565b610aee90600a6128e7565b6001600160a01b03808616600090815260116020908152604080832093881683529290522054610b1d866118db565b610b2791906128f6565b6001600160a01b038516600090815260036020526040902054610b4a9190612909565b610b549190612920565b610b5e91906127c6565b90505b92915050565b610b6f611bf1565b80610b7a3382611ef3565b9150600082118015610b9b5750336000908152600360205260409020548211155b8015610bb65750336000908152600360205260409020548111155b610be75760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610809565b600454610bf49082612909565b60026000828254610c0591906128f6565b90915550503360009081526003602052604081208054839290610c299084906128f6565b90915550610c6390506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384611d0d565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250610a406001600055565b610cac611bf1565b610cb4611c4a565b600c544211610ceb5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610809565b6000805b600a54811015610d58576000600a8281548110610d0e57610d0e612781565b6000918252602090912001546001600160a01b03169050610d2e816118db565b6001600160a01b03909116600090815260106020526040902055610d51816127ad565b9050610cef565b50610d616116e7565b600e556001600160a01b03811615610e0f5760005b600a54811015610e0d576000600a8281548110610d9557610d95612781565b6000918252602090912001546001600160a01b03169050610db68184610a43565b6001600160a01b03918216600081815260126020908152604080832095881680845295825280832094909455918152601082528281205460118352838220948252939091522055610e06816127ad565b9050610d76565b505b60008211610e5f5760405162461bcd60e51b815260206004820152600360248201527f45313000000000000000000000000000000000000000000000000000000000006044820152606401610809565b600a54835114610eb15760405162461bcd60e51b815260206004820152600360248201527f45313100000000000000000000000000000000000000000000000000000000006044820152606401610809565b600d82905560005b600a548110156110d4576000600a8281548110610ed857610ed8612781565b600091825260209091200154600d5486516001600160a01b0390921692508291879085908110610f0a57610f0a612781565b6020026020010151610f1c9190612920565b6001600160a01b0382166000908152600f6020526040812091909155600a805485908110610f4c57610f4c612781565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc19190612942565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461105a57600d546110099082612920565b6001600160a01b0383166000908152600f602052604090205411156110555760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610809565b6110c0565b600d5460025461106a90836128f6565b6110749190612920565b6001600160a01b0383166000908152600f602052604090205411156110c05760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610809565b505050806110cd906127ad565b9050610eb9565b5042600e819055600d546110e7916127c6565b600c556040517faab1f55dce0d0e628e283ce1061d0afccffcf61f9c14391c899b5952492ce8219061111c908590859061295b565b60405180910390a15061112f6001600055565b5050565b6001600160a01b0381166000908152600b602052604081205460ff16156111b05760005b600a548110156111ae57826001600160a01b0316600a828154811061117e5761117e612781565b6000918252602090912001546001600160a01b03160361119e5792915050565b6111a7816127ad565b9050611157565b505b50600019919050565b600080600754116111cb576000610b61565b612710600754836111dc9190612909565b610b619190612920565b600581815481106111f657600080fd5b600091825260209091200154905081565b61120f611bf1565b8060005b600a5481101561127c576000600a828154811061123257611232612781565b6000918252602090912001546001600160a01b03169050611252816118db565b6001600160a01b03909116600090815260106020526040902055611275816127ad565b9050611213565b506112856116e7565b600e556001600160a01b038116156113335760005b600a54811015611331576000600a82815481106112b9576112b9612781565b6000918252602090912001546001600160a01b031690506112da8184610a43565b6001600160a01b0391821660008181526012602090815260408083209588168084529582528083209490945591815260108252828120546011835283822094825293909152205561132a816127ad565b905061129a565b505b61133d8383611f7a565b5061112f6001600055565b611350611bf1565b611358611c4a565b600c544211156113905760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610809565b600042600c5411156113ad5742600c546113aa91906128f6565b90505b42600c5560005b600a54811015611438576000600a82815481106113d3576113d3612781565b60009182526020808320909101546001600160a01b0316808352600f9091526040822054909250829190611408908690612909565b90508015611424576114246001600160a01b0384168783611d0d565b50505080611431906127ad565b90506113b4565b506040517f9bad5e1e43bc35e89725967a54f4bc384078248a1ea5c315be3b260a68cbb17a90600090a150610a406001600055565b611475611c4a565b61147f6000612103565b565b611489611bf1565b8060005b600a548110156114f6576000600a82815481106114ac576114ac612781565b6000918252602090912001546001600160a01b031690506114cc816118db565b6001600160a01b039091166000908152601060205260409020556114ef816127ad565b905061148d565b506114ff6116e7565b600e556001600160a01b038116156115ad5760005b600a548110156115ab576000600a828154811061153357611533612781565b6000918252602090912001546001600160a01b031690506115548184610a43565b6001600160a01b039182166000818152601260209081526040808320958816808452958252808320949094559181526010825282812054601183528382209482529390915220556115a4816127ad565b9050611514565b505b60005b600a548110156115fb576115eb600a82815481106115d0576115d0612781565b6000918252602090912001546001600160a01b031684611f7a565b6115f4816127ad565b90506115b0565b5050610a406001600055565b6001600160a01b03821660009081526009602052604081205481906116329063ffffffff16426128f6565b90506000805b6005548110156116b4576005818154811061165557611655612781565b90600052602060002001548310156116a4576127106006828154811061167d5761167d612781565b9060005260206000200154866116939190612909565b61169d9190612920565b91506116b4565b6116ad816127ad565b9050611638565b50949350505050565b600a81815481106116cd57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000600c5442106116f95750600c5490565b504290565b611706611c4a565b61170e611bf1565b6008805460009091556040518181527f6857c770f3cb43e9c19050a37dd914ec876241c1f4b487d26a1d4f5d3054f49b9060200160405180910390a161177e6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383611d0d565b50610a406001600055565b600681815481106111f657600080fd5b6117a1611bf1565b806117ac3382612162565b91506000821180156117be5750600081115b61180a5760405162461bcd60e51b815260206004820152600260248201527f45320000000000000000000000000000000000000000000000000000000000006044820152606401610809565b6004546118179083612909565b6002600082825461182891906127c6565b9091555050336000908152600360205260408120805484929061184c9084906127c6565b9091555061188790506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330846122ca565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610c91565b6118c233612321565b3360009081526003602052604090205461147f90610b67565b600060025460000361190357506001600160a01b031660009081526010602052604090205490565b600254826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611944573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196891906127d9565b61197390600a6128e7565b6001600160a01b0384166000908152600f6020526040902054600e546119976116e7565b6119a191906128f6565b6119ab9190612909565b6119b59190612909565b6119bf9190612920565b6001600160a01b038316600090815260106020526040902054610b6191906127c6565b6119ea611c4a565b600c544211611a215760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610809565b60025415611a715760405162461bcd60e51b815260206004820152600360248201527f45313200000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0382166000908152600b602052604090205460ff161561112f576040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff9190612942565b90508015611b1b57611b1b6001600160a01b0383168483611d0d565b826001600160a01b03167fcaa95c7b01f93ffe197f5e7316a1a2f387c5bfff8cb445095f2110ff5c1b299582604051611b5691815260200190565b60405180910390a250505050565b611b6c611c4a565b6001600160a01b038116611be85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610809565b610a4081612103565b600260005403611c435760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610809565b6002600055565b6001546001600160a01b0316331461147f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610809565b6001600160a01b0383166000908152600b602052604090205460ff16156108ea5760405162461bcd60e51b815260206004820152600360248201527f45313600000000000000000000000000000000000000000000000000000000006044820152606401610809565b6040516001600160a01b0383166024820152604481018290526108ea9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261232a565b600a54600f1015611e095760405162461bcd60e51b815260206004820152600360248201527f45313500000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b038116611e5f5760405162461bcd60e51b815260206004820152600260248201527f45310000000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0381166000908152600b602052604090205460ff16610a4057600a805460018181019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff1990911681179091556000908152600b60205260409020805460ff1916909117905550565b600080611f008484611607565b90508015611f5f578060086000828254611f1a91906127c6565b90915550506040518181526001600160a01b038516907fd0b34aaed5c558a8df736a5aaf9a49b539c4e86fb3ee5a1ac76e0bec23cbdd03906020015b60405180910390a25b611f7284611f6d83866128f6565b919050565b949350505050565b6001546001600160a01b0316331480611f9b5750336001600160a01b038216145b611fe75760405162461bcd60e51b815260206004820152600360248201527f45313400000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0382166000908152600b602052604090205460ff1661204f5760405162461bcd60e51b815260206004820152600360248201527f45313300000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0380831660009081526012602090815260408083209385168352929052205480156108ea576001600160a01b0380841660008181526012602090815260408083209487168352939052918220919091556120b1908383611d0d565b816001600160a01b0316836001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e836040516120f691815260200190565b60405180910390a3505050565b600180546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000600c5442111561219c5760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610809565b8260005b600a54811015612209576000600a82815481106121bf576121bf612781565b6000918252602090912001546001600160a01b031690506121df816118db565b6001600160a01b03909116600090815260106020526040902055612202816127ad565b90506121a0565b506122126116e7565b600e556001600160a01b038116156122c05760005b600a548110156122be576000600a828154811061224657612246612781565b6000918252602090912001546001600160a01b031690506122678184610a43565b6001600160a01b039182166000818152601260209081526040808320958816808452958252808320949094559181526010825282812054601183528382209482529390915220556122b7816127ad565b9050612227565b505b611f72848461240f565b6040516001600160a01b038085166024830152831660448201526064810182905261231b9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611d52565b50505050565b610a4081611481565b600061237f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124a09092919063ffffffff16565b8051909150156108ea578080602001905181019061239d91906129a3565b6108ea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610809565b60008061241b836111b9565b6001600160a01b0385166000908152600960205260409020805463ffffffff19164263ffffffff1617905590508015611f5f57806008600082825461246091906127c6565b90915550506040518181526001600160a01b038516907f34f2a7363b1ef64b0b62a223c88cf3f54a68686acfcb9531d7deb46004f37c4690602001611f56565b6060611f72848460008585600080866001600160a01b031685876040516124c791906129e9565b60006040518083038185875af1925050503d8060008114612504576040519150601f19603f3d011682016040523d82523d6000602084013e612509565b606091505b509150915061251a87838387612525565b979650505050505050565b6060831561259457825160000361258d576001600160a01b0385163b61258d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610809565b5081611f72565b611f7283838151156125a95781518083602001fd5b8060405162461bcd60e51b81526004016108099190612a05565b80356001600160a01b0381168114611f6d57600080fd5b6000806000606084860312156125ef57600080fd5b6125f8846125c3565b9250612606602085016125c3565b9150604084013590509250925092565b60006020828403121561262857600080fd5b610b5e826125c3565b6000806040838503121561264457600080fd5b61264d836125c3565b915061265b602084016125c3565b90509250929050565b60006020828403121561267657600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156126a657600080fd5b823567ffffffffffffffff808211156126be57600080fd5b818501915085601f8301126126d257600080fd5b81356020828211156126e6576126e661267d565b8160051b604051601f19603f8301168101818110868211171561270b5761270b61267d565b60405292835281830193508481018201928984111561272957600080fd5b948201945b838610156127475785358552948201949382019361272e565b9997909101359750505050505050565b6000806040838503121561276a57600080fd5b612773836125c3565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016127bf576127bf612797565b5060010190565b80820180821115610b6157610b61612797565b6000602082840312156127eb57600080fd5b815160ff811681146127fc57600080fd5b9392505050565b600181815b8085111561283e57816000190482111561282457612824612797565b8085161561283157918102915b93841c9390800290612808565b509250929050565b60008261285557506001610b61565b8161286257506000610b61565b816001811461287857600281146128825761289e565b6001915050610b61565b60ff84111561289357612893612797565b50506001821b610b61565b5060208310610133831016604e8410600b84101617156128c1575081810a610b61565b6128cb8383612803565b80600019048211156128df576128df612797565b029392505050565b6000610b5e60ff841683612846565b81810381811115610b6157610b61612797565b8082028115828204841417610b6157610b61612797565b60008261293d57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561295457600080fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561299457815184529284019290840190600101612978565b50505092019290925292915050565b6000602082840312156129b557600080fd5b815180151581146127fc57600080fd5b60005b838110156129e05781810151838201526020016129c8565b50506000910152565b600082516129fb8184602087016129c5565b9190910192915050565b6020815260008251806020840152612a248160408501602087016129c5565b601f01601f1916919091016040019291505056fea26469706673582212207aee72bbe06db4ac4d8adb7523824ac4758e8491370f60b4b49ce488e28937bc64736f6c63430008130033a26469706673582212207baae4111b487331ce185af6ae9a1102271e33261116d85e00deb398e8f8cd6464736f6c63430008130033

Deployed Bytecode

0x60806040523480156200001157600080fd5b5060043610620001095760003560e01c8063715018a611620000a3578063d0ebdbe7116200006e578063d0ebdbe71462000211578063ddca3f431462000228578063eead715e1462000232578063f2fde38b146200026957600080fd5b8063715018a614620001c05780637bc6d44314620001ca5780638da5cb5b14620001d3578063a021030914620001e557600080fd5b806343acb9a911620000e457806343acb9a9146200015b578063476343ee146200018b5780634b2d07cf146200019557806369fe0e2d14620001a957600080fd5b806301f59d16146200010e5780633ae21bb1146200012b5780633be607431462000144575b600080fd5b6200011860075481565b6040519081526020015b60405180910390f35b620001426200013c366004620010c3565b62000280565b005b62000142620001553660046200127e565b62000298565b620001726200016c366004620013a7565b620005e6565b6040516001600160a01b03909116815260200162000122565b6200014262000611565b60035462000172906001600160a01b031681565b62000142620001ba366004620013a7565b62000627565b62000142620006e6565b60025462000118565b6000546001600160a01b031662000172565b62000172620001f6366004620010c3565b6004602052600090815260409020546001600160a01b031681565b6200014262000222366004620010c3565b620006fc565b6200011860065481565b6200017262000243366004620013c1565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b620001426200027a366004620010c3565b620007e0565b6200028a62000873565b6200029581620008cf565b50565b3360009081526001602090815260408083206001600160a01b038a811685529252909120541615620003375760405162461bcd60e51b815260206004820152602260248201527f456c6b53696e676c655374616b65466163746f72793a204641524d5f4558495360448201527f545300000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6000604051806020016200034b906200109f565b6020820181038252601f19601f820116604052509050600081888888888888604051602001620003819695949392919062001478565b60408051601f1981840301815290829052620003a1929160200162001540565b60408051601f19818403018152908290526bffffffffffffffffffffffff1960608b811b8216602085015233901b16603483015291506000908190604801604051602081830303815290604052805190602001209050808351602085016000f59150813b6200040f57600080fd5b8160016000336001600160a01b03166001600160a01b0316815260200190815260200160002060008c6001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055503360046000846001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002829080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b031663f2fde38b600360009054906101000a90046001600160a01b03166040518263ffffffff1660e01b81526004016200056091906001600160a01b0391909116815260200190565b600060405180830381600087803b1580156200057b57600080fd5b505af115801562000590573d6000803e3d6000fd5b505050506200059e62000acd565b6040516001600160a01b03831681527fcf78cf0d6f3d8371e1075c69c492ab4ec5d8cf23a1a239b6a51a1d00be7ca3129060200160405180910390a150505050505050505050565b60028181548110620005f757600080fd5b6000918252602090912001546001600160a01b0316905081565b6200061b62000873565b6200062562000bd6565b565b6200063162000873565b6007548110620006aa5760405162461bcd60e51b815260206004820152602360248201527f456c6b53696e676c655374616b65466163746f72793a204645455f544f4f5f4860448201527f494748000000000000000000000000000000000000000000000000000000000060648201526084016200032e565b60068190556040518181527f20461e09b8e557b77e107939f9ce6544698123aad0fc964ac5cc59b7df2e608f906020015b60405180910390a150565b620006f062000873565b62000625600062000c93565b6200070662000873565b6001600160a01b038116620007845760405162461bcd60e51b815260206004820152602360248201527f456c6b53696e676c655374616b65466163746f72793a205a45524f5f4144445260448201527f455353000000000000000000000000000000000000000000000000000000000060648201526084016200032e565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040519081527f60a0f5b9f9e81e98216071b85826681c796256fe3d1354ecb675580fba64fa6990602001620006db565b620007ea62000873565b6001600160a01b038116620008685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016200032e565b620002958162000c93565b6000546001600160a01b03163314620006255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016200032e565b6001600160a01b0380821660009081526004602052604090205416338103620009615760405162461bcd60e51b815260206004820152602860248201527f456c6b53696e676c655374616b65466163746f72793a20414c52454144595f4f60448201527f564552524944454e00000000000000000000000000000000000000000000000060648201526084016200032e565b6001600160a01b038116620009df5760405162461bcd60e51b815260206004820152602360248201527f456c6b53696e676c655374616b65466163746f72793a20554e4b4e4f574e5f4660448201527f41524d000000000000000000000000000000000000000000000000000000000060648201526084016200032e565b60008290506000816001600160a01b03166372f702f36040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000a25573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a4b919062001573565b6001600160a01b039384166000908152600160208181526040808420948816808552948252808420805473ffffffffffffffffffffffffffffffffffffffff1990811690915533808652938352818520958552948252808420805499909816988516891790975596825260049096529390932080549093169093179091555050565b6006546005546040516370a0823160e01b81523360048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801562000b19573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b3f919062001593565b101562000bb55760405162461bcd60e51b815260206004820152602b60248201527f456c6b53696e676c655374616b65466163746f72793a20494e5355464649434960448201527f454e545f42414c414e434500000000000000000000000000000000000000000060648201526084016200032e565b60065460055462000625916001600160a01b03909116903390309062000cf0565b6005546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801562000c20573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000c46919062001593565b60055490915062000c62906001600160a01b0316338362000da9565b6040518181527f6857c770f3cb43e9c19050a37dd914ec876241c1f4b487d26a1d4f5d3054f49b90602001620006db565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b038085166024830152831660448201526064810182905262000da39085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262000df9565b50505050565b6040516001600160a01b03831660248201526044810182905262000df49084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640162000d3e565b505050565b600062000e50826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662000ee59092919063ffffffff16565b80519091501562000df4578080602001905181019062000e719190620015ad565b62000df45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016200032e565b606062000ef6848460008562000efe565b949350505050565b60608247101562000f785760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016200032e565b600080866001600160a01b0316858760405162000f969190620015d1565b60006040518083038185875af1925050503d806000811462000fd5576040519150601f19603f3d011682016040523d82523d6000602084013e62000fda565b606091505b509150915062000fed8783838762000ff8565b979650505050505050565b606083156200106c57825160000362001064576001600160a01b0385163b620010645760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200032e565b508162000ef6565b62000ef68383815115620010835781518083602001fd5b8060405162461bcd60e51b81526004016200032e9190620015ef565b613604806200162583390190565b6001600160a01b03811681146200029557600080fd5b600060208284031215620010d657600080fd5b8135620010e381620010ad565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715620011455762001145620010ea565b604052919050565b600067ffffffffffffffff8211156200116a576200116a620010ea565b5060051b60200190565b803561ffff811681146200118757600080fd5b919050565b600082601f8301126200119e57600080fd5b81356020620011b7620011b1836200114d565b62001119565b82815260059290921b84018101918181019086841115620011d757600080fd5b8286015b84811015620011fd57620011ef8162001174565b8352918301918301620011db565b509695505050505050565b600082601f8301126200121a57600080fd5b813560206200122d620011b1836200114d565b82815260059290921b840181019181810190868411156200124d57600080fd5b8286015b84811015620011fd57803563ffffffff81168114620012705760008081fd5b835291830191830162001251565b60008060008060008060c087890312156200129857600080fd5b8635620012a581620010ad565b955060208781013567ffffffffffffffff80821115620012c457600080fd5b818a0191508a601f830112620012d957600080fd5b8135620012ea620011b1826200114d565b81815260059190911b8301840190848101908d8311156200130a57600080fd5b938501935b82851015620013355784356200132581620010ad565b825293850193908501906200130f565b9950505060408a013596506200134e60608b0162001174565b955060808a01359250808311156200136557600080fd5b620013738b848c016200118c565b945060a08a01359250808311156200138a57600080fd5b50506200139a89828a0162001208565b9150509295509295509295565b600060208284031215620013ba57600080fd5b5035919050565b60008060408385031215620013d557600080fd5b8235620013e281620010ad565b91506020830135620013f481620010ad565b809150509250929050565b600081518084526020808501945080840160005b838110156200143557815161ffff168752958201959082019060010162001413565b509495945050505050565b600081518084526020808501945080840160005b838110156200143557815163ffffffff168752958201959082019060010162001454565b600060c082016001600160a01b03808a168452602060c081860152828a5180855260e087019150828c01945060005b81811015620014c7578551851683529483019491830191600101620014a7565b5050896040870152620014e0606087018a61ffff169052565b8581036080870152620014f48189620013ff565b935050505082810360a08401526200150d818562001440565b9998505050505050505050565b60005b83811015620015375781810151838201526020016200151d565b50506000910152565b60008351620015548184602088016200151a565b8351908301906200156a8183602088016200151a565b01949350505050565b6000602082840312156200158657600080fd5b8151620010e381620010ad565b600060208284031215620015a657600080fd5b5051919050565b600060208284031215620015c057600080fd5b81518015158114620010e357600080fd5b60008251620015e58184602087016200151a565b9190910192915050565b6020815260008251806020840152620016108160408501602087016200151a565b601f01601f1916919091016040019291505056fe60a06040523480156200001157600080fd5b5060405162003604380380620036048339810160408190526200003491620007d3565b600160005585858585858585838383836200004f336200023e565b6001600160a01b038116620000905760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6001600160a01b03811660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015620000db573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001019190620008fb565b6200010e90600a62000a3c565b6200012290670de0b6b3a764000062000a4d565b600455506200013383838362000290565b5050505060008551116200016f5760405162461bcd60e51b8152602060048201526002602482015261453960f01b604482015260640162000087565b60005b8551811015620001c257600086828151811062000193576200019362000a70565b60200260200101519050620001ae816200048f60201b60201c565b50620001ba8162000a86565b905062000172565b505050600d919091555050506001600160a01b038616620002325760405162461bcd60e51b815260206004820152602360248201527f53696e676c655374616b696e67526577617264733a204e4f545f454c4b44455860448201526205f4c560ec1b606482015260840162000087565b50505050505062000b50565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b81518151148015620002a45750600a815111155b8015620002b757506107d08361ffff1611155b620002ea5760405162461bcd60e51b8152602060048201526002602482015261453560f01b604482015260640162000087565b600080620002fc6107d0600162000aa2565b905060005b835181101562000415578263ffffffff1684828151811062000327576200032762000a70565b602002602001015163ffffffff1611620003695760405162461bcd60e51b8152602060048201526002602482015261453760f01b604482015260640162000087565b818582815181106200037f576200037f62000a70565b602002602001015161ffff1610620003bf5760405162461bcd60e51b815260206004820152600260248201526108a760f31b604482015260640162000087565b838181518110620003d457620003d462000a70565b60200260200101519250848181518110620003f357620003f362000a70565b602002602001015161ffff169150806200040d9062000a86565b905062000301565b5082516200042b9060059060208601906200058f565b50835162000441906006906020870190620005e7565b5061ffff85166007556040517fab4c36b25b04e6f8ac9915203aba1048c17841782324a583e98128b8c1c964f390620004809087908790879062000ab8565b60405180910390a15050505050565b600a54600f1015620004ca5760405162461bcd60e51b815260206004820152600360248201526245313560e81b604482015260640162000087565b6001600160a01b038116620005075760405162461bcd60e51b8152602060048201526002602482015261453160f01b604482015260640162000087565b6001600160a01b0381166000908152600b602052604090205460ff166200058c57600a805460018082019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b0319166001600160a01b0384169081179091556000908152600b60205260409020805460ff191690911790555b50565b828054828255906000526020600020908101928215620005d5579160200282015b82811115620005d5578251829063ffffffff16905591602001919060010190620005b0565b50620005e39291506200062b565b5090565b828054828255906000526020600020908101928215620005d5579160200282015b82811115620005d5578251829061ffff1690559160200191906001019062000608565b5b80821115620005e357600081556001016200062c565b80516001600160a01b03811681146200065a57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620006a057620006a06200065f565b604052919050565b60006001600160401b03821115620006c457620006c46200065f565b5060051b60200190565b805161ffff811681146200065a57600080fd5b600082601f830112620006f357600080fd5b815160206200070c6200070683620006a8565b62000675565b82815260059290921b840181019181810190868411156200072c57600080fd5b8286015b8481101562000752576200074481620006ce565b835291830191830162000730565b509695505050505050565b600082601f8301126200076f57600080fd5b81516020620007826200070683620006a8565b82815260059290921b84018101918181019086841115620007a257600080fd5b8286015b848110156200075257805163ffffffff81168114620007c55760008081fd5b8352918301918301620007a6565b60008060008060008060c08789031215620007ed57600080fd5b620007f88762000642565b602088810151919750906001600160401b03808211156200081857600080fd5b818a0191508a601f8301126200082d57600080fd5b81516200083e6200070682620006a8565b81815260059190911b8301840190848101908d8311156200085e57600080fd5b938501935b828510156200088757620008778562000642565b8252938501939085019062000863565b809a5050505060408a01519650620008a260608b01620006ce565b955060808a0151925080831115620008b957600080fd5b620008c78b848c01620006e1565b945060a08a0151925080831115620008de57600080fd5b5050620008ee89828a016200075d565b9150509295509295509295565b6000602082840312156200090e57600080fd5b815160ff811681146200092057600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200097e57816000190482111562000962576200096262000927565b808516156200097057918102915b93841c939080029062000942565b509250929050565b600082620009975750600162000a36565b81620009a65750600062000a36565b8160018114620009bf5760028114620009ca57620009ea565b600191505062000a36565b60ff841115620009de57620009de62000927565b50506001821b62000a36565b5060208310610133831016604e8410600b841016171562000a0f575081810a62000a36565b62000a1b83836200093d565b806000190482111562000a325762000a3262000927565b0290505b92915050565b60006200092060ff84168362000986565b60008262000a6b57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006001820162000a9b5762000a9b62000927565b5060010190565b8082018082111562000a365762000a3662000927565b60006060820161ffff80871684526020606081860152828751808552608087019150828901945060005b8181101562000b0257855185168352948301949183019160010162000ae2565b5050858103604087015286518082529082019350915080860160005b8381101562000b4257815163ffffffff168552938201939082019060010162000b1e565b509298975050505050505050565b608051612a6e62000b9660003960008181610481015281816107600152818161090101528181610c3c01528181610fc501528181611757015261185f0152612a6e6000f3fe608060405234801561001057600080fd5b50600436106102c85760003560e01c806379ee54f71161017b578063a694fc3a116100d8578063e9fad8ee1161008c578063f122977711610071578063f122977714610601578063f2d1763914610614578063f2fde38b1461062757600080fd5b8063e9fad8ee146105f0578063ebe2b12b146105f857600080fd5b8063ab879827116100bd578063ab879827146105b3578063c8f33c91146105bc578063e70b9e27146105c557600080fd5b8063a694fc3a14610565578063a7309d7d1461057857600080fd5b806387e7ed3a1161012f5780639003adfe116101145780639003adfe146105295780639ce43f90146105325780639e3582c81461055257600080fd5b806387e7ed3a146105055780638da5cb5b1461051857600080fd5b80637bb7bed1116101605780637bb7bed1146104e15780637beb3d9f146104f457806380faa57d146104fd57600080fd5b806379ee54f7146104bb5780637aaeaf7f146104ce57600080fd5b8063386a9525116102295780636b091695116101dd5780637035ab98116101c25780637035ab9814610449578063715018a61461047457806372f702f31461047c57600080fd5b80636b091695146104235780636da9c58e1461043657600080fd5b8063415be3b51161020e578063415be3b5146103d7578063423c485a146103fd57806354feec3e1461041057600080fd5b8063386a9525146103ae5780633d3b2603146103b757600080fd5b80631db7efd81161028057806327e235e31161026557806327e235e3146103685780632e1a7d4d146103885780632e9f06021461039b57600080fd5b80631db7efd814610322578063211dc32d1461035557600080fd5b80631171bda9116102b15780631171bda9146102f357806318160ddd146103065780631c03e6cc1461030f57600080fd5b806301f59d16146102cd57806302329e17146102e9575b600080fd5b6102d66107d081565b6040519081526020015b60405180910390f35b6102f161063a565b005b6102f16103013660046125da565b6108ef565b6102d660025481565b6102f161031d366004612616565b6109f8565b610345610330366004612616565b600b6020526000908152604090205460ff1681565b60405190151581526020016102e0565b6102d6610363366004612631565b610a43565b6102d6610376366004612616565b60036020526000908152604090205481565b6102f1610396366004612664565b610b67565b6102f16103a9366004612693565b610ca4565b6102d6600d5481565b6102d66103c5366004612616565b600f6020526000908152604090205481565b6103ea6103e5366004612616565b611133565b60405160009190910b81526020016102e0565b6102d661040b366004612664565b6111b9565b6102d661041e366004612664565b6111e6565b6102f1610431366004612631565b611207565b6102f1610444366004612616565b611348565b6102d6610457366004612631565b601160209081526000928352604080842090915290825290205481565b6102f161146d565b6104a37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102e0565b6102f16104c9366004612616565b611481565b6102d66104dc366004612757565b611607565b6104a36104ef366004612664565b6116bd565b6102d661271081565b6102d66116e7565b6102f1610513366004612616565b6116fe565b6001546001600160a01b03166104a3565b6102d660085481565b6102d6610540366004612616565b60106020526000908152604090205481565b6102d6610560366004612664565b611789565b6102f1610573366004612664565b611799565b61059e610586366004612616565b60096020526000908152604090205463ffffffff1681565b60405163ffffffff90911681526020016102e0565b6102d660075481565b6102d6600e5481565b6102d66105d3366004612631565b601260209081526000928352604080842090915290825290205481565b6102f16118b9565b6102d6600c5481565b6102d661060f366004612616565b6118db565b6102f1610622366004612631565b6119e2565b6102f1610635366004612616565b611b64565b3360005b600a548110156106a7576000600a828154811061065d5761065d612781565b6000918252602090912001546001600160a01b0316905061067d816118db565b6001600160a01b039091166000908152601060205260409020556106a0816127ad565b905061063e565b506106b06116e7565b600e556001600160a01b0381161561075e5760005b600a5481101561075c576000600a82815481106106e4576106e4612781565b6000918252602090912001546001600160a01b031690506107058184610a43565b6001600160a01b03918216600081815260126020908152604080832095881680845295825280832094909455918152601082528281205460118352838220948252939091522055610755816127ad565b90506106c5565b505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0381166000908152600b602052604090205460ff166108125760405162461bcd60e51b815260206004820152602960248201527f53696e676c655374616b696e67526577617264733a20434f4d504f554e445f4960448201527f4d504f535349424c45000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038116600090815260126020908152604080832033845290915290205480156108ea5733600081815260036020818152604080842080546001600160a01b03891686526012845282862096865295835290842084905591905280548492906108829084906127c6565b92505081905550816002600082825461089b91906127c6565b909155505033600090815260036020908152604091829020548251848152918201527fc0dbba536f9e895f506b05695b6beb91b0c1a820932d2d7ecf4a941dbdd1fb55910160405180910390a1505b505050565b6108f7611bf1565b6108ff611c4a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036109805760405162461bcd60e51b815260206004820152600260248201527f45340000000000000000000000000000000000000000000000000000000000006044820152606401610809565b61098b838383611ca4565b826109a06001600160a01b0382168484611d0d565b826001600160a01b0316846001600160a01b03167ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b648846040516109e591815260200190565b60405180910390a3506108ea6001600055565b610a00611c4a565b600c544211610a375760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610809565b610a4081611db6565b50565b6001600160a01b03808316600081815260126020908152604080832094861683529381528382205484517f313ce5670000000000000000000000000000000000000000000000000000000081529451929490939263313ce567926004808401939192918290030181865afa158015610abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae391906127d9565b610aee90600a6128e7565b6001600160a01b03808616600090815260116020908152604080832093881683529290522054610b1d866118db565b610b2791906128f6565b6001600160a01b038516600090815260036020526040902054610b4a9190612909565b610b549190612920565b610b5e91906127c6565b90505b92915050565b610b6f611bf1565b80610b7a3382611ef3565b9150600082118015610b9b5750336000908152600360205260409020548211155b8015610bb65750336000908152600360205260409020548111155b610be75760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610809565b600454610bf49082612909565b60026000828254610c0591906128f6565b90915550503360009081526003602052604081208054839290610c299084906128f6565b90915550610c6390506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163384611d0d565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250610a406001600055565b610cac611bf1565b610cb4611c4a565b600c544211610ceb5760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610809565b6000805b600a54811015610d58576000600a8281548110610d0e57610d0e612781565b6000918252602090912001546001600160a01b03169050610d2e816118db565b6001600160a01b03909116600090815260106020526040902055610d51816127ad565b9050610cef565b50610d616116e7565b600e556001600160a01b03811615610e0f5760005b600a54811015610e0d576000600a8281548110610d9557610d95612781565b6000918252602090912001546001600160a01b03169050610db68184610a43565b6001600160a01b03918216600081815260126020908152604080832095881680845295825280832094909455918152601082528281205460118352838220948252939091522055610e06816127ad565b9050610d76565b505b60008211610e5f5760405162461bcd60e51b815260206004820152600360248201527f45313000000000000000000000000000000000000000000000000000000000006044820152606401610809565b600a54835114610eb15760405162461bcd60e51b815260206004820152600360248201527f45313100000000000000000000000000000000000000000000000000000000006044820152606401610809565b600d82905560005b600a548110156110d4576000600a8281548110610ed857610ed8612781565b600091825260209091200154600d5486516001600160a01b0390921692508291879085908110610f0a57610f0a612781565b6020026020010151610f1c9190612920565b6001600160a01b0382166000908152600f6020526040812091909155600a805485908110610f4c57610f4c612781565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc19190612942565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b03161461105a57600d546110099082612920565b6001600160a01b0383166000908152600f602052604090205411156110555760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610809565b6110c0565b600d5460025461106a90836128f6565b6110749190612920565b6001600160a01b0383166000908152600f602052604090205411156110c05760405162461bcd60e51b8152602060048201526002602482015261453360f01b6044820152606401610809565b505050806110cd906127ad565b9050610eb9565b5042600e819055600d546110e7916127c6565b600c556040517faab1f55dce0d0e628e283ce1061d0afccffcf61f9c14391c899b5952492ce8219061111c908590859061295b565b60405180910390a15061112f6001600055565b5050565b6001600160a01b0381166000908152600b602052604081205460ff16156111b05760005b600a548110156111ae57826001600160a01b0316600a828154811061117e5761117e612781565b6000918252602090912001546001600160a01b03160361119e5792915050565b6111a7816127ad565b9050611157565b505b50600019919050565b600080600754116111cb576000610b61565b612710600754836111dc9190612909565b610b619190612920565b600581815481106111f657600080fd5b600091825260209091200154905081565b61120f611bf1565b8060005b600a5481101561127c576000600a828154811061123257611232612781565b6000918252602090912001546001600160a01b03169050611252816118db565b6001600160a01b03909116600090815260106020526040902055611275816127ad565b9050611213565b506112856116e7565b600e556001600160a01b038116156113335760005b600a54811015611331576000600a82815481106112b9576112b9612781565b6000918252602090912001546001600160a01b031690506112da8184610a43565b6001600160a01b0391821660008181526012602090815260408083209588168084529582528083209490945591815260108252828120546011835283822094825293909152205561132a816127ad565b905061129a565b505b61133d8383611f7a565b5061112f6001600055565b611350611bf1565b611358611c4a565b600c544211156113905760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610809565b600042600c5411156113ad5742600c546113aa91906128f6565b90505b42600c5560005b600a54811015611438576000600a82815481106113d3576113d3612781565b60009182526020808320909101546001600160a01b0316808352600f9091526040822054909250829190611408908690612909565b90508015611424576114246001600160a01b0384168783611d0d565b50505080611431906127ad565b90506113b4565b506040517f9bad5e1e43bc35e89725967a54f4bc384078248a1ea5c315be3b260a68cbb17a90600090a150610a406001600055565b611475611c4a565b61147f6000612103565b565b611489611bf1565b8060005b600a548110156114f6576000600a82815481106114ac576114ac612781565b6000918252602090912001546001600160a01b031690506114cc816118db565b6001600160a01b039091166000908152601060205260409020556114ef816127ad565b905061148d565b506114ff6116e7565b600e556001600160a01b038116156115ad5760005b600a548110156115ab576000600a828154811061153357611533612781565b6000918252602090912001546001600160a01b031690506115548184610a43565b6001600160a01b039182166000818152601260209081526040808320958816808452958252808320949094559181526010825282812054601183528382209482529390915220556115a4816127ad565b9050611514565b505b60005b600a548110156115fb576115eb600a82815481106115d0576115d0612781565b6000918252602090912001546001600160a01b031684611f7a565b6115f4816127ad565b90506115b0565b5050610a406001600055565b6001600160a01b03821660009081526009602052604081205481906116329063ffffffff16426128f6565b90506000805b6005548110156116b4576005818154811061165557611655612781565b90600052602060002001548310156116a4576127106006828154811061167d5761167d612781565b9060005260206000200154866116939190612909565b61169d9190612920565b91506116b4565b6116ad816127ad565b9050611638565b50949350505050565b600a81815481106116cd57600080fd5b6000918252602090912001546001600160a01b0316905081565b6000600c5442106116f95750600c5490565b504290565b611706611c4a565b61170e611bf1565b6008805460009091556040518181527f6857c770f3cb43e9c19050a37dd914ec876241c1f4b487d26a1d4f5d3054f49b9060200160405180910390a161177e6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383611d0d565b50610a406001600055565b600681815481106111f657600080fd5b6117a1611bf1565b806117ac3382612162565b91506000821180156117be5750600081115b61180a5760405162461bcd60e51b815260206004820152600260248201527f45320000000000000000000000000000000000000000000000000000000000006044820152606401610809565b6004546118179083612909565b6002600082825461182891906127c6565b9091555050336000908152600360205260408120805484929061184c9084906127c6565b9091555061188790506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330846122ca565b60405182815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610c91565b6118c233612321565b3360009081526003602052604090205461147f90610b67565b600060025460000361190357506001600160a01b031660009081526010602052604090205490565b600254826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611944573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196891906127d9565b61197390600a6128e7565b6001600160a01b0384166000908152600f6020526040902054600e546119976116e7565b6119a191906128f6565b6119ab9190612909565b6119b59190612909565b6119bf9190612920565b6001600160a01b038316600090815260106020526040902054610b6191906127c6565b6119ea611c4a565b600c544211611a215760405162461bcd60e51b815260206004820152600360248201526245313760e81b6044820152606401610809565b60025415611a715760405162461bcd60e51b815260206004820152600360248201527f45313200000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0382166000908152600b602052604090205460ff161561112f576040516370a0823160e01b815230600482015282906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611adb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aff9190612942565b90508015611b1b57611b1b6001600160a01b0383168483611d0d565b826001600160a01b03167fcaa95c7b01f93ffe197f5e7316a1a2f387c5bfff8cb445095f2110ff5c1b299582604051611b5691815260200190565b60405180910390a250505050565b611b6c611c4a565b6001600160a01b038116611be85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610809565b610a4081612103565b600260005403611c435760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610809565b6002600055565b6001546001600160a01b0316331461147f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610809565b6001600160a01b0383166000908152600b602052604090205460ff16156108ea5760405162461bcd60e51b815260206004820152600360248201527f45313600000000000000000000000000000000000000000000000000000000006044820152606401610809565b6040516001600160a01b0383166024820152604481018290526108ea9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261232a565b600a54600f1015611e095760405162461bcd60e51b815260206004820152600360248201527f45313500000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b038116611e5f5760405162461bcd60e51b815260206004820152600260248201527f45310000000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0381166000908152600b602052604090205460ff16610a4057600a805460018181019092557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b03841673ffffffffffffffffffffffffffffffffffffffff1990911681179091556000908152600b60205260409020805460ff1916909117905550565b600080611f008484611607565b90508015611f5f578060086000828254611f1a91906127c6565b90915550506040518181526001600160a01b038516907fd0b34aaed5c558a8df736a5aaf9a49b539c4e86fb3ee5a1ac76e0bec23cbdd03906020015b60405180910390a25b611f7284611f6d83866128f6565b919050565b949350505050565b6001546001600160a01b0316331480611f9b5750336001600160a01b038216145b611fe75760405162461bcd60e51b815260206004820152600360248201527f45313400000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0382166000908152600b602052604090205460ff1661204f5760405162461bcd60e51b815260206004820152600360248201527f45313300000000000000000000000000000000000000000000000000000000006044820152606401610809565b6001600160a01b0380831660009081526012602090815260408083209385168352929052205480156108ea576001600160a01b0380841660008181526012602090815260408083209487168352939052918220919091556120b1908383611d0d565b816001600160a01b0316836001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e836040516120f691815260200190565b60405180910390a3505050565b600180546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000600c5442111561219c5760405162461bcd60e51b815260206004820152600360248201526208a62760eb1b6044820152606401610809565b8260005b600a54811015612209576000600a82815481106121bf576121bf612781565b6000918252602090912001546001600160a01b031690506121df816118db565b6001600160a01b03909116600090815260106020526040902055612202816127ad565b90506121a0565b506122126116e7565b600e556001600160a01b038116156122c05760005b600a548110156122be576000600a828154811061224657612246612781565b6000918252602090912001546001600160a01b031690506122678184610a43565b6001600160a01b039182166000818152601260209081526040808320958816808452958252808320949094559181526010825282812054601183528382209482529390915220556122b7816127ad565b9050612227565b505b611f72848461240f565b6040516001600160a01b038085166024830152831660448201526064810182905261231b9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611d52565b50505050565b610a4081611481565b600061237f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124a09092919063ffffffff16565b8051909150156108ea578080602001905181019061239d91906129a3565b6108ea5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610809565b60008061241b836111b9565b6001600160a01b0385166000908152600960205260409020805463ffffffff19164263ffffffff1617905590508015611f5f57806008600082825461246091906127c6565b90915550506040518181526001600160a01b038516907f34f2a7363b1ef64b0b62a223c88cf3f54a68686acfcb9531d7deb46004f37c4690602001611f56565b6060611f72848460008585600080866001600160a01b031685876040516124c791906129e9565b60006040518083038185875af1925050503d8060008114612504576040519150601f19603f3d011682016040523d82523d6000602084013e612509565b606091505b509150915061251a87838387612525565b979650505050505050565b6060831561259457825160000361258d576001600160a01b0385163b61258d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610809565b5081611f72565b611f7283838151156125a95781518083602001fd5b8060405162461bcd60e51b81526004016108099190612a05565b80356001600160a01b0381168114611f6d57600080fd5b6000806000606084860312156125ef57600080fd5b6125f8846125c3565b9250612606602085016125c3565b9150604084013590509250925092565b60006020828403121561262857600080fd5b610b5e826125c3565b6000806040838503121561264457600080fd5b61264d836125c3565b915061265b602084016125c3565b90509250929050565b60006020828403121561267657600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156126a657600080fd5b823567ffffffffffffffff808211156126be57600080fd5b818501915085601f8301126126d257600080fd5b81356020828211156126e6576126e661267d565b8160051b604051601f19603f8301168101818110868211171561270b5761270b61267d565b60405292835281830193508481018201928984111561272957600080fd5b948201945b838610156127475785358552948201949382019361272e565b9997909101359750505050505050565b6000806040838503121561276a57600080fd5b612773836125c3565b946020939093013593505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016127bf576127bf612797565b5060010190565b80820180821115610b6157610b61612797565b6000602082840312156127eb57600080fd5b815160ff811681146127fc57600080fd5b9392505050565b600181815b8085111561283e57816000190482111561282457612824612797565b8085161561283157918102915b93841c9390800290612808565b509250929050565b60008261285557506001610b61565b8161286257506000610b61565b816001811461287857600281146128825761289e565b6001915050610b61565b60ff84111561289357612893612797565b50506001821b610b61565b5060208310610133831016604e8410600b84101617156128c1575081810a610b61565b6128cb8383612803565b80600019048211156128df576128df612797565b029392505050565b6000610b5e60ff841683612846565b81810381811115610b6157610b61612797565b8082028115828204841417610b6157610b61612797565b60008261293d57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561295457600080fd5b5051919050565b604080825283519082018190526000906020906060840190828701845b8281101561299457815184529284019290840190600101612978565b50505092019290925292915050565b6000602082840312156129b557600080fd5b815180151581146127fc57600080fd5b60005b838110156129e05781810151838201526020016129c8565b50506000910152565b600082516129fb8184602087016129c5565b9190910192915050565b6020815260008251806020840152612a248160408501602087016129c5565b601f01601f1916919091016040019291505056fea26469706673582212207aee72bbe06db4ac4d8adb7523824ac4758e8491370f60b4b49ce488e28937bc64736f6c63430008130033a26469706673582212207baae4111b487331ce185af6ae9a1102271e33261116d85e00deb398e8f8cd6464736f6c63430008130033

Deployed ByteCode Sourcemap

78466:6694:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;79377:37;;;;;;;;;160:25:1;;;148:2;133:18;79377:37:0;;;;;;;;83852:119;;;;;;:::i;:::-;;:::i;:::-;;80200:1533;;;;;;:::i;:::-;;:::i;78850:34::-;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;5013:55:1;;;4995:74;;4983:2;4968:18;78850:34:0;4849:226:1;83635:77:0;;;:::i;78943:35::-;;;;;-1:-1:-1;;;;;78943:35:0;;;83329:190;;;;;;:::i;:::-;;:::i;46993:103::-;;;:::i;81821:105::-;81903:8;:15;81821:105;;46345:87;46391:7;46418:6;-1:-1:-1;;;;;46418:6:0;46345:87;;79048:54;;;;;;:::i;:::-;;;;;;;;;;;;-1:-1:-1;;;;;79048:54:0;;;82377:289;;;;;;:::i;:::-;;:::i;79292:31::-;;;;;;78703:78;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;78703:78:0;;;47251:201;;;;;;:::i;:::-;;:::i;83852:119::-;46231:13;:11;:13::i;:::-;83931:32:::1;83950:12;83931:18;:32::i;:::-;83852:119:::0;:::o;80200:1533::-;80550:10;80595:1;80535:26;;;:14;:26;;;;;;;;-1:-1:-1;;;;;80535:48:0;;;;;;;;;;;;:62;80513:146;;;;-1:-1:-1;;;80513:146:0;;5675:2:1;80513:146:0;;;5657:21:1;5714:2;5694:18;;;5687:30;5753:34;5733:18;;;5726:62;5824:4;5804:18;;;5797:32;5846:19;;80513:146:0;;;;;;;;;80702:25;80730:39;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;80702:67;;80780:21;80835:12;80891:20;80930:21;80970:16;81005:14;81038:18;81075:22;80862:250;;;;;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;80862:250:0;;;;;;;;;;80804:319;;;80862:250;80804:319;;:::i;:::-;;;;-1:-1:-1;;80804:319:0;;;;;;;;;;-1:-1:-1;;9171:2:1;9167:15;;;9163:24;;80804:319:0;81196:50;;9151:37:1;81235:10:0;9222:15:1;;9218:24;9204:12;;;9197:46;80804:319:0;-1:-1:-1;81134:12:0;;;;9259::1;;81196:50:0;;;;;;;;;;;;81172:85;;;;;;81157:100;;81351:4;81340:8;81334:15;81327:4;81317:8;81313:19;81310:1;81302:54;81294:62;;81392:4;81380:17;81370:75;;81428:1;81425;81418:12;81370:75;81519:4;81468:14;:26;81483:10;-1:-1:-1;;;;;81468:26:0;-1:-1:-1;;;;;81468:26:0;;;;;;;;;;;;:48;81495:20;-1:-1:-1;;;;;81468:48:0;-1:-1:-1;;;;;81468:48:0;;;;;;;;;;;;;:55;;;;;-1:-1:-1;;;;;81468:55:0;;;;;-1:-1:-1;;;;;81468:55:0;;;;;;81553:10;81534;:16;81545:4;-1:-1:-1;;;;;81534:16:0;-1:-1:-1;;;;;81534:16:0;;;;;;;;;;;;;:29;;;;;-1:-1:-1;;;;;81534:29:0;;;;;-1:-1:-1;;;;;81534:29:0;;;;;;81574:8;81588:4;81574:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;81574:19:0;;;;;-1:-1:-1;;;;;81574:19:0;;;;;;81627:4;-1:-1:-1;;;;;81606:44:0;;81651:11;;;;;;;;;-1:-1:-1;;;;;81651:11:0;81606:57;;;;;;;;;;;;;;-1:-1:-1;;;;;5013:55:1;;;;4995:74;;4983:2;4968:18;;4849:226;81606:57:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;81676:10;:8;:10::i;:::-;81704:21;;-1:-1:-1;;;;;5013:55:1;;4995:74;;81704:21:0;;4983:2:1;4968:18;81704:21:0;;;;;;;80502:1231;;;;80200:1533;;;;;;:::o;78850:34::-;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;78850:34:0;;-1:-1:-1;78850:34:0;:::o;83635:77::-;46231:13;:11;:13::i;:::-;83689:15:::1;:13;:15::i;:::-;83635:77::o:0;83329:190::-;46231:13;:11;:13::i;:::-;83410:6:::1;;83400:7;:16;83392:64;;;::::0;-1:-1:-1;;;83392:64:0;;9484:2:1;83392:64:0::1;::::0;::::1;9466:21:1::0;9523:2;9503:18;;;9496:30;9562:34;9542:18;;;9535:62;9633:5;9613:18;;;9606:33;9656:19;;83392:64:0::1;9282:399:1::0;83392:64:0::1;83467:3;:13:::0;;;83496:15:::1;::::0;160:25:1;;;83496:15:0::1;::::0;148:2:1;133:18;83496:15:0::1;;;;;;;;83329:190:::0;:::o;46993:103::-;46231:13;:11;:13::i;:::-;47058:30:::1;47085:1;47058:18;:30::i;82377:289::-:0;46231:13;:11;:13::i;:::-;-1:-1:-1;;;;;82483:29:0;::::1;82461:114;;;::::0;-1:-1:-1;;;82461:114:0;;9888:2:1;82461:114:0::1;::::0;::::1;9870:21:1::0;9927:2;9907:18;;;9900:30;9966:34;9946:18;;;9939:62;10037:5;10017:18;;;10010:33;10060:19;;82461:114:0::1;9686:399:1::0;82461:114:0::1;82586:11;:29:::0;;-1:-1:-1;;82586:29:0::1;-1:-1:-1::0;;;;;82586:29:0;::::1;::::0;;::::1;::::0;;;82631:27:::1;::::0;4995:74:1;;;82631:27:0::1;::::0;4983:2:1;4968:18;82631:27:0::1;4849:226:1::0;47251:201:0;46231:13;:11;:13::i;:::-;-1:-1:-1;;;;;47340:22:0;::::1;47332:73;;;::::0;-1:-1:-1;;;47332:73:0;;10292:2:1;47332:73:0::1;::::0;::::1;10274:21:1::0;10331:2;10311:18;;;10304:30;10370:34;10350:18;;;10343:62;10441:8;10421:18;;;10414:36;10467:19;;47332:73:0::1;10090:402:1::0;47332:73:0::1;47416:28;47435:8;47416:18;:28::i;46510:132::-:0;46391:7;46418:6;-1:-1:-1;;;;;46418:6:0;31632:10;46574:23;46566:68;;;;-1:-1:-1;;;46566:68:0;;10699:2:1;46566:68:0;;;10681:21:1;;;10718:18;;;10711:30;10777:34;10757:18;;;10750:62;10829:18;;46566:68:0;10497:356:1;84483:674:0;-1:-1:-1;;;;;84577:24:0;;;84552:22;84577:24;;;:10;:24;;;;;;;84640:10;84622:28;;84614:81;;;;-1:-1:-1;;;84614:81:0;;11060:2:1;84614:81:0;;;11042:21:1;11099:2;11079:18;;;11072:30;11138:34;11118:18;;;11111:62;11209:10;11189:18;;;11182:38;11237:19;;84614:81:0;10858:404:1;84614:81:0;-1:-1:-1;;;;;84714:28:0;;84706:76;;;;-1:-1:-1;;;84706:76:0;;11469:2:1;84706:76:0;;;11451:21:1;11508:2;11488:18;;;11481:30;11547:34;11527:18;;;11520:62;11618:5;11598:18;;;11591:33;11641:19;;84706:76:0;11267:399:1;84706:76:0;84795:36;84869:12;84795:97;;84903:20;84934:15;-1:-1:-1;;;;;84934:28:0;;:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;84978:30:0;;;85033:1;84978:30;;;:14;:30;;;;;;;;:44;;;;;;;;;;;;:57;;-1:-1:-1;;84978:57:0;;;;;;85061:10;85046:26;;;;;;;;;:40;;;;;;;;;:55;;;;;;;;;;;;;;85112:24;;;:10;:24;;;;;;;:37;;;;;;;;;;;-1:-1:-1;;84483:674:0:o;82840:245::-;82935:3;;82901:8;;:30;;-1:-1:-1;;;82901:30:0;;82920:10;82901:30;;;4995:74:1;-1:-1:-1;;;;;82901:8:0;;;;:18;;4968::1;;82901:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:37;;82879:130;;;;-1:-1:-1;;;82879:130:0;;12332:2:1;82879:130:0;;;12314:21:1;12371:2;12351:18;;;12344:30;12410:34;12390:18;;;12383:62;12481:13;12461:18;;;12454:41;12512:19;;82879:130:0;12130:407:1;82879:130:0;83073:3;;83020:8;;:57;;-1:-1:-1;;;;;83020:8:0;;;;83046:10;;83066:4;;83020:25;:57::i;83979:194::-;84041:8;;:33;;-1:-1:-1;;;84041:33:0;;84068:4;84041:33;;;4995:74:1;84023:15:0;;-1:-1:-1;;;;;84041:8:0;;:18;;4968::1;;84041:33:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;84085:8;;84023:51;;-1:-1:-1;84085:42:0;;-1:-1:-1;;;;;84085:8:0;84107:10;84023:51;84085:21;:42::i;:::-;84143:22;;160:25:1;;;84143:22:0;;148:2:1;133:18;84143:22:0;14:177:1;47612:191:0;47686:16;47705:6;;-1:-1:-1;;;;;47722:17:0;;;-1:-1:-1;;47722:17:0;;;;;;47755:40;;47705:6;;;;;;;47755:40;;47686:16;47755:40;47675:128;47612:191;:::o;27296:248::-;27467:68;;-1:-1:-1;;;;;12823:15:1;;;27467:68:0;;;12805:34:1;12875:15;;12855:18;;;12848:43;12907:18;;;12900:34;;;27440:96:0;;27460:5;;27490:27;;12717:18:1;;27467:68:0;;;;-1:-1:-1;;27467:68:0;;;;;;;;;;;;;;;;;;;;;;;;;;;27440:19;:96::i;:::-;27296:248;;;;:::o;27077:211::-;27221:58;;-1:-1:-1;;;;;13137:55:1;;27221:58:0;;;13119:74:1;13209:18;;;13202:34;;;27194:86:0;;27214:5;;27244:23;;13092:18:1;;27221:58:0;12945:297:1;27194:86:0;27077:211;;;:::o;30144:716::-;30568:23;30594:69;30622:4;30594:69;;;;;;;;;;;;;;;;;30602:5;-1:-1:-1;;;;;30594:27:0;;;:69;;;;;:::i;:::-;30678:17;;30568:95;;-1:-1:-1;30678:21:0;30674:179;;30775:10;30764:30;;;;;;;;;;;;:::i;:::-;30756:85;;;;-1:-1:-1;;;30756:85:0;;13731:2:1;30756:85:0;;;13713:21:1;13770:2;13750:18;;;13743:30;13809:34;13789:18;;;13782:62;13880:12;13860:18;;;13853:40;13910:19;;30756:85:0;13529:406:1;8589:229:0;8726:12;8758:52;8780:6;8788:4;8794:1;8797:12;8758:21;:52::i;:::-;8751:59;8589:229;-1:-1:-1;;;;8589:229:0:o;9709:455::-;9879:12;9937:5;9912:21;:30;;9904:81;;;;-1:-1:-1;;;9904:81:0;;14142:2:1;9904:81:0;;;14124:21:1;14181:2;14161:18;;;14154:30;14220:34;14200:18;;;14193:62;14291:8;14271:18;;;14264:36;14317:19;;9904:81:0;13940:402:1;9904:81:0;9997:12;10011:23;10038:6;-1:-1:-1;;;;;10038:11:0;10057:5;10064:4;10038:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9996:73;;;;10087:69;10114:6;10122:7;10131:10;10143:12;10087:26;:69::i;:::-;10080:76;9709:455;-1:-1:-1;;;;;;;9709:455:0:o;12282:644::-;12467:12;12496:7;12492:427;;;12524:10;:17;12545:1;12524:22;12520:290;;-1:-1:-1;;;;;6127:19:0;;;12734:60;;;;-1:-1:-1;;;12734:60:0;;14841:2:1;12734:60:0;;;14823:21:1;14880:2;14860:18;;;14853:30;14919:31;14899:18;;;14892:59;14968:18;;12734:60:0;14639:353:1;12734:60:0;-1:-1:-1;12831:10:0;12824:17;;12492:427;12874:33;12882:10;12894:12;13629:17;;:21;13625:388;;13861:10;13855:17;13918:15;13905:10;13901:2;13897:19;13890:44;13625:388;13988:12;13981:20;;-1:-1:-1;;;13981:20:0;;;;;;;;:::i;-1:-1:-1:-;;;;;;;;:::o;196:154:1:-;-1:-1:-1;;;;;275:5:1;271:54;264:5;261:65;251:93;;340:1;337;330:12;355:247;414:6;467:2;455:9;446:7;442:23;438:32;435:52;;;483:1;480;473:12;435:52;522:9;509:23;541:31;566:5;541:31;:::i;:::-;591:5;355:247;-1:-1:-1;;;355:247:1:o;607:184::-;659:77;656:1;649:88;756:4;753:1;746:15;780:4;777:1;770:15;796:275;867:2;861:9;932:2;913:13;;-1:-1:-1;;909:27:1;897:40;;967:18;952:34;;988:22;;;949:62;946:88;;;1014:18;;:::i;:::-;1050:2;1043:22;796:275;;-1:-1:-1;796:275:1:o;1076:183::-;1136:4;1169:18;1161:6;1158:30;1155:56;;;1191:18;;:::i;:::-;-1:-1:-1;1236:1:1;1232:14;1248:4;1228:25;;1076:183::o;1264:159::-;1331:20;;1391:6;1380:18;;1370:29;;1360:57;;1413:1;1410;1403:12;1360:57;1264:159;;;:::o;1428:666::-;1481:5;1534:3;1527:4;1519:6;1515:17;1511:27;1501:55;;1552:1;1549;1542:12;1501:55;1588:6;1575:20;1614:4;1638:60;1654:43;1694:2;1654:43;:::i;:::-;1638:60;:::i;:::-;1732:15;;;1818:1;1814:10;;;;1802:23;;1798:32;;;1763:12;;;;1842:15;;;1839:35;;;1870:1;1867;1860:12;1839:35;1906:2;1898:6;1894:15;1918:147;1934:6;1929:3;1926:15;1918:147;;;2000:22;2018:3;2000:22;:::i;:::-;1988:35;;2043:12;;;;1951;;1918:147;;;-1:-1:-1;2083:5:1;1428:666;-1:-1:-1;;;;;;1428:666:1:o;2099:836::-;2152:5;2205:3;2198:4;2190:6;2186:17;2182:27;2172:55;;2223:1;2220;2213:12;2172:55;2259:6;2246:20;2285:4;2309:60;2325:43;2365:2;2325:43;:::i;2309:60::-;2403:15;;;2489:1;2485:10;;;;2473:23;;2469:32;;;2434:12;;;;2513:15;;;2510:35;;;2541:1;2538;2531:12;2510:35;2577:2;2569:6;2565:15;2589:317;2605:6;2600:3;2597:15;2589:317;;;2685:3;2672:17;2733:10;2726:5;2722:22;2715:5;2712:33;2702:131;;2787:1;2816:2;2812;2805:14;2702:131;2846:18;;2884:12;;;;2622;;2589:317;;2940:1719;3116:6;3124;3132;3140;3148;3156;3209:3;3197:9;3188:7;3184:23;3180:33;3177:53;;;3226:1;3223;3216:12;3177:53;3265:9;3252:23;3284:31;3309:5;3284:31;:::i;:::-;3334:5;-1:-1:-1;3358:2:1;3396:18;;;3383:32;3434:18;3464:14;;;3461:34;;;3491:1;3488;3481:12;3461:34;3529:6;3518:9;3514:22;3504:32;;3574:7;3567:4;3563:2;3559:13;3555:27;3545:55;;3596:1;3593;3586:12;3545:55;3632:2;3619:16;3655:60;3671:43;3711:2;3671:43;:::i;3655:60::-;3749:15;;;3831:1;3827:10;;;;3819:19;;3815:28;;;3780:12;;;;3855:19;;;3852:39;;;3887:1;3884;3877:12;3852:39;3911:11;;;;3931:223;3947:6;3942:3;3939:15;3931:223;;;4029:3;4016:17;4046:33;4071:7;4046:33;:::i;:::-;4092:20;;3964:12;;;;4132;;;;3931:223;;;4173:5;-1:-1:-1;;;4225:2:1;4210:18;;4197:32;;-1:-1:-1;4248:37:1;4281:2;4266:18;;4248:37;:::i;:::-;4238:47;;4338:3;4327:9;4323:19;4310:33;4294:49;;4368:2;4358:8;4355:16;4352:36;;;4384:1;4381;4374:12;4352:36;4407:62;4461:7;4450:8;4439:9;4435:24;4407:62;:::i;:::-;4397:72;;4522:3;4511:9;4507:19;4494:33;4478:49;;4552:2;4542:8;4539:16;4536:36;;;4568:1;4565;4558:12;4536:36;;;4591:62;4645:7;4634:8;4623:9;4619:24;4591:62;:::i;:::-;4581:72;;;2940:1719;;;;;;;;:::o;4664:180::-;4723:6;4776:2;4764:9;4755:7;4751:23;4747:32;4744:52;;;4792:1;4789;4782:12;4744:52;-1:-1:-1;4815:23:1;;4664:180;-1:-1:-1;4664:180:1:o;5080:388::-;5148:6;5156;5209:2;5197:9;5188:7;5184:23;5180:32;5177:52;;;5225:1;5222;5215:12;5177:52;5264:9;5251:23;5283:31;5308:5;5283:31;:::i;:::-;5333:5;-1:-1:-1;5390:2:1;5375:18;;5362:32;5403:33;5362:32;5403:33;:::i;:::-;5455:7;5445:17;;;5080:388;;;;;:::o;5971:447::-;6023:3;6061:5;6055:12;6088:6;6083:3;6076:19;6114:4;6143:2;6138:3;6134:12;6127:19;;6180:2;6173:5;6169:14;6201:1;6211:182;6225:6;6222:1;6219:13;6211:182;;;6290:13;;6305:6;6286:26;6274:39;;6333:12;;;;6368:15;;;;6247:1;6240:9;6211:182;;;-1:-1:-1;6409:3:1;;5971:447;-1:-1:-1;;;;;5971:447:1:o;6423:451::-;6475:3;6513:5;6507:12;6540:6;6535:3;6528:19;6566:4;6595:2;6590:3;6586:12;6579:19;;6632:2;6625:5;6621:14;6653:1;6663:186;6677:6;6674:1;6671:13;6663:186;;;6742:13;;6757:10;6738:30;6726:43;;6789:12;;;;6824:15;;;;6699:1;6692:9;6663:186;;6879:1308;7255:4;7303:3;7292:9;7288:19;-1:-1:-1;;;;;7407:2:1;7399:6;7395:15;7384:9;7377:34;7430:2;7468:3;7463:2;7452:9;7448:18;7441:31;7492:6;7527;7521:13;7558:6;7550;7543:22;7596:3;7585:9;7581:19;7574:26;;7635:2;7627:6;7623:15;7609:29;;7656:1;7666:178;7680:6;7677:1;7674:13;7666:178;;;7745:13;;7741:22;;7729:35;;7819:15;;;;7784:12;;;;7702:1;7695:9;7666:178;;;7670:3;;7880:6;7875:2;7864:9;7860:18;7853:34;7896:45;7937:2;7926:9;7922:18;7914:6;5952;5941:18;5929:31;;5876:90;7896:45;7987:9;7982:3;7978:19;7972:3;7961:9;7957:19;7950:48;8021:40;8057:3;8049:6;8021:40;:::i;:::-;8007:54;;;;;8110:9;8102:6;8098:22;8092:3;8081:9;8077:19;8070:51;8138:43;8174:6;8166;8138:43;:::i;:::-;8130:51;6879:1308;-1:-1:-1;;;;;;;;;6879:1308:1:o;8192:250::-;8277:1;8287:113;8301:6;8298:1;8295:13;8287:113;;;8377:11;;;8371:18;8358:11;;;8351:39;8323:2;8316:10;8287:113;;;-1:-1:-1;;8434:1:1;8416:16;;8409:27;8192:250::o;8447:492::-;8622:3;8660:6;8654:13;8676:66;8735:6;8730:3;8723:4;8715:6;8711:17;8676:66;:::i;:::-;8805:13;;8764:16;;;;8827:70;8805:13;8764:16;8874:4;8862:17;;8827:70;:::i;:::-;8913:20;;8447:492;-1:-1:-1;;;;8447:492:1:o;11671:265::-;11755:6;11808:2;11796:9;11787:7;11783:23;11779:32;11776:52;;;11824:1;11821;11814:12;11776:52;11856:9;11850:16;11875:31;11900:5;11875:31;:::i;11941:184::-;12011:6;12064:2;12052:9;12043:7;12039:23;12035:32;12032:52;;;12080:1;12077;12070:12;12032:52;-1:-1:-1;12103:16:1;;11941:184;-1:-1:-1;11941:184:1:o;13247:277::-;13314:6;13367:2;13355:9;13346:7;13342:23;13338:32;13335:52;;;13383:1;13380;13373:12;13335:52;13415:9;13409:16;13468:5;13461:13;13454:21;13447:5;13444:32;13434:60;;13490:1;13487;13480:12;14347:287;14476:3;14514:6;14508:13;14530:66;14589:6;14584:3;14577:4;14569:6;14565:17;14530:66;:::i;:::-;14612:16;;;;;14347:287;-1:-1:-1;;14347:287:1:o;14997:396::-;15146:2;15135:9;15128:21;15109:4;15178:6;15172:13;15221:6;15216:2;15205:9;15201:18;15194:34;15237:79;15309:6;15304:2;15293:9;15289:18;15284:2;15276:6;15272:15;15237:79;:::i;:::-;15377:2;15356:15;-1:-1:-1;;15352:29:1;15337:45;;;;15384:2;15333:54;;14997:396;-1:-1:-1;;14997:396:1:o

Swarm Source

ipfs://7baae4111b487331ce185af6ae9a1102271e33261116d85e00deb398e8f8cd64
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.