Address Details
contract

0x5b3744C53114d114e73f2F81e8DDC65e650C86ec

Contract Name
ToshaStrategy
Creator
0xc98b48–837505 at 0x210a43–f3e321
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
33 Transfers
Gas Used
Fetching gas used...
Last Balance Update
8088546
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
ToshaStrategy




Optimization enabled
false
Compiler version
v0.8.0+commit.c7dfd78e




EVM Version
istanbul




Verified at
2023-02-01T20:20:39.744329Z

ToshaStrategy_flat.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.0;

abstract contract Governable {
    address public govAddress;

    event SetGov(address _govAddress);

    modifier onlyAllowGov() {
        require(msg.sender == govAddress, "!gov");
        _;
    }

    function setGov(address _govAddress) public virtual onlyAllowGov {
        govAddress = _govAddress;
        emit SetGov(_govAddress);
    }
}


/**
 * @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;
    }
}

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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

        return c;
    }

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

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


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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


// Tosha single token farming strategy
contract ToshaStrategy is Ownable, ReentrancyGuard, Pausable, Governable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    address public immutable tokenAddress;
    address public immutable toshaFarmAddress;

    // Total tokens managed by strategy
    uint256 public tokenLockedTotal = 0;

    // Sum of all shares of users to tokenLockedTotal
    uint256 public sharesTotal = 0;

    uint256 public entranceFeeFactor = 10000; // No deposit fees
    uint256 public constant entranceFeeFactorMax = 10000;
    uint256 public constant entranceFeeFactorLL = 9950; // 0.5% is the max entrance fee settable. LL = lowerlimit

    uint256 public withdrawFeeFactor = 10000; // No withdraw fees
    uint256 public constant withdrawFeeFactorMax = 10000;
    uint256 public constant withdrawFeeFactorLL = 9950; // 0.5% is the max entrance fee settable. LL = lowerlimit

    event SetSettings(uint256 _entranceFeeFactor, uint256 _withdrawFeeFactor);

    constructor (address _toshaToken, address _toshaFarmAddress, address _govAddress) {
        tokenAddress = _toshaToken;
        toshaFarmAddress = _toshaFarmAddress;
        govAddress = _govAddress;

        transferOwnership(_toshaFarmAddress);
    }

    // This contract doesn't auto-compound
    // earn() function is here to follow the Strategy interface
    function earn() external {}

    // Transfer tosha tokens [toshaFarm -> strategy]
    function deposit(
        address _userAddress,
        uint256 _toshaAmt
    ) external virtual onlyOwner nonReentrant whenNotPaused returns (uint256) {
        IERC20(tokenAddress).safeTransferFrom(
            address(msg.sender),
            address(this),
            _toshaAmt
        );

        uint256 sharesAdded = _toshaAmt;

        if (tokenLockedTotal > 0 && sharesTotal > 0) {
            sharesAdded = _toshaAmt
            .mul(sharesTotal)
            .mul(entranceFeeFactor)
            .div(tokenLockedTotal)
            .div(entranceFeeFactorMax);
        }

        sharesTotal = sharesTotal.add(sharesAdded);

        tokenLockedTotal = tokenLockedTotal.add(_toshaAmt);

        return sharesAdded;
    }

    // Transfer tosha tokens [strategy -> toshaFarm]
    function withdraw(
        address _userAddress,
        uint256 _toshaAmt
    ) external virtual onlyOwner nonReentrant returns (uint256) {
        require(_toshaAmt > 0, "_toshaAmt <= 0");

        uint256 sharesRemoved = _toshaAmt.mul(sharesTotal).div(tokenLockedTotal);

        if (sharesRemoved > sharesTotal) {
            sharesRemoved = sharesTotal;
        }

        sharesTotal = sharesTotal.sub(sharesRemoved);

        if (withdrawFeeFactor < withdrawFeeFactorMax) {
            _toshaAmt = _toshaAmt.mul(withdrawFeeFactor).div(
                withdrawFeeFactorMax
            );
        }

        uint256 toshaAmt = IERC20(tokenAddress).balanceOf(address(this));

        if (_toshaAmt > toshaAmt) {
            _toshaAmt = toshaAmt;
        }

        if (tokenLockedTotal < _toshaAmt) {
            _toshaAmt = tokenLockedTotal;
        }

        tokenLockedTotal = tokenLockedTotal.sub(_toshaAmt);

        IERC20(tokenAddress).safeTransfer(toshaFarmAddress, _toshaAmt);

        return sharesRemoved;
    }

    function inCaseTokensGetStuck(
        address _token,
        uint256 _amount,
        address _to
    ) external virtual onlyAllowGov {
        require(_token != tokenAddress, "!safe");
        IERC20(_token).safeTransfer(_to, _amount);
    }

    function setSettings(
        uint256 _entranceFeeFactor,
        uint256 _withdrawFeeFactor
    ) external virtual onlyAllowGov {
        require(
            _entranceFeeFactor >= entranceFeeFactorLL,
            "_entranceFeeFactor too low"
        );
        require(
            _entranceFeeFactor <= entranceFeeFactorMax,
            "_entranceFeeFactor too high"
        );
        entranceFeeFactor = _entranceFeeFactor;

        require(
            _withdrawFeeFactor >= withdrawFeeFactorLL,
            "_withdrawFeeFactor too low"
        );
        require(
            _withdrawFeeFactor <= withdrawFeeFactorMax,
            "_withdrawFeeFactor too high"
        );
        withdrawFeeFactor = _withdrawFeeFactor;

        emit SetSettings(_entranceFeeFactor, _withdrawFeeFactor);
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_toshaToken","internalType":"address"},{"type":"address","name":"_toshaFarmAddress","internalType":"address"},{"type":"address","name":"_govAddress","internalType":"address"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SetGov","inputs":[{"type":"address","name":"_govAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"SetSettings","inputs":[{"type":"uint256","name":"_entranceFeeFactor","internalType":"uint256","indexed":false},{"type":"uint256","name":"_withdrawFeeFactor","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"deposit","inputs":[{"type":"address","name":"_userAddress","internalType":"address"},{"type":"uint256","name":"_toshaAmt","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"earn","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"entranceFeeFactor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"entranceFeeFactorLL","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"entranceFeeFactorMax","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"govAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"inCaseTokensGetStuck","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_to","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGov","inputs":[{"type":"address","name":"_govAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setSettings","inputs":[{"type":"uint256","name":"_entranceFeeFactor","internalType":"uint256"},{"type":"uint256","name":"_withdrawFeeFactor","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"sharesTotal","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokenAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokenLockedTotal","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"toshaFarmAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdraw","inputs":[{"type":"address","name":"_userAddress","internalType":"address"},{"type":"uint256","name":"_toshaAmt","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawFeeFactor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawFeeFactorLL","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawFeeFactorMax","inputs":[]}]
              

Contract Creation Code

0x60c0604052600060035560006004556127106005556127106006553480156200002757600080fd5b506040516200272e3803806200272e83398181016040528101906200004d91906200037a565b6200006d620000616200015860201b60201c565b6200016060201b60201c565b600180819055506000600260006101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff1660601b815250508173ffffffffffffffffffffffffffffffffffffffff1660a08173ffffffffffffffffffffffffffffffffffffffff1660601b8152505080600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200014f826200022460201b60201c565b5050506200051d565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b620002346200015860201b60201c565b73ffffffffffffffffffffffffffffffffffffffff166200025a6200033a60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1614620002b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620002aa906200049c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141562000326576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200031d906200047a565b60405180910390fd5b62000337816200016060201b60201c565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600081519050620003748162000503565b92915050565b6000806000606084860312156200039057600080fd5b6000620003a08682870162000363565b9350506020620003b38682870162000363565b9250506040620003c68682870162000363565b9150509250925092565b6000620003df602683620004be565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600062000447602083620004be565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b600060208201905081810360008301526200049581620003d0565b9050919050565b60006020820190508181036000830152620004b78162000438565b9050919050565b600082825260208201905092915050565b6000620004dc82620004e3565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6200050e81620004cf565b81146200051a57600080fd5b50565b60805160601c60a05160601c6121c26200056c60003960008181610a3c0152610ef10152600081816106e30152818161089001528181610a1201528181610e0c0152610f1301526121c26000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c8063715018a6116100b8578063cd0ee9381161007c578063cd0ee938146102f8578063cfad57a214610316578063d389800f14610332578063ee50dc341461033c578063f2fde38b1461035a578063f3fef3a31461037657610137565b8063715018a614610276578063866b2018146102805780638da5cb5b1461029e5780639d76ea58146102bc578063c302a4d0146102da57610137565b80635c975abb116100ff5780635c975abb146101e257806367057b6c1461020057806367206d401461021e57806368f541621461023a5780636a6991451461025857610137565b80631334903f1461013c57806337a289791461015a57806344a3955e1461017657806346008a071461019457806347e7ef24146101b2575b600080fd5b6101446103a6565b6040516101519190611ed2565b60405180910390f35b610174600480360381019061016f919061171e565b6103ac565b005b61017e61059b565b60405161018b9190611ed2565b60405180910390f35b61019c6105a1565b6040516101a99190611c3a565b60405180910390f35b6101cc60048036038101906101c79190611641565b6105c7565b6040516101d99190611ed2565b60405180910390f35b6101ea6107e1565b6040516101f79190611cb5565b60405180910390f35b6102086107f8565b6040516102159190611ed2565b60405180910390f35b6102386004803603810190610233919061167d565b6107fe565b005b61024261094d565b60405161024f9190611ed2565b60405180910390f35b610260610953565b60405161026d9190611ed2565b60405180910390f35b61027e610959565b005b6102886109e1565b6040516102959190611ed2565b60405180910390f35b6102a66109e7565b6040516102b39190611c3a565b60405180910390f35b6102c4610a10565b6040516102d19190611c3a565b60405180910390f35b6102e2610a34565b6040516102ef9190611ed2565b60405180910390f35b610300610a3a565b60405161030d9190611c3a565b60405180910390f35b610330600480360381019061032b9190611618565b610a5e565b005b61033a610b69565b005b610344610b6b565b6040516103519190611ed2565b60405180910390f35b610374600480360381019061036f9190611618565b610b71565b005b610390600480360381019061038b9190611641565b610c69565b60405161039d9190611ed2565b60405180910390f35b60055481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043390611db2565b60405180910390fd5b6126de821015610481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047890611d12565b60405180910390fd5b6127108211156104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bd90611dd2565b60405180910390fd5b816005819055506126de811015610512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050990611d52565b60405180910390fd5b612710811115610557576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054e90611d32565b60405180910390fd5b806006819055507f94d8ba43827a4e0b84c01fd479bb4aa4e97c9c4118f7b8d89262d0acf71226e9828260405161058f929190611eed565b60405180910390a15050565b60045481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006105d1610f69565b73ffffffffffffffffffffffffffffffffffffffff166105ef6109e7565b73ffffffffffffffffffffffffffffffffffffffff1614610645576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063c90611e32565b60405180910390fd5b6002600154141561068b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068290611eb2565b60405180910390fd5b600260018190555061069b6107e1565b156106db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d290611df2565b60405180910390fd5b6107283330847f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16610f71909392919063ffffffff16565b6000829050600060035411801561074157506000600454115b1561079a5761079761271061078960035461077b60055461076d6004548a610ffa90919063ffffffff16565b610ffa90919063ffffffff16565b61107590919063ffffffff16565b61107590919063ffffffff16565b90505b6107af816004546110bf90919063ffffffff16565b6004819055506107ca836003546110bf90919063ffffffff16565b600381905550809150506001808190555092915050565b6000600260009054906101000a900460ff16905090565b61271081565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461088e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088590611db2565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561091d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091490611cf2565b60405180910390fd5b61094881838573ffffffffffffffffffffffffffffffffffffffff1661111d9092919063ffffffff16565b505050565b60065481565b60035481565b610961610f69565b73ffffffffffffffffffffffffffffffffffffffff1661097f6109e7565b73ffffffffffffffffffffffffffffffffffffffff16146109d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cc90611e32565b60405180910390fd5b6109df60006111a3565b565b6126de81565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6126de81565b7f000000000000000000000000000000000000000000000000000000000000000081565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610aee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae590611db2565b60405180910390fd5b80600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f91a8c1cc2d4a3bb60738481947a00cbb9899c822916694cf8bb1d68172fdcd5481604051610b5e9190611c3a565b60405180910390a150565b565b61271081565b610b79610f69565b73ffffffffffffffffffffffffffffffffffffffff16610b976109e7565b73ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490611e32565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490611d72565b60405180910390fd5b610c66816111a3565b50565b6000610c73610f69565b73ffffffffffffffffffffffffffffffffffffffff16610c916109e7565b73ffffffffffffffffffffffffffffffffffffffff1614610ce7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cde90611e32565b60405180910390fd5b60026001541415610d2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2490611eb2565b60405180910390fd5b600260018190555060008211610d78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6f90611e52565b60405180910390fd5b6000610da3600354610d9560045486610ffa90919063ffffffff16565b61107590919063ffffffff16565b9050600454811115610db55760045490505b610dca8160045461126790919063ffffffff16565b6004819055506127106006541015610e0857610e05612710610df760065486610ffa90919063ffffffff16565b61107590919063ffffffff16565b92505b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610e639190611c3a565b60206040518083038186803b158015610e7b57600080fd5b505afa158015610e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb391906116f5565b905080841115610ec1578093505b836003541015610ed15760035493505b610ee68460035461126790919063ffffffff16565b600381905550610f577f0000000000000000000000000000000000000000000000000000000000000000857f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1661111d9092919063ffffffff16565b81925050506001808190555092915050565b600033905090565b610ff4846323b872dd60e01b858585604051602401610f9293929190611c55565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112b1565b50505050565b60008083141561100d576000905061106f565b6000828461101b9190611fcf565b905082848261102a9190611f9e565b1461106a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106190611e12565b60405180910390fd5b809150505b92915050565b60006110b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611378565b905092915050565b60008082846110ce9190611f48565b905083811015611113576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110a90611d92565b60405180910390fd5b8091505092915050565b61119e8363a9059cbb60e01b848460405160240161113c929190611c8c565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112b1565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006112a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113db565b905092915050565b6000611313826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661143f9092919063ffffffff16565b9050600081511115611373578080602001905181019061133391906116cc565b611372576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136990611e92565b60405180910390fd5b5b505050565b600080831182906113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b69190611cd0565b60405180910390fd5b50600083856113ce9190611f9e565b9050809150509392505050565b6000838311158290611423576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141a9190611cd0565b60405180910390fd5b50600083856114329190612029565b9050809150509392505050565b606061144e8484600085611457565b90509392505050565b606061146285611579565b6114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890611e72565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114ca9190611c23565b60006040518083038185875af1925050503d8060008114611507576040519150601f19603f3d011682016040523d82523d6000602084013e61150c565b606091505b50915091508115611521578092505050611571565b6000815111156115345780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115689190611cd0565b60405180910390fd5b949350505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91508082141580156115bb57506000801b8214155b92505050919050565b6000813590506115d381612147565b92915050565b6000815190506115e88161215e565b92915050565b6000813590506115fd81612175565b92915050565b60008151905061161281612175565b92915050565b60006020828403121561162a57600080fd5b6000611638848285016115c4565b91505092915050565b6000806040838503121561165457600080fd5b6000611662858286016115c4565b9250506020611673858286016115ee565b9150509250929050565b60008060006060848603121561169257600080fd5b60006116a0868287016115c4565b93505060206116b1868287016115ee565b92505060406116c2868287016115c4565b9150509250925092565b6000602082840312156116de57600080fd5b60006116ec848285016115d9565b91505092915050565b60006020828403121561170757600080fd5b600061171584828501611603565b91505092915050565b6000806040838503121561173157600080fd5b600061173f858286016115ee565b9250506020611750858286016115ee565b9150509250929050565b6117638161205d565b82525050565b6117728161206f565b82525050565b600061178382611f16565b61178d8185611f2c565b935061179d8185602086016120a5565b80840191505092915050565b60006117b482611f21565b6117be8185611f37565b93506117ce8185602086016120a5565b6117d781612136565b840191505092915050565b60006117ef600583611f37565b91507f21736166650000000000000000000000000000000000000000000000000000006000830152602082019050919050565b600061182f601a83611f37565b91507f5f656e7472616e6365466565466163746f7220746f6f206c6f770000000000006000830152602082019050919050565b600061186f601b83611f37565b91507f5f7769746864726177466565466163746f7220746f6f206869676800000000006000830152602082019050919050565b60006118af601a83611f37565b91507f5f7769746864726177466565466163746f7220746f6f206c6f770000000000006000830152602082019050919050565b60006118ef602683611f37565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611955601b83611f37565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000611995600483611f37565b91507f21676f76000000000000000000000000000000000000000000000000000000006000830152602082019050919050565b60006119d5601b83611f37565b91507f5f656e7472616e6365466565466163746f7220746f6f206869676800000000006000830152602082019050919050565b6000611a15601083611f37565b91507f5061757361626c653a20706175736564000000000000000000000000000000006000830152602082019050919050565b6000611a55602183611f37565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611abb602083611f37565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000611afb600e83611f37565b91507f5f746f736861416d74203c3d20300000000000000000000000000000000000006000830152602082019050919050565b6000611b3b601d83611f37565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b6000611b7b602a83611f37565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000611be1601f83611f37565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b611c1d8161209b565b82525050565b6000611c2f8284611778565b915081905092915050565b6000602082019050611c4f600083018461175a565b92915050565b6000606082019050611c6a600083018661175a565b611c77602083018561175a565b611c846040830184611c14565b949350505050565b6000604082019050611ca1600083018561175a565b611cae6020830184611c14565b9392505050565b6000602082019050611cca6000830184611769565b92915050565b60006020820190508181036000830152611cea81846117a9565b905092915050565b60006020820190508181036000830152611d0b816117e2565b9050919050565b60006020820190508181036000830152611d2b81611822565b9050919050565b60006020820190508181036000830152611d4b81611862565b9050919050565b60006020820190508181036000830152611d6b816118a2565b9050919050565b60006020820190508181036000830152611d8b816118e2565b9050919050565b60006020820190508181036000830152611dab81611948565b9050919050565b60006020820190508181036000830152611dcb81611988565b9050919050565b60006020820190508181036000830152611deb816119c8565b9050919050565b60006020820190508181036000830152611e0b81611a08565b9050919050565b60006020820190508181036000830152611e2b81611a48565b9050919050565b60006020820190508181036000830152611e4b81611aae565b9050919050565b60006020820190508181036000830152611e6b81611aee565b9050919050565b60006020820190508181036000830152611e8b81611b2e565b9050919050565b60006020820190508181036000830152611eab81611b6e565b9050919050565b60006020820190508181036000830152611ecb81611bd4565b9050919050565b6000602082019050611ee76000830184611c14565b92915050565b6000604082019050611f026000830185611c14565b611f0f6020830184611c14565b9392505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611f538261209b565b9150611f5e8361209b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611f9357611f926120d8565b5b828201905092915050565b6000611fa98261209b565b9150611fb48361209b565b925082611fc457611fc3612107565b5b828204905092915050565b6000611fda8261209b565b9150611fe58361209b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561201e5761201d6120d8565b5b828202905092915050565b60006120348261209b565b915061203f8361209b565b925082821015612052576120516120d8565b5b828203905092915050565b60006120688261207b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156120c35780820151818401526020810190506120a8565b838111156120d2576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b6121508161205d565b811461215b57600080fd5b50565b6121678161206f565b811461217257600080fd5b50565b61217e8161209b565b811461218957600080fd5b5056fea2646970667358221220fab3669ce1fabceb0796cd8af74b1f4de7b2e604268ce3b44fac68f099dbe6da64736f6c63430008000033000000000000000000000000e1ea3fc4413e143af108973342d76080622e66c40000000000000000000000005a50abc9a7ba04b0e4fe1334f126f41261a4d5f1000000000000000000000000c98b486802918bd5f5eaaf0ca656dec460837505

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063715018a6116100b8578063cd0ee9381161007c578063cd0ee938146102f8578063cfad57a214610316578063d389800f14610332578063ee50dc341461033c578063f2fde38b1461035a578063f3fef3a31461037657610137565b8063715018a614610276578063866b2018146102805780638da5cb5b1461029e5780639d76ea58146102bc578063c302a4d0146102da57610137565b80635c975abb116100ff5780635c975abb146101e257806367057b6c1461020057806367206d401461021e57806368f541621461023a5780636a6991451461025857610137565b80631334903f1461013c57806337a289791461015a57806344a3955e1461017657806346008a071461019457806347e7ef24146101b2575b600080fd5b6101446103a6565b6040516101519190611ed2565b60405180910390f35b610174600480360381019061016f919061171e565b6103ac565b005b61017e61059b565b60405161018b9190611ed2565b60405180910390f35b61019c6105a1565b6040516101a99190611c3a565b60405180910390f35b6101cc60048036038101906101c79190611641565b6105c7565b6040516101d99190611ed2565b60405180910390f35b6101ea6107e1565b6040516101f79190611cb5565b60405180910390f35b6102086107f8565b6040516102159190611ed2565b60405180910390f35b6102386004803603810190610233919061167d565b6107fe565b005b61024261094d565b60405161024f9190611ed2565b60405180910390f35b610260610953565b60405161026d9190611ed2565b60405180910390f35b61027e610959565b005b6102886109e1565b6040516102959190611ed2565b60405180910390f35b6102a66109e7565b6040516102b39190611c3a565b60405180910390f35b6102c4610a10565b6040516102d19190611c3a565b60405180910390f35b6102e2610a34565b6040516102ef9190611ed2565b60405180910390f35b610300610a3a565b60405161030d9190611c3a565b60405180910390f35b610330600480360381019061032b9190611618565b610a5e565b005b61033a610b69565b005b610344610b6b565b6040516103519190611ed2565b60405180910390f35b610374600480360381019061036f9190611618565b610b71565b005b610390600480360381019061038b9190611641565b610c69565b60405161039d9190611ed2565b60405180910390f35b60055481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461043c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161043390611db2565b60405180910390fd5b6126de821015610481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047890611d12565b60405180910390fd5b6127108211156104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bd90611dd2565b60405180910390fd5b816005819055506126de811015610512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050990611d52565b60405180910390fd5b612710811115610557576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054e90611d32565b60405180910390fd5b806006819055507f94d8ba43827a4e0b84c01fd479bb4aa4e97c9c4118f7b8d89262d0acf71226e9828260405161058f929190611eed565b60405180910390a15050565b60045481565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006105d1610f69565b73ffffffffffffffffffffffffffffffffffffffff166105ef6109e7565b73ffffffffffffffffffffffffffffffffffffffff1614610645576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063c90611e32565b60405180910390fd5b6002600154141561068b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068290611eb2565b60405180910390fd5b600260018190555061069b6107e1565b156106db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d290611df2565b60405180910390fd5b6107283330847f000000000000000000000000e1ea3fc4413e143af108973342d76080622e66c473ffffffffffffffffffffffffffffffffffffffff16610f71909392919063ffffffff16565b6000829050600060035411801561074157506000600454115b1561079a5761079761271061078960035461077b60055461076d6004548a610ffa90919063ffffffff16565b610ffa90919063ffffffff16565b61107590919063ffffffff16565b61107590919063ffffffff16565b90505b6107af816004546110bf90919063ffffffff16565b6004819055506107ca836003546110bf90919063ffffffff16565b600381905550809150506001808190555092915050565b6000600260009054906101000a900460ff16905090565b61271081565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461088e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088590611db2565b60405180910390fd5b7f000000000000000000000000e1ea3fc4413e143af108973342d76080622e66c473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561091d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091490611cf2565b60405180910390fd5b61094881838573ffffffffffffffffffffffffffffffffffffffff1661111d9092919063ffffffff16565b505050565b60065481565b60035481565b610961610f69565b73ffffffffffffffffffffffffffffffffffffffff1661097f6109e7565b73ffffffffffffffffffffffffffffffffffffffff16146109d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109cc90611e32565b60405180910390fd5b6109df60006111a3565b565b6126de81565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f000000000000000000000000e1ea3fc4413e143af108973342d76080622e66c481565b6126de81565b7f0000000000000000000000005a50abc9a7ba04b0e4fe1334f126f41261a4d5f181565b600260019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610aee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae590611db2565b60405180910390fd5b80600260016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f91a8c1cc2d4a3bb60738481947a00cbb9899c822916694cf8bb1d68172fdcd5481604051610b5e9190611c3a565b60405180910390a150565b565b61271081565b610b79610f69565b73ffffffffffffffffffffffffffffffffffffffff16610b976109e7565b73ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490611e32565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490611d72565b60405180910390fd5b610c66816111a3565b50565b6000610c73610f69565b73ffffffffffffffffffffffffffffffffffffffff16610c916109e7565b73ffffffffffffffffffffffffffffffffffffffff1614610ce7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cde90611e32565b60405180910390fd5b60026001541415610d2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2490611eb2565b60405180910390fd5b600260018190555060008211610d78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6f90611e52565b60405180910390fd5b6000610da3600354610d9560045486610ffa90919063ffffffff16565b61107590919063ffffffff16565b9050600454811115610db55760045490505b610dca8160045461126790919063ffffffff16565b6004819055506127106006541015610e0857610e05612710610df760065486610ffa90919063ffffffff16565b61107590919063ffffffff16565b92505b60007f000000000000000000000000e1ea3fc4413e143af108973342d76080622e66c473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610e639190611c3a565b60206040518083038186803b158015610e7b57600080fd5b505afa158015610e8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb391906116f5565b905080841115610ec1578093505b836003541015610ed15760035493505b610ee68460035461126790919063ffffffff16565b600381905550610f577f0000000000000000000000005a50abc9a7ba04b0e4fe1334f126f41261a4d5f1857f000000000000000000000000e1ea3fc4413e143af108973342d76080622e66c473ffffffffffffffffffffffffffffffffffffffff1661111d9092919063ffffffff16565b81925050506001808190555092915050565b600033905090565b610ff4846323b872dd60e01b858585604051602401610f9293929190611c55565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112b1565b50505050565b60008083141561100d576000905061106f565b6000828461101b9190611fcf565b905082848261102a9190611f9e565b1461106a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106190611e12565b60405180910390fd5b809150505b92915050565b60006110b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611378565b905092915050565b60008082846110ce9190611f48565b905083811015611113576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110a90611d92565b60405180910390fd5b8091505092915050565b61119e8363a9059cbb60e01b848460405160240161113c929190611c8c565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506112b1565b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006112a983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113db565b905092915050565b6000611313826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661143f9092919063ffffffff16565b9050600081511115611373578080602001905181019061133391906116cc565b611372576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136990611e92565b60405180910390fd5b5b505050565b600080831182906113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b69190611cd0565b60405180910390fd5b50600083856113ce9190611f9e565b9050809150509392505050565b6000838311158290611423576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141a9190611cd0565b60405180910390fd5b50600083856114329190612029565b9050809150509392505050565b606061144e8484600085611457565b90509392505050565b606061146285611579565b6114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890611e72565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516114ca9190611c23565b60006040518083038185875af1925050503d8060008114611507576040519150601f19603f3d011682016040523d82523d6000602084013e61150c565b606091505b50915091508115611521578092505050611571565b6000815111156115345780518082602001fd5b836040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115689190611cd0565b60405180910390fd5b949350505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91508082141580156115bb57506000801b8214155b92505050919050565b6000813590506115d381612147565b92915050565b6000815190506115e88161215e565b92915050565b6000813590506115fd81612175565b92915050565b60008151905061161281612175565b92915050565b60006020828403121561162a57600080fd5b6000611638848285016115c4565b91505092915050565b6000806040838503121561165457600080fd5b6000611662858286016115c4565b9250506020611673858286016115ee565b9150509250929050565b60008060006060848603121561169257600080fd5b60006116a0868287016115c4565b93505060206116b1868287016115ee565b92505060406116c2868287016115c4565b9150509250925092565b6000602082840312156116de57600080fd5b60006116ec848285016115d9565b91505092915050565b60006020828403121561170757600080fd5b600061171584828501611603565b91505092915050565b6000806040838503121561173157600080fd5b600061173f858286016115ee565b9250506020611750858286016115ee565b9150509250929050565b6117638161205d565b82525050565b6117728161206f565b82525050565b600061178382611f16565b61178d8185611f2c565b935061179d8185602086016120a5565b80840191505092915050565b60006117b482611f21565b6117be8185611f37565b93506117ce8185602086016120a5565b6117d781612136565b840191505092915050565b60006117ef600583611f37565b91507f21736166650000000000000000000000000000000000000000000000000000006000830152602082019050919050565b600061182f601a83611f37565b91507f5f656e7472616e6365466565466163746f7220746f6f206c6f770000000000006000830152602082019050919050565b600061186f601b83611f37565b91507f5f7769746864726177466565466163746f7220746f6f206869676800000000006000830152602082019050919050565b60006118af601a83611f37565b91507f5f7769746864726177466565466163746f7220746f6f206c6f770000000000006000830152602082019050919050565b60006118ef602683611f37565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611955601b83611f37565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000611995600483611f37565b91507f21676f76000000000000000000000000000000000000000000000000000000006000830152602082019050919050565b60006119d5601b83611f37565b91507f5f656e7472616e6365466565466163746f7220746f6f206869676800000000006000830152602082019050919050565b6000611a15601083611f37565b91507f5061757361626c653a20706175736564000000000000000000000000000000006000830152602082019050919050565b6000611a55602183611f37565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611abb602083611f37565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000611afb600e83611f37565b91507f5f746f736861416d74203c3d20300000000000000000000000000000000000006000830152602082019050919050565b6000611b3b601d83611f37565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b6000611b7b602a83611f37565b91507f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008301527f6f742073756363656564000000000000000000000000000000000000000000006020830152604082019050919050565b6000611be1601f83611f37565b91507f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006000830152602082019050919050565b611c1d8161209b565b82525050565b6000611c2f8284611778565b915081905092915050565b6000602082019050611c4f600083018461175a565b92915050565b6000606082019050611c6a600083018661175a565b611c77602083018561175a565b611c846040830184611c14565b949350505050565b6000604082019050611ca1600083018561175a565b611cae6020830184611c14565b9392505050565b6000602082019050611cca6000830184611769565b92915050565b60006020820190508181036000830152611cea81846117a9565b905092915050565b60006020820190508181036000830152611d0b816117e2565b9050919050565b60006020820190508181036000830152611d2b81611822565b9050919050565b60006020820190508181036000830152611d4b81611862565b9050919050565b60006020820190508181036000830152611d6b816118a2565b9050919050565b60006020820190508181036000830152611d8b816118e2565b9050919050565b60006020820190508181036000830152611dab81611948565b9050919050565b60006020820190508181036000830152611dcb81611988565b9050919050565b60006020820190508181036000830152611deb816119c8565b9050919050565b60006020820190508181036000830152611e0b81611a08565b9050919050565b60006020820190508181036000830152611e2b81611a48565b9050919050565b60006020820190508181036000830152611e4b81611aae565b9050919050565b60006020820190508181036000830152611e6b81611aee565b9050919050565b60006020820190508181036000830152611e8b81611b2e565b9050919050565b60006020820190508181036000830152611eab81611b6e565b9050919050565b60006020820190508181036000830152611ecb81611bd4565b9050919050565b6000602082019050611ee76000830184611c14565b92915050565b6000604082019050611f026000830185611c14565b611f0f6020830184611c14565b9392505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000611f538261209b565b9150611f5e8361209b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611f9357611f926120d8565b5b828201905092915050565b6000611fa98261209b565b9150611fb48361209b565b925082611fc457611fc3612107565b5b828204905092915050565b6000611fda8261209b565b9150611fe58361209b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561201e5761201d6120d8565b5b828202905092915050565b60006120348261209b565b915061203f8361209b565b925082821015612052576120516120d8565b5b828203905092915050565b60006120688261207b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60005b838110156120c35780820151818401526020810190506120a8565b838111156120d2576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b6121508161205d565b811461215b57600080fd5b50565b6121678161206f565b811461217257600080fd5b50565b61217e8161209b565b811461218957600080fd5b5056fea2646970667358221220fab3669ce1fabceb0796cd8af74b1f4de7b2e604268ce3b44fac68f099dbe6da64736f6c63430008000033