Address Details
contract

0xb030882BfC44e223FD5e20d8645C961BE9b30BB3

Contract Name
MoolaStakingRewards
Creator
0x0b4832–2d931a at 0x3ef68f–3c7eb1
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
4 Transactions
Transfers
134,643 Transfers
Gas Used
823,974
Last Balance Update
24266524
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
MoolaStakingRewards




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
999999
EVM Version
istanbul




Verified at
2021-09-03T11:37:45.078949Z

Contract source code

// SPDX-License-Identifier: MIT
// solhint-disable not-rely-on-time

pragma solidity ^0.8.3;

import "./ubeswap-farming/openzeppelin-solidity/contracts/Math.sol";
import "./ubeswap-farming/openzeppelin-solidity/contracts/SafeMath.sol";
import "./ubeswap-farming/openzeppelin-solidity/contracts/SafeERC20.sol";
import "./ubeswap-farming/openzeppelin-solidity/contracts/ReentrancyGuard.sol";

// Inheritance
import "./ubeswap-farming/synthetix/contracts/interfaces/IStakingRewards.sol";
import "./IMoolaStakingRewards.sol";
import "./ubeswap-farming/synthetix/contracts/RewardsDistributionRecipient.sol";

contract MoolaStakingRewards is IMoolaStakingRewards, RewardsDistributionRecipient, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

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

    IERC20 public immutable rewardsToken;
    IERC20 public immutable stakingToken;
    IERC20[] public externalRewardsTokens;
    uint256 public periodFinish = 0;
    uint256 public rewardRate = 0;
    uint256 public rewardsDuration = 7 days;
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;

    mapping(address => uint256) public userRewardPerTokenPaid;
    mapping(address => uint256) public rewards;
    mapping(address => mapping(IERC20 => uint256)) public externalRewards;

    mapping(IERC20 => uint256) private externalRewardPerTokenStoredWad;
    mapping(address => mapping(IERC20 => uint256)) private externalUserRewardPerTokenPaidWad;

    uint256 private _totalSupply;
    mapping(address => uint256) private _balances;

    IStakingRewards public immutable externalStakingRewards;
    /* ========== CONSTRUCTOR ========== */

    constructor(
        address _owner,
        address _rewardsDistribution,
        IERC20 _rewardsToken,
        IStakingRewards _externalStakingRewards,
        IERC20[] memory _externalRewardsTokens
    ) Owned(_owner) {
        require(_externalRewardsTokens.length > 0, "Empty externalRewardsTokens");
        rewardsToken = _rewardsToken;
        rewardsDistribution = _rewardsDistribution;
        externalStakingRewards = _externalStakingRewards;
        externalRewardsTokens = _externalRewardsTokens;
        stakingToken = _externalStakingRewards.stakingToken();
    }

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

    function totalSupply() external view override returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) external view override returns (uint256) {
        return _balances[account];
    }

    function lastTimeRewardApplicable() public view override returns (uint256) {
        return Math.min(block.timestamp, periodFinish);
    }

    function rewardPerToken() public view override returns (uint256) {
        if (_totalSupply == 0) {
            return rewardPerTokenStored;
        }
        return
            rewardPerTokenStored.add(
                lastTimeRewardApplicable().sub(lastUpdateTime).mul(rewardRate).mul(1e18).div(_totalSupply)
            );
    }

    function earned(address account) public view override returns (uint256) {
        return _balances[account].mul(rewardPerToken().sub(userRewardPerTokenPaid[account])).div(1e18).add(rewards[account]);
    }

    function earnedExternal(address account) public override returns (uint256[] memory result) {
        IERC20[] memory externalTokens = externalRewardsTokens;
        uint256[] memory externalOldTotalRewards = new uint256[](externalTokens.length);
        result = new uint256[](externalTokens.length);

        for (uint256 i = 0; i < externalTokens.length; i++) {
            externalOldTotalRewards[i] = externalTokens[i].balanceOf(address(this));
        }

        externalStakingRewards.getReward();

        for (uint256 i = 0; i < externalTokens.length; i++) {
            IERC20 externalToken = externalTokens[i];
            uint256 externalTotalRewards = externalToken.balanceOf(address(this));

            uint256 newExternalRewardsAmount = externalTotalRewards.sub(externalOldTotalRewards[i]);
            
            if (_totalSupply > 0) {
                externalRewardPerTokenStoredWad[externalToken] =
                    externalRewardPerTokenStoredWad[externalToken].add(newExternalRewardsAmount.mul(1e18).div(_totalSupply));
            }

            result[i] =
                _balances[account]
                .mul(externalRewardPerTokenStoredWad[externalToken].sub(externalUserRewardPerTokenPaidWad[account][externalToken]))
                .div(1e18).add(externalRewards[account][externalToken]);

            externalUserRewardPerTokenPaidWad[account][externalToken] = externalRewardPerTokenStoredWad[externalToken];
            externalRewards[account][externalToken] = result[i];
        }

        return result;
    }

    function getRewardForDuration() external view override returns (uint256) {
        return rewardRate.mul(rewardsDuration);
    }

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

    // XXX: removed notPaused
    function stake(uint256 amount) external override nonReentrant updateReward(msg.sender) {
        require(amount > 0, "Cannot stake 0");
        _totalSupply = _totalSupply.add(amount);
        _balances[msg.sender] = _balances[msg.sender].add(amount);
        stakingToken.safeTransferFrom(msg.sender, address(this), amount);
        stakingToken.approve(address(externalStakingRewards), amount);
        externalStakingRewards.stake(amount);
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint256 amount) public override nonReentrant updateReward(msg.sender) {
        require(amount > 0, "Cannot withdraw 0");
        _totalSupply = _totalSupply.sub(amount);
        _balances[msg.sender] = _balances[msg.sender].sub(amount);
        externalStakingRewards.withdraw(amount);
        stakingToken.safeTransfer(msg.sender, amount);
        emit Withdrawn(msg.sender, amount);
    }

    function getReward() public override nonReentrant updateReward(msg.sender) {
        uint256 reward = rewards[msg.sender];
        IERC20[] memory externalTokens = externalRewardsTokens;

        if (reward > 0) {
            rewards[msg.sender] = 0;
            rewardsToken.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }

        for (uint256 i = 0; i < externalTokens.length; i++) {
            IERC20 externalToken = externalTokens[i];
            uint256 externalReward = externalRewards[msg.sender][externalToken];
            if (externalReward > 0) {
                externalRewards[msg.sender][externalToken] = 0;
                externalToken.safeTransfer(msg.sender, externalReward);
                emit ExternalRewardPaid(msg.sender, externalReward);
            }
        }
    }

    function exit() external override {
        withdraw(_balances[msg.sender]);
        getReward();
    }

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

    function notifyRewardAmount(uint256 reward) external override onlyRewardsDistribution updateReward(address(0)) {
        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(rewardsDuration);
        } else {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = reward.add(leftover).div(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.
        uint balance = rewardsToken.balanceOf(address(this));
        require(rewardRate <= balance.div(rewardsDuration), "Provided reward too high");

        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(rewardsDuration);
        emit RewardAdded(reward);
    }

    // End rewards emission earlier
    function updatePeriodFinish(uint timestamp) external onlyOwner updateReward(address(0)) {
        require(timestamp > lastUpdateTime, "Invalid new period finish");
        periodFinish = timestamp;
    }

    // Added to support recovering LP Rewards from other systems such as BAL to be distributed to holders
    function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
        require(tokenAddress != address(stakingToken), "Cannot withdraw the staking token");
        IERC20(tokenAddress).safeTransfer(owner, tokenAmount);
        emit Recovered(tokenAddress, tokenAmount);
    }

    function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner {
        require(
            block.timestamp > periodFinish,
            "Previous rewards period must be complete before changing the duration for the new period"
        );
        rewardsDuration = _rewardsDuration;
        emit RewardsDurationUpdated(rewardsDuration);
    }

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

    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();
        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
            earnedExternal(account);
        }
        _;
    }

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

    event RewardAdded(uint256 reward);
    event Staked(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);
    event ExternalRewardPaid(address indexed user, uint256 reward);
    event RewardsDurationUpdated(uint256 newDuration);
    event Recovered(address token, uint256 amount);
}
        

IMoolaStakingRewards.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.4.24;

interface IMoolaStakingRewards {

    // Views

    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function earned(address account) external view returns (uint256);

    function earnedExternal(address account) external returns (uint256[] calldata);

    function getRewardForDuration() external view returns (uint256);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    // Mutative

    function stake(uint256 amount) external;

    function withdraw(uint256 amount) external;

    function getReward() external;

    function exit() external;
}
          

Address.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `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
    );
}
          

Math.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

ReentrancyGuard.sol

// SPDX-License-Identifier: MIT

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

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

        _;

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

SafeERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        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
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}
          

SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            // 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 (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b)
        internal
        pure
        returns (bool, uint256)
    {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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) {
        return a + b;
    }

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

    /**
     * @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) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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 a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards 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).
     *
     * 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

Owned.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;


// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
    address public owner;
    address public nominatedOwner;

    constructor(address _owner) {
        require(_owner != address(0), "Owner address cannot be 0");
        owner = _owner;
        emit OwnerChanged(address(0), _owner);
    }

    function nominateNewOwner(address _owner) external onlyOwner {
        nominatedOwner = _owner;
        emit OwnerNominated(_owner);
    }

    function acceptOwnership() external {
        require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
        emit OwnerChanged(owner, nominatedOwner);
        owner = nominatedOwner;
        nominatedOwner = address(0);
    }

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == owner, "Only the contract owner may perform this action");
    }

    event OwnerNominated(address newOwner);
    event OwnerChanged(address oldOwner, address newOwner);
}
          

RewardsDistributionRecipient.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

// Inheritance
import "./Owned.sol";


// https://docs.synthetix.io/contracts/source/contracts/rewardsdistributionrecipient
abstract contract RewardsDistributionRecipient is Owned {
    address public rewardsDistribution;

    function notifyRewardAmount(uint256 reward) external virtual;

    modifier onlyRewardsDistribution() {
        require(msg.sender == rewardsDistribution, "Caller is not RewardsDistribution contract");
        _;
    }

    function setRewardsDistribution(address _rewardsDistribution) external onlyOwner {
        rewardsDistribution = _rewardsDistribution;
    }
}
          

IStakingRewards.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.4.24;

import "../../../openzeppelin-solidity/contracts/SafeERC20.sol";

// https://docs.synthetix.io/contracts/source/interfaces/istakingrewards
interface IStakingRewards {
    // Views
    function rewardsToken() external view returns(IERC20);

    function stakingToken() external view returns(IERC20);

    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function earned(address account) external view returns (uint256);

    function getRewardForDuration() external view returns (uint256);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    // Mutative

    function stake(uint256 amount) external;

    function withdraw(uint256 amount) external;

    function getReward() external;

    function exit() external;
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_rewardsDistribution","internalType":"address"},{"type":"address","name":"_rewardsToken","internalType":"contract IERC20"},{"type":"address","name":"_externalStakingRewards","internalType":"contract IStakingRewards"},{"type":"address[]","name":"_externalRewardsTokens","internalType":"contract IERC20[]"}]},{"type":"event","name":"ExternalRewardPaid","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnerChanged","inputs":[{"type":"address","name":"oldOwner","internalType":"address","indexed":false},{"type":"address","name":"newOwner","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"OwnerNominated","inputs":[{"type":"address","name":"newOwner","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Recovered","inputs":[{"type":"address","name":"token","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardAdded","inputs":[{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardPaid","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"reward","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RewardsDurationUpdated","inputs":[{"type":"uint256","name":"newDuration","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Staked","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Withdrawn","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"earned","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256[]","name":"result","internalType":"uint256[]"}],"name":"earnedExternal","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"exit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"externalRewards","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"externalRewardsTokens","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IStakingRewards"}],"name":"externalStakingRewards","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"getReward","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRewardForDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastTimeRewardApplicable","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastUpdateTime","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"nominateNewOwner","inputs":[{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"nominatedOwner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"notifyRewardAmount","inputs":[{"type":"uint256","name":"reward","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"periodFinish","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"recoverERC20","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardPerTokenStored","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardRate","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewards","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardsDistribution","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rewardsDuration","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"rewardsToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardsDistribution","inputs":[{"type":"address","name":"_rewardsDistribution","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRewardsDuration","inputs":[{"type":"uint256","name":"_rewardsDuration","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"stakingToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePeriodFinish","inputs":[{"type":"uint256","name":"timestamp","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userRewardPerTokenPaid","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]}]
              

Contract Creation Code

0x60e06040526000600555600060065562093a806007553480156200002257600080fd5b5060405162002bed38038062002bed8339810160408190526200004591620002c0565b846001600160a01b038116620000a25760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b03831690811782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a150600160035580516200014f5760405162461bcd60e51b815260206004820152601b60248201527f456d7074792065787465726e616c52657761726473546f6b656e730000000000604482015260640162000099565b6001600160601b0319606084811b8216608052600280546001600160a01b0388166001600160a01b031990911617905583901b1660c05280516200019b9060049060208401906200022d565b50816001600160a01b03166372f702f36040518163ffffffff1660e01b815260040160206040518083038186803b158015620001d657600080fd5b505afa158015620001eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002119190620003ee565b60601b6001600160601b03191660a05250620004439350505050565b82805482825590600052602060002090810192821562000285579160200282015b828111156200028557825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200024e565b506200029392915062000297565b5090565b5b8082111562000293576000815560010162000298565b8051620002bb816200042a565b919050565b600080600080600060a08688031215620002d8578081fd5b8551620002e5816200042a565b80955050602080870151620002fa816200042a565b60408801519095506200030d816200042a565b606088015190945062000320816200042a565b60808801519093506001600160401b03808211156200033d578384fd5b818901915089601f83011262000351578384fd5b81518181111562000366576200036662000414565b8060051b604051601f19603f830116810181811085821117156200038e576200038e62000414565b604052828152858101935084860182860187018e1015620003ad578788fd5b8795505b83861015620003da57620003c581620002ae565b855260019590950194938601938601620003b1565b508096505050505050509295509295909350565b60006020828403121562000400578081fd5b81516200040d816200042a565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146200044057600080fd5b50565b60805160601c60a05160601c60c05160601c61272b620004c2600039600081816104680152818161091a01528181610efe01528181611c0f0152611cea0152600081816103d501528181610f74015281816118a301528181611b950152611c3e0152600081816104c6015281816111cd01526114b5015261272b6000f3fe608060405234801561001057600080fd5b506004361061020a5760003560e01c806370a082311161012a5780639b8a14ee116100bd578063cd3daf9d1161008c578063df136d6511610071578063df136d65146104e8578063e9fad8ee146104f1578063ebe2b12b146104f957600080fd5b8063cd3daf9d146104b9578063d1af0c7d146104c157600080fd5b80639b8a14ee14610463578063a694fc3a1461048a578063c8f33c911461049d578063cc1a378f146104a657600080fd5b806380faa57d116100f957806380faa57d146104085780638980f11f146104105780638b876347146104235780638da5cb5b1461044357600080fd5b806370a082311461039a57806372f702f3146103d057806379ba5097146103f75780637b0a47ee146103ff57600080fd5b806333bddbc6116101a25780633fc6df6e116101715780633fc6df6e1461031c57806353a47bb71461033c578063556f6e6b1461035c5780636be7bb1f1461036f57600080fd5b806333bddbc6146102c0578063386a9525146102f85780633c6b16ab146103015780633d18b9121461031457600080fd5b806319762143116101de57806319762143146102725780631c1f78eb146102855780631e02cee31461028d5780632e1a7d4d146102ad57600080fd5b80628cc2621461020f5780630700037d146102355780631627540c1461025557806318160ddd1461026a575b600080fd5b61022261021d366004612417565b610502565b6040519081526020015b60405180910390f35b610222610243366004612417565b600b6020526000908152604090205481565b610268610263366004612417565b61059a565b005b600f54610222565b610268610280366004612417565b61061c565b61022261066b565b6102a061029b366004612417565b610689565b60405161022c9190612502565b6102686102bb3660046124b6565b610d1d565b6102d36102ce3660046124b6565b610fdc565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022c565b61022260075481565b61026861030f3660046124b6565b611013565b61026861132c565b6002546102d39073ffffffffffffffffffffffffffffffffffffffff1681565b6001546102d39073ffffffffffffffffffffffffffffffffffffffff1681565b61026861036a3660046124b6565b611647565b61022261037d366004612433565b600c60209081526000928352604080842090915290825290205481565b6102226103a8366004612417565b73ffffffffffffffffffffffffffffffffffffffff1660009081526010602052604090205490565b6102d37f000000000000000000000000000000000000000000000000000000000000000081565b610268611740565b61022260065481565b61022261188b565b61026861041e36600461246b565b611899565b610222610431366004612417565b600a6020526000908152604090205481565b6000546102d39073ffffffffffffffffffffffffffffffffffffffff1681565b6102d37f000000000000000000000000000000000000000000000000000000000000000081565b6102686104983660046124b6565b6119f7565b61022260085481565b6102686104b43660046124b6565b611d8d565b610222611e81565b6102d37f000000000000000000000000000000000000000000000000000000000000000081565b61022260095481565b610268611ecd565b61022260055481565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020908152604080832054600a909252822054610594919061058e90670de0b6b3a7640000906105889061055c90610556611e81565b90611ef0565b73ffffffffffffffffffffffffffffffffffffffff881660009081526010602052604090205490611f03565b90611f0f565b90611f1b565b92915050565b6105a2611f27565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b610624611f27565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000610684600754600654611f0390919063ffffffff16565b905090565b6060600060048054806020026020016040519081016040528092919081815260200182805480156106f057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116106c5575b505050505090506000815167ffffffffffffffff81111561073a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610763578160200160208202803683370190505b509050815167ffffffffffffffff8111156107a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107d0578160200160208202803683370190505b50925060005b825181101561091757828181518110610818577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561088957600080fd5b505afa15801561089d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c191906124ce565b8282815181106108fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101528061090f81612668565b9150506107d6565b507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b5050505060005b8251811015610d155760008382815181106109df577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a082319060240160206040518083038186803b158015610a5557600080fd5b505afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d91906124ce565b90506000610ae4858581518110610acd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015183611ef090919063ffffffff16565b600f5490915015610b5f57600f54610b3890610b0c9061058884670de0b6b3a7640000611f03565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600d602052604090205490611f1b565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600d60205260409020555b73ffffffffffffffffffffffffffffffffffffffff8089166000818152600c6020908152604080832094881680845294825280832054938352600e825280832094835293815283822054600d90915292902054610bfd9261058e91670de0b6b3a76400009161058891610bd191611ef0565b73ffffffffffffffffffffffffffffffffffffffff8e1660009081526010602052604090205490611f03565b878581518110610c36577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181019190915273ffffffffffffffffffffffffffffffffffffffff8085166000818152600d8452604080822054938d168252600e855280822092825291909352909120558651879085908110610cbe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff808b166000908152600c845260408082209790921681529590925293209290925550819050610d0d81612668565b91505061099b565b505050919050565b60026003541415610d8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260035533610d9d611e81565b600955610da861188b565b60085573ffffffffffffffffffffffffffffffffffffffff811615610e1357610dd081610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a90915291902055610e1181610689565b505b60008211610e7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152606401610d86565b600f54610e8a9083611ef0565b600f5533600090815260106020526040902054610ea79083611ef0565b336000908152601060205260409081902091909155517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690632e1a7d4d90602401600060405180830381600087803b158015610f4257600080fd5b505af1158015610f56573d6000803e3d6000fd5b50610f9d92505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690503384611fce565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250506001600355565b60048181548110610fec57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60025473ffffffffffffffffffffffffffffffffffffffff1633146110ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f60448201527f6e20636f6e7472616374000000000000000000000000000000000000000000006064820152608401610d86565b60006110c4611e81565b6009556110cf61188b565b60085573ffffffffffffffffffffffffffffffffffffffff81161561113a576110f781610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a9091529190205561113881610689565b505b600554421061115957600754611151908390611f0f565b60065561119c565b6005546000906111699042611ef0565b9050600061118260065483611f0390919063ffffffff16565b600754909150611196906105888684611f1b565b60065550505b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561122457600080fd5b505afa158015611238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125c91906124ce565b905061127360075482611f0f90919063ffffffff16565b60065411156112de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610d86565b4260088190556007546112f19190611f1b565b6005556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b60026003541415611399576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d86565b6002600355336113a7611e81565b6009556113b261188b565b60085573ffffffffffffffffffffffffffffffffffffffff81161561141d576113da81610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a9091529190205561141b81610689565b505b336000908152600b60209081526040808320546004805483518186028101860190945280845291949390919083018282801561148f57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611464575b50505050509050600082111561152757336000818152600b60205260408120556114f1907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169084611fce565b60405182815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b60005b815181101561163c57600082828151811061156e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602090810291909101810151336000908152600c8352604080822073ffffffffffffffffffffffffffffffffffffffff841683529093529190912054909150801561162757336000818152600c6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871680855292528220919091556115f19183611fce565b60405181815233907fce68cdb84849c4239fa00c1e372fda2ae0f55014178702abf36b26508d8639599060200160405180910390a25b5050808061163490612668565b91505061152a565b505060016003555050565b61164f611f27565b6000611659611e81565b60095561166461188b565b60085573ffffffffffffffffffffffffffffffffffffffff8116156116cf5761168c81610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a909152919020556116cd81610689565b505b600854821161173a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f496e76616c6964206e657720706572696f642066696e697368000000000000006044820152606401610d86565b50600555565b60015473ffffffffffffffffffffffffffffffffffffffff1633146117e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e65727368697000000000000000000000006064820152608401610d86565b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff93841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b6000610684426005546120a7565b6118a1611f27565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561197d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f43616e6e6f7420776974686472617720746865207374616b696e6720746f6b6560448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610d86565b6000546119a49073ffffffffffffffffffffffffffffffffffffffff848116911683611fce565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b60026003541415611a64576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d86565b600260035533611a72611e81565b600955611a7d61188b565b60085573ffffffffffffffffffffffffffffffffffffffff811615611ae857611aa581610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a90915291902055611ae681610689565b505b60008211611b52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f43616e6e6f74207374616b6520300000000000000000000000000000000000006044820152606401610d86565b600f54611b5f9083611f1b565b600f5533600090815260106020526040902054611b7c9083611f1b565b33600081815260106020526040902091909155611bd2907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169030856120bd565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018490527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b390604401602060405180830381600087803b158015611c8257600080fd5b505af1158015611c96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cba9190612496565b506040517fa694fc3a000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063a694fc3a90602401600060405180830381600087803b158015611d4357600080fd5b505af1158015611d57573d6000803e3d6000fd5b50506040518481523392507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9150602001610fcb565b611d95611f27565b6005544211611e4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a401610d86565b60078190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d390602001610611565b6000600f5460001415611e95575060095490565b610684611ec4600f54610588670de0b6b3a7640000611ebe600654611ebe60085461055661188b565b90611f03565b60095490611f1b565b33600090815260106020526040902054611ee690610d1d565b611eee61132c565b565b6000611efc8284612625565b9392505050565b6000611efc82846125e8565b6000611efc82846125af565b6000611efc8284612597565b60005473ffffffffffffffffffffffffffffffffffffffff163314611eee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e00000000000000000000000000000000006064820152608401610d86565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526120a29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612121565b505050565b60008183106120b65781611efc565b5090919050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261211b9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612020565b50505050565b6000612183826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661222d9092919063ffffffff16565b8051909150156120a257808060200190518101906121a19190612496565b6120a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d86565b606061223c8484600085612244565b949350505050565b6060824710156122d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610d86565b843b61233e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d86565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161236791906124e6565b60006040518083038185875af1925050503d80600081146123a4576040519150601f19603f3d011682016040523d82523d6000602084013e6123a9565b606091505b50915091506123b98282866123c4565b979650505050505050565b606083156123d3575081611efc565b8251156123e35782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d869190612546565b600060208284031215612428578081fd5b8135611efc816126d0565b60008060408385031215612445578081fd5b8235612450816126d0565b91506020830135612460816126d0565b809150509250929050565b6000806040838503121561247d578182fd5b8235612488816126d0565b946020939093013593505050565b6000602082840312156124a7578081fd5b81518015158114611efc578182fd5b6000602082840312156124c7578081fd5b5035919050565b6000602082840312156124df578081fd5b5051919050565b600082516124f881846020870161263c565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b8181101561253a5783518352928401929184019160010161251e565b50909695505050505050565b602081526000825180602084015261256581604085016020870161263c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600082198211156125aa576125aa6126a1565b500190565b6000826125e3577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612620576126206126a1565b500290565b600082821015612637576126376126a1565b500390565b60005b8381101561265757818101518382015260200161263f565b8381111561211b5750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561269a5761269a6126a1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146126f257600080fd5b5056fea2646970667358221220d4a12683f7cf8216c762931598c98e8453d1be189e6ba5d4986a94c23108bfdd64736f6c63430008040033000000000000000000000000313bc86d3d6e86ba164b2b451cb0d9cfa7943e5c000000000000000000000000313bc86d3d6e86ba164b2b451cb0d9cfa7943e5c00000000000000000000000017700282592d6917f6a73d0bf8accf4d578c131e000000000000000000000000af13437122cd537c5d8942f17787cbdbd787fe9400000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000be915b9dcf56a3cbe739d9b9c202ca692409ec

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061020a5760003560e01c806370a082311161012a5780639b8a14ee116100bd578063cd3daf9d1161008c578063df136d6511610071578063df136d65146104e8578063e9fad8ee146104f1578063ebe2b12b146104f957600080fd5b8063cd3daf9d146104b9578063d1af0c7d146104c157600080fd5b80639b8a14ee14610463578063a694fc3a1461048a578063c8f33c911461049d578063cc1a378f146104a657600080fd5b806380faa57d116100f957806380faa57d146104085780638980f11f146104105780638b876347146104235780638da5cb5b1461044357600080fd5b806370a082311461039a57806372f702f3146103d057806379ba5097146103f75780637b0a47ee146103ff57600080fd5b806333bddbc6116101a25780633fc6df6e116101715780633fc6df6e1461031c57806353a47bb71461033c578063556f6e6b1461035c5780636be7bb1f1461036f57600080fd5b806333bddbc6146102c0578063386a9525146102f85780633c6b16ab146103015780633d18b9121461031457600080fd5b806319762143116101de57806319762143146102725780631c1f78eb146102855780631e02cee31461028d5780632e1a7d4d146102ad57600080fd5b80628cc2621461020f5780630700037d146102355780631627540c1461025557806318160ddd1461026a575b600080fd5b61022261021d366004612417565b610502565b6040519081526020015b60405180910390f35b610222610243366004612417565b600b6020526000908152604090205481565b610268610263366004612417565b61059a565b005b600f54610222565b610268610280366004612417565b61061c565b61022261066b565b6102a061029b366004612417565b610689565b60405161022c9190612502565b6102686102bb3660046124b6565b610d1d565b6102d36102ce3660046124b6565b610fdc565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022c565b61022260075481565b61026861030f3660046124b6565b611013565b61026861132c565b6002546102d39073ffffffffffffffffffffffffffffffffffffffff1681565b6001546102d39073ffffffffffffffffffffffffffffffffffffffff1681565b61026861036a3660046124b6565b611647565b61022261037d366004612433565b600c60209081526000928352604080842090915290825290205481565b6102226103a8366004612417565b73ffffffffffffffffffffffffffffffffffffffff1660009081526010602052604090205490565b6102d37f00000000000000000000000027616d3dba43f55279726c422daf644bc60128a881565b610268611740565b61022260065481565b61022261188b565b61026861041e36600461246b565b611899565b610222610431366004612417565b600a6020526000908152604090205481565b6000546102d39073ffffffffffffffffffffffffffffffffffffffff1681565b6102d37f000000000000000000000000af13437122cd537c5d8942f17787cbdbd787fe9481565b6102686104983660046124b6565b6119f7565b61022260085481565b6102686104b43660046124b6565b611d8d565b610222611e81565b6102d37f00000000000000000000000017700282592d6917f6a73d0bf8accf4d578c131e81565b61022260095481565b610268611ecd565b61022260055481565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020908152604080832054600a909252822054610594919061058e90670de0b6b3a7640000906105889061055c90610556611e81565b90611ef0565b73ffffffffffffffffffffffffffffffffffffffff881660009081526010602052604090205490611f03565b90611f0f565b90611f1b565b92915050565b6105a2611f27565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce22906020015b60405180910390a150565b610624611f27565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6000610684600754600654611f0390919063ffffffff16565b905090565b6060600060048054806020026020016040519081016040528092919081815260200182805480156106f057602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116106c5575b505050505090506000815167ffffffffffffffff81111561073a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610763578160200160208202803683370190505b509050815167ffffffffffffffff8111156107a7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107d0578160200160208202803683370190505b50925060005b825181101561091757828181518110610818577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff909116906370a082319060240160206040518083038186803b15801561088957600080fd5b505afa15801561089d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c191906124ce565b8282815181106108fa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101528061090f81612668565b9150506107d6565b507f000000000000000000000000af13437122cd537c5d8942f17787cbdbd787fe9473ffffffffffffffffffffffffffffffffffffffff16633d18b9126040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561098057600080fd5b505af1158015610994573d6000803e3d6000fd5b5050505060005b8251811015610d155760008382815181106109df577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915060009073ffffffffffffffffffffffffffffffffffffffff8316906370a082319060240160206040518083038186803b158015610a5557600080fd5b505afa158015610a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8d91906124ce565b90506000610ae4858581518110610acd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015183611ef090919063ffffffff16565b600f5490915015610b5f57600f54610b3890610b0c9061058884670de0b6b3a7640000611f03565b73ffffffffffffffffffffffffffffffffffffffff85166000908152600d602052604090205490611f1b565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600d60205260409020555b73ffffffffffffffffffffffffffffffffffffffff8089166000818152600c6020908152604080832094881680845294825280832054938352600e825280832094835293815283822054600d90915292902054610bfd9261058e91670de0b6b3a76400009161058891610bd191611ef0565b73ffffffffffffffffffffffffffffffffffffffff8e1660009081526010602052604090205490611f03565b878581518110610c36577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181019190915273ffffffffffffffffffffffffffffffffffffffff8085166000818152600d8452604080822054938d168252600e855280822092825291909352909120558651879085908110610cbe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff808b166000908152600c845260408082209790921681529590925293209290925550819050610d0d81612668565b91505061099b565b505050919050565b60026003541415610d8f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b600260035533610d9d611e81565b600955610da861188b565b60085573ffffffffffffffffffffffffffffffffffffffff811615610e1357610dd081610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a90915291902055610e1181610689565b505b60008211610e7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43616e6e6f7420776974686472617720300000000000000000000000000000006044820152606401610d86565b600f54610e8a9083611ef0565b600f5533600090815260106020526040902054610ea79083611ef0565b336000908152601060205260409081902091909155517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000af13437122cd537c5d8942f17787cbdbd787fe941690632e1a7d4d90602401600060405180830381600087803b158015610f4257600080fd5b505af1158015610f56573d6000803e3d6000fd5b50610f9d92505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000027616d3dba43f55279726c422daf644bc60128a81690503384611fce565b60405182815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a250506001600355565b60048181548110610fec57600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60025473ffffffffffffffffffffffffffffffffffffffff1633146110ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f43616c6c6572206973206e6f742052657761726473446973747269627574696f60448201527f6e20636f6e7472616374000000000000000000000000000000000000000000006064820152608401610d86565b60006110c4611e81565b6009556110cf61188b565b60085573ffffffffffffffffffffffffffffffffffffffff81161561113a576110f781610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a9091529190205561113881610689565b505b600554421061115957600754611151908390611f0f565b60065561119c565b6005546000906111699042611ef0565b9050600061118260065483611f0390919063ffffffff16565b600754909150611196906105888684611f1b565b60065550505b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f00000000000000000000000017700282592d6917f6a73d0bf8accf4d578c131e73ffffffffffffffffffffffffffffffffffffffff16906370a082319060240160206040518083038186803b15801561122457600080fd5b505afa158015611238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125c91906124ce565b905061127360075482611f0f90919063ffffffff16565b60065411156112de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f50726f76696465642072657761726420746f6f206869676800000000000000006044820152606401610d86565b4260088190556007546112f19190611f1b565b6005556040518381527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a1505050565b60026003541415611399576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d86565b6002600355336113a7611e81565b6009556113b261188b565b60085573ffffffffffffffffffffffffffffffffffffffff81161561141d576113da81610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a9091529190205561141b81610689565b505b336000908152600b60209081526040808320546004805483518186028101860190945280845291949390919083018282801561148f57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611464575b50505050509050600082111561152757336000818152600b60205260408120556114f1907f00000000000000000000000017700282592d6917f6a73d0bf8accf4d578c131e73ffffffffffffffffffffffffffffffffffffffff169084611fce565b60405182815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869060200160405180910390a25b60005b815181101561163c57600082828151811061156e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602090810291909101810151336000908152600c8352604080822073ffffffffffffffffffffffffffffffffffffffff841683529093529190912054909150801561162757336000818152600c6020908152604080832073ffffffffffffffffffffffffffffffffffffffff871680855292528220919091556115f19183611fce565b60405181815233907fce68cdb84849c4239fa00c1e372fda2ae0f55014178702abf36b26508d8639599060200160405180910390a25b5050808061163490612668565b91505061152a565b505060016003555050565b61164f611f27565b6000611659611e81565b60095561166461188b565b60085573ffffffffffffffffffffffffffffffffffffffff8116156116cf5761168c81610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a909152919020556116cd81610689565b505b600854821161173a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f496e76616c6964206e657720706572696f642066696e697368000000000000006044820152606401610d86565b50600555565b60015473ffffffffffffffffffffffffffffffffffffffff1633146117e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527f2063616e20616363657074206f776e65727368697000000000000000000000006064820152608401610d86565b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff93841681529290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b6000610684426005546120a7565b6118a1611f27565b7f00000000000000000000000027616d3dba43f55279726c422daf644bc60128a873ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561197d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f43616e6e6f7420776974686472617720746865207374616b696e6720746f6b6560448201527f6e000000000000000000000000000000000000000000000000000000000000006064820152608401610d86565b6000546119a49073ffffffffffffffffffffffffffffffffffffffff848116911683611fce565b6040805173ffffffffffffffffffffffffffffffffffffffff84168152602081018390527f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28910160405180910390a15050565b60026003541415611a64576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d86565b600260035533611a72611e81565b600955611a7d61188b565b60085573ffffffffffffffffffffffffffffffffffffffff811615611ae857611aa581610502565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832093909355600954600a90915291902055611ae681610689565b505b60008211611b52576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f43616e6e6f74207374616b6520300000000000000000000000000000000000006044820152606401610d86565b600f54611b5f9083611f1b565b600f5533600090815260106020526040902054611b7c9083611f1b565b33600081815260106020526040902091909155611bd2907f00000000000000000000000027616d3dba43f55279726c422daf644bc60128a873ffffffffffffffffffffffffffffffffffffffff169030856120bd565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000af13437122cd537c5d8942f17787cbdbd787fe9481166004830152602482018490527f00000000000000000000000027616d3dba43f55279726c422daf644bc60128a8169063095ea7b390604401602060405180830381600087803b158015611c8257600080fd5b505af1158015611c96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cba9190612496565b506040517fa694fc3a000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000af13437122cd537c5d8942f17787cbdbd787fe9473ffffffffffffffffffffffffffffffffffffffff169063a694fc3a90602401600060405180830381600087803b158015611d4357600080fd5b505af1158015611d57573d6000803e3d6000fd5b50506040518481523392507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9150602001610fcb565b611d95611f27565b6005544211611e4c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a401610d86565b60078190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d390602001610611565b6000600f5460001415611e95575060095490565b610684611ec4600f54610588670de0b6b3a7640000611ebe600654611ebe60085461055661188b565b90611f03565b60095490611f1b565b33600090815260106020526040902054611ee690610d1d565b611eee61132c565b565b6000611efc8284612625565b9392505050565b6000611efc82846125e8565b6000611efc82846125af565b6000611efc8284612597565b60005473ffffffffffffffffffffffffffffffffffffffff163314611eee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201527f6f726d207468697320616374696f6e00000000000000000000000000000000006064820152608401610d86565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526120a29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612121565b505050565b60008183106120b65781611efc565b5090919050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261211b9085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401612020565b50505050565b6000612183826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661222d9092919063ffffffff16565b8051909150156120a257808060200190518101906121a19190612496565b6120a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d86565b606061223c8484600085612244565b949350505050565b6060824710156122d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610d86565b843b61233e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d86565b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161236791906124e6565b60006040518083038185875af1925050503d80600081146123a4576040519150601f19603f3d011682016040523d82523d6000602084013e6123a9565b606091505b50915091506123b98282866123c4565b979650505050505050565b606083156123d3575081611efc565b8251156123e35782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d869190612546565b600060208284031215612428578081fd5b8135611efc816126d0565b60008060408385031215612445578081fd5b8235612450816126d0565b91506020830135612460816126d0565b809150509250929050565b6000806040838503121561247d578182fd5b8235612488816126d0565b946020939093013593505050565b6000602082840312156124a7578081fd5b81518015158114611efc578182fd5b6000602082840312156124c7578081fd5b5035919050565b6000602082840312156124df578081fd5b5051919050565b600082516124f881846020870161263c565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b8181101561253a5783518352928401929184019160010161251e565b50909695505050505050565b602081526000825180602084015261256581604085016020870161263c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600082198211156125aa576125aa6126a1565b500190565b6000826125e3577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612620576126206126a1565b500290565b600082821015612637576126376126a1565b500390565b60005b8381101561265757818101518382015260200161263f565b8381111561211b5750506000910152565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561269a5761269a6126a1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146126f257600080fd5b5056fea2646970667358221220d4a12683f7cf8216c762931598c98e8453d1be189e6ba5d4986a94c23108bfdd64736f6c63430008040033