ETH Price: $3,618.41 (+0.49%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MilkStaking

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 9 : MilkStaking.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";

contract MilkStaking is OwnableUpgradeable, ReentrancyGuardUpgradeable, PausableUpgradeable {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    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 RewardsDurationUpdated(uint256 newDuration);
    event RewardsDistributionUpdated(address newDistribution);

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

    struct Stake {
        uint256 amount;
        uint256 stakedAt;
    }

    IERC20Upgradeable public xIXT;
    IERC20Upgradeable public milk;
    uint256 public lockPeriod;
    uint256 public periodFinish;
    uint256 public rewardRate;
    uint256 public rewardsDuration;
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;
    address public rewardsDistribution;

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

    uint256 private milkStaked;
    mapping(address => uint256) private userMilkStaked;
    mapping(address => Stake[]) public userIndividualMilkStakes;

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

    function initialize(
        address _rewardsDistribution,
        address _xIXT,
        address _milk,
        uint256 _rewardsDuration,
        uint256 _lockPeriod
    ) external initializer {
        require(_xIXT != address(0), "rewardToken must not 0x");
        require(_milk != address(0), "milk must not 0x");
        require(_rewardsDistribution != address(0), "rewardDistribution must not 0x");
        require(_rewardsDuration != 0, "rewardsDuration must not 0");

        __Ownable_init();
        __ReentrancyGuard_init();
        __Pausable_init();

        xIXT = IERC20Upgradeable(_xIXT);
        milk = IERC20Upgradeable(_milk);
        rewardsDistribution = _rewardsDistribution;
        rewardsDuration = _rewardsDuration;
        lockPeriod = _lockPeriod;
    }

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

    function stake(uint256 amount) external nonReentrant whenNotPaused {
        require(amount > 0, "Cannot stake 0");

        _updateRewards(msg.sender);
        userMilkStaked[msg.sender] += amount;
        userIndividualMilkStakes[msg.sender].push(Stake({amount: amount, stakedAt: block.timestamp}));

        milkStaked += amount;

        milk.safeTransferFrom(msg.sender, address(this), amount);
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint256 amount) public nonReentrant {
        require(amount > 0, "Cannot withdraw 0");

        _checkEnoughTokensUnlocked(msg.sender, amount);
        _updateRewards(msg.sender);

        milkStaked -= amount;
        userMilkStaked[msg.sender] -= amount;
        milk.safeTransfer(msg.sender, amount);
        emit Withdrawn(msg.sender, amount);
    }

    function getReward() public nonReentrant {
        _updateRewards(msg.sender);
        uint256 reward = rewards[msg.sender];
        if (reward > 0) {
            rewards[msg.sender] = 0;
            xIXT.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

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

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

    function notifyRewardAmount(uint256 reward) external {
        require(msg.sender == rewardsDistribution, "Not rewardsDistribution");
        _updateRewards(address(0));

        xIXT.safeTransferFrom(msg.sender, address(this), reward);
        if (block.timestamp >= periodFinish) {
            rewardRate = reward / rewardsDuration;
        } else {
            uint256 remaining = periodFinish - block.timestamp;
            uint256 leftover = remaining * rewardRate;
            rewardRate = (reward + leftover) / rewardsDuration;
        }

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

    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);
    }

    function setRewardsDistribution(address _rewardsDistribution) external onlyOwner {
        require(_rewardsDistribution != address(0), "rewardDistribution must not 0x");
        rewardsDistribution = _rewardsDistribution;
        emit RewardsDistributionUpdated(_rewardsDistribution);
    }

    function setMilk(IERC20Upgradeable _milk) external onlyOwner {
        milk = _milk;
    }

    function setXIXT(IERC20Upgradeable _xIXT) external onlyOwner {
        xIXT = _xIXT;
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function setLockPeriod(uint256 _lockPeriod) external onlyOwner {
        lockPeriod = _lockPeriod;
    }

    function _updateRewards(address _walletAddress) internal {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();

        if (_walletAddress != address(0)) {
            rewards[_walletAddress] = earned(_walletAddress);
            userRewardPerTokenPaid[_walletAddress] = rewardPerTokenStored;
        }
    }

    function _checkEnoughTokensUnlocked(address _user, uint256 _amount) internal {
        Stake[] memory userStaked = userIndividualMilkStakes[_user];

        uint256 remaining = _amount;
        for (uint256 i; i < userStaked.length; i++) {
            if (block.timestamp > (userStaked[i].stakedAt + lockPeriod)) {
                if (remaining >= userStaked[i].amount) {
                    remaining -= userStaked[i].amount;
                    _removeFromArray(0, userIndividualMilkStakes[_user]);
                } else {
                    userIndividualMilkStakes[_user][i].amount -= remaining;
                    remaining = 0;
                    return;
                }
            }
        }
        require(remaining == 0, "ENERGY STAKING: NOT_ENOUGH_TOKENS_UNLOCKED");
    }

    function _removeFromArray(uint256 _position, Stake[] storage _arr) internal {
        for (uint256 i = _position; i < _arr.length - 1; i++) {
            _arr[i] = _arr[i + 1];
        }
        _arr.pop();
    }

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

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

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

    function lastTimeRewardApplicable() public view returns (uint256) {
        return block.timestamp < periodFinish ? block.timestamp : periodFinish;
    }

    function rewardPerToken() public view returns (uint256) {
        if (milkStaked == 0) {
            return rewardPerTokenStored;
        }
        return rewardPerTokenStored + (((lastTimeRewardApplicable() - lastUpdateTime) * rewardRate * 1e18) / milkStaked);
    }

    function earned(address account) public view returns (uint256) {
        return (userMilkStaked[account] * (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18 + rewards[account];
    }

    function getRewardForDuration() external view returns (uint256) {
        return rewardRate * rewardsDuration;
    }

    function getUserMilkStakes(address _user) external view returns (Stake[] memory) {
        return userIndividualMilkStakes[_user];
    }
}

File 2 of 9 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

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

    function __Ownable_init_unchained() internal initializer {
        _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);
    }
    uint256[49] private __gap;
}

File 3 of 9 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

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

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 4 of 9 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @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.
     */
    function __Pausable_init() internal initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal initializer {
        _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());
    }
    uint256[49] private __gap;
}

File 5 of 9 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal initializer {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal initializer {
        _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;
    }
    uint256[49] private __gap;
}

File 6 of 9 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);
}

File 7 of 9 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

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

    function safeTransferFrom(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

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

File 8 of 9 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

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

        uint256 size;
        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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 9 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newDistribution","type":"address"}],"name":"RewardsDistributionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"RewardsDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserMilkStakes","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakedAt","type":"uint256"}],"internalType":"struct MilkStaking.Stake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"},{"internalType":"address","name":"_xIXT","type":"address"},{"internalType":"address","name":"_milk","type":"address"},{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"},{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"milk","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDistribution","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lockPeriod","type":"uint256"}],"name":"setLockPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"_milk","type":"address"}],"name":"setMilk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"}],"name":"setRewardsDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"}],"name":"setRewardsDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"_xIXT","type":"address"}],"name":"setXIXT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userIndividualMilkStakes","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakedAt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xIXT","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50611e9c806100206000396000f3fe608060405234801561001057600080fd5b506004361061021b5760003560e01c8063715018a611610125578063c8f33c91116100ad578063df136d651161007c578063df136d6514610458578063e68dfeac14610461578063e9fad8ee14610489578063ebe2b12b14610491578063f2fde38b1461049a57600080fd5b8063c8f33c9114610421578063cc1a378f1461042a578063cd3daf9d1461043d578063dbf8b1681461044557600080fd5b80638456cb59116100f45780638456cb59146103c25780638b876347146103ca5780638da5cb5b146103ea578063a694fc3a146103fb578063a6b63eb81461040e57600080fd5b8063715018a614610396578063779972da1461039e5780637b0a47ee146103b157806380faa57d146103ba57600080fd5b80633c6b16ab116101a85780633fd8b02f116101775780633fd8b02f1461031b57806346c124d814610324578063500389df146103445780635c975abb1461035757806370a082311461036d57600080fd5b80633c6b16ab146102e55780633d18b912146102f85780633f4ba83a146103005780633fc6df6e1461030857600080fd5b806319762143116101ef57806319762143146102835780631b88a8cd146102965780631c1f78eb146102c15780632e1a7d4d146102c9578063386a9525146102dc57600080fd5b80628cc262146102205780630700037d14610246578063110a2ded1461026657806318160ddd1461027b575b600080fd5b61023361022e366004611b51565b6104ad565b6040519081526020015b60405180910390f35b610233610254366004611b51565b60d36020526000908152604090205481565b610279610274366004611b51565b61052a565b005b60d454610233565b610279610291366004611b51565b61057f565b60c9546102a9906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b610233610654565b6102796102d7366004611b6e565b61066b565b61023360ce5481565b6102796102f3366004611b6e565b610776565b610279610897565b610279610940565b60d1546102a9906001600160a01b031681565b61023360cb5481565b610337610332366004611b51565b610974565b60405161023d9190611b87565b610279610352366004611b51565b6109fd565b60975460ff16604051901515815260200161023d565b61023361037b366004611b51565b6001600160a01b0316600090815260d5602052604090205490565b610279610a49565b6102796103ac366004611b6e565b610a7d565b61023360cd5481565b610233610aac565b610279610ac3565b6102336103d8366004611b51565b60d26020526000908152604090205481565b6033546001600160a01b03166102a9565b610279610409366004611b6e565b610af5565b61027961041c366004611bd6565b610c76565b61023360cf5481565b610279610438366004611b6e565b610e8b565b610233610f87565b60ca546102a9906001600160a01b031681565b61023360d05481565b61047461046f366004611c31565b610fe8565b6040805192835260208301919091520161023d565b610279611024565b61023360cc5481565b6102796104a8366004611b51565b611045565b6001600160a01b038116600090815260d3602090815260408083205460d2909252822054670de0b6b3a7640000906104e3610f87565b6104ed9190611c73565b6001600160a01b038516600090815260d560205260409020546105109190611c86565b61051a9190611c9d565b6105249190611cbf565b92915050565b6033546001600160a01b0316331461055d5760405162461bcd60e51b815260040161055490611cd2565b60405180910390fd5b60ca80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146105a95760405162461bcd60e51b815260040161055490611cd2565b6001600160a01b0381166105ff5760405162461bcd60e51b815260206004820152601e60248201527f726577617264446973747269627574696f6e206d757374206e6f7420307800006044820152606401610554565b60d180546001600160a01b0319166001600160a01b0383169081179091556040519081527f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b4906020015b60405180910390a150565b600060ce5460cd546106669190611c86565b905090565b60026065540361068d5760405162461bcd60e51b815260040161055490611d07565b6002606555806106d35760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610554565b6106dd33826110e0565b6106e6336112ee565b8060d460008282546106f89190611c73565b909155505033600090815260d560205260408120805483929061071c908490611c73565b909155505060ca54610738906001600160a01b0316338361134a565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a2506001606555565b60d1546001600160a01b031633146107d05760405162461bcd60e51b815260206004820152601760248201527f4e6f742072657761726473446973747269627574696f6e0000000000000000006044820152606401610554565b6107da60006112ee565b60c9546107f2906001600160a01b03163330846113b2565b60cc5442106108105760ce546108089082611c9d565b60cd55610852565b60004260cc546108209190611c73565b9050600060cd54826108329190611c86565b60ce549091506108428285611cbf565b61084c9190611c9d565b60cd5550505b4260cf81905560ce5461086491611cbf565b60cc556040518181527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d90602001610649565b6002606554036108b95760405162461bcd60e51b815260040161055490611d07565b60026065556108c7336112ee565b33600090815260d3602052604090205480156109385733600081815260d3602052604081205560c954610906916001600160a01b03909116908361134a565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001610766565b506001606555565b6033546001600160a01b0316331461096a5760405162461bcd60e51b815260040161055490611cd2565b6109726113ea565b565b6001600160a01b038116600090815260d660209081526040808320805482518185028101850190935280835260609492939192909184015b828210156109f2578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906109ac565b505050509050919050565b6033546001600160a01b03163314610a275760405162461bcd60e51b815260040161055490611cd2565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b03163314610a735760405162461bcd60e51b815260040161055490611cd2565b610972600061147d565b6033546001600160a01b03163314610aa75760405162461bcd60e51b815260040161055490611cd2565b60cb55565b600060cc544210610abe575060cc5490565b504290565b6033546001600160a01b03163314610aed5760405162461bcd60e51b815260040161055490611cd2565b6109726114cf565b600260655403610b175760405162461bcd60e51b815260040161055490611d07565b600260655560975460ff1615610b625760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610554565b60008111610ba35760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610554565b610bac336112ee565b33600090815260d5602052604081208054839290610bcb908490611cbf565b909155505033600090815260d66020908152604080832081518083019092528482524282840190815281546001818101845592865293852092516002909402909201928355905191015560d48054839290610c27908490611cbf565b909155505060ca54610c44906001600160a01b03163330846113b2565b60405181815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610766565b600054610100900460ff1680610c8f575060005460ff16155b610cab5760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff16158015610ccd576000805461ffff19166101011790555b6001600160a01b038516610d235760405162461bcd60e51b815260206004820152601760248201527f726577617264546f6b656e206d757374206e6f742030780000000000000000006044820152606401610554565b6001600160a01b038416610d6c5760405162461bcd60e51b815260206004820152601060248201526f0dad2d8d640daeae6e840dcdee84060f60831b6044820152606401610554565b6001600160a01b038616610dc25760405162461bcd60e51b815260206004820152601e60248201527f726577617264446973747269627574696f6e206d757374206e6f7420307800006044820152606401610554565b82600003610e125760405162461bcd60e51b815260206004820152601a60248201527f726577617264734475726174696f6e206d757374206e6f7420300000000000006044820152606401610554565b610e1a61154a565b610e226115c5565b610e2a611624565b60c980546001600160a01b038088166001600160a01b03199283161790925560ca805487841690831617905560d180549289169290911691909117905560ce83905560cb8290558015610e83576000805461ff00191690555b505050505050565b6033546001600160a01b03163314610eb55760405162461bcd60e51b815260040161055490611cd2565b60cc544211610f525760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a401610554565b60ce8190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d390602001610649565b600060d454600003610f9a575060d05490565b60d45460cd5460cf54610fab610aac565b610fb59190611c73565b610fbf9190611c86565b610fd190670de0b6b3a7640000611c86565b610fdb9190611c9d565b60d0546106669190611cbf565b60d6602052816000526040600020818154811061100457600080fd5b600091825260209091206002909102018054600190910154909250905082565b33600090815260d5602052604090205461103d9061066b565b610972610897565b6033546001600160a01b0316331461106f5760405162461bcd60e51b815260040161055490611cd2565b6001600160a01b0381166110d45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610554565b6110dd8161147d565b50565b6001600160a01b038216600090815260d66020908152604080832080548251818502810185019093528083529192909190849084015b8282101561115c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611116565b505050509050600082905060005b82518110156112865760cb5483828151811061118857611188611d8c565b60200260200101516020015161119e9190611cbf565b421115611274578281815181106111b7576111b7611d8c565b602002602001015160000151821061121b578281815181106111db576111db611d8c565b602002602001015160000151826111f29190611c73565b6001600160a01b038616600090815260d6602052604081209193506112169161168b565b611274565b6001600160a01b038516600090815260d66020526040902080548391908390811061124857611248611d8c565b906000526020600020906002020160000160008282546112689190611c73565b90915550505050505050565b8061127e81611da2565b91505061116a565b5080156112e85760405162461bcd60e51b815260206004820152602a60248201527f454e45524759205354414b494e473a204e4f545f454e4f5547485f544f4b454e60448201526914d7d5539313d0d2d15160b21b6064820152608401610554565b50505050565b6112f6610f87565b60d055611301610aac565b60cf556001600160a01b038116156110dd5761131c816104ad565b6001600160a01b038216600090815260d3602090815260408083209390935560d05460d29091529190205550565b6040516001600160a01b0383166024820152604481018290526113ad90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611741565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526112e89085906323b872dd60e01b90608401611376565b60975460ff166114335760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610554565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60975460ff16156115155760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610554565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114603390565b600054610100900460ff1680611563575060005460ff16155b61157f5760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156115a1576000805461ffff19166101011790555b6115a9611813565b6115b161187d565b80156110dd576000805461ff001916905550565b600054610100900460ff16806115de575060005460ff16155b6115fa5760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff1615801561161c576000805461ffff19166101011790555b6115b16118dd565b600054610100900460ff168061163d575060005460ff16155b6116595760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff1615801561167b576000805461ffff19166101011790555b611683611813565b6115b161194d565b815b815461169b90600190611c73565b81101561170e57816116ae826001611cbf565b815481106116be576116be611d8c565b90600052602060002090600202018282815481106116de576116de611d8c565b6000918252602090912082546002909202019081556001918201549101558061170681611da2565b91505061168d565b508080548061171f5761171f611dbb565b6000828152602081206002600019909301928302018181556001015590555050565b6000611796826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119c29092919063ffffffff16565b8051909150156113ad57808060200190518101906117b49190611dd1565b6113ad5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610554565b600054610100900460ff168061182c575060005460ff16155b6118485760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156115b1576000805461ffff191661010117905580156110dd576000805461ff001916905550565b600054610100900460ff1680611896575060005460ff16155b6118b25760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156118d4576000805461ffff19166101011790555b6115b13361147d565b600054610100900460ff16806118f6575060005460ff16155b6119125760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff16158015611934576000805461ffff19166101011790555b600160655580156110dd576000805461ff001916905550565b600054610100900460ff1680611966575060005460ff16155b6119825760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156119a4576000805461ffff19166101011790555b6097805460ff1916905580156110dd576000805461ff001916905550565b60606119d184846000856119db565b90505b9392505050565b606082471015611a3c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610554565b843b611a8a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610554565b600080866001600160a01b03168587604051611aa69190611e17565b60006040518083038185875af1925050503d8060008114611ae3576040519150601f19603f3d011682016040523d82523d6000602084013e611ae8565b606091505b5091509150611af8828286611b03565b979650505050505050565b60608315611b125750816119d4565b825115611b225782518084602001fd5b8160405162461bcd60e51b81526004016105549190611e33565b6001600160a01b03811681146110dd57600080fd5b600060208284031215611b6357600080fd5b81356119d481611b3c565b600060208284031215611b8057600080fd5b5035919050565b602080825282518282018190526000919060409081850190868401855b82811015611bc957815180518552860151868501529284019290850190600101611ba4565b5091979650505050505050565b600080600080600060a08688031215611bee57600080fd5b8535611bf981611b3c565b94506020860135611c0981611b3c565b93506040860135611c1981611b3c565b94979396509394606081013594506080013592915050565b60008060408385031215611c4457600080fd5b8235611c4f81611b3c565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561052457610524611c5d565b808202811582820484141761052457610524611c5d565b600082611cba57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561052457610524611c5d565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600060018201611db457611db4611c5d565b5060010190565b634e487b7160e01b600052603160045260246000fd5b600060208284031215611de357600080fd5b815180151581146119d457600080fd5b60005b83811015611e0e578181015183820152602001611df6565b50506000910152565b60008251611e29818460208701611df3565b9190910192915050565b6020815260008251806020840152611e52816040850160208701611df3565b601f01601f1916919091016040019291505056fea2646970667358221220a2fc0434dab2e51aebb3413987b1b42f9648e76c6a3c64535c965fb29e22fa8d64736f6c63430008130033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061021b5760003560e01c8063715018a611610125578063c8f33c91116100ad578063df136d651161007c578063df136d6514610458578063e68dfeac14610461578063e9fad8ee14610489578063ebe2b12b14610491578063f2fde38b1461049a57600080fd5b8063c8f33c9114610421578063cc1a378f1461042a578063cd3daf9d1461043d578063dbf8b1681461044557600080fd5b80638456cb59116100f45780638456cb59146103c25780638b876347146103ca5780638da5cb5b146103ea578063a694fc3a146103fb578063a6b63eb81461040e57600080fd5b8063715018a614610396578063779972da1461039e5780637b0a47ee146103b157806380faa57d146103ba57600080fd5b80633c6b16ab116101a85780633fd8b02f116101775780633fd8b02f1461031b57806346c124d814610324578063500389df146103445780635c975abb1461035757806370a082311461036d57600080fd5b80633c6b16ab146102e55780633d18b912146102f85780633f4ba83a146103005780633fc6df6e1461030857600080fd5b806319762143116101ef57806319762143146102835780631b88a8cd146102965780631c1f78eb146102c15780632e1a7d4d146102c9578063386a9525146102dc57600080fd5b80628cc262146102205780630700037d14610246578063110a2ded1461026657806318160ddd1461027b575b600080fd5b61023361022e366004611b51565b6104ad565b6040519081526020015b60405180910390f35b610233610254366004611b51565b60d36020526000908152604090205481565b610279610274366004611b51565b61052a565b005b60d454610233565b610279610291366004611b51565b61057f565b60c9546102a9906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b610233610654565b6102796102d7366004611b6e565b61066b565b61023360ce5481565b6102796102f3366004611b6e565b610776565b610279610897565b610279610940565b60d1546102a9906001600160a01b031681565b61023360cb5481565b610337610332366004611b51565b610974565b60405161023d9190611b87565b610279610352366004611b51565b6109fd565b60975460ff16604051901515815260200161023d565b61023361037b366004611b51565b6001600160a01b0316600090815260d5602052604090205490565b610279610a49565b6102796103ac366004611b6e565b610a7d565b61023360cd5481565b610233610aac565b610279610ac3565b6102336103d8366004611b51565b60d26020526000908152604090205481565b6033546001600160a01b03166102a9565b610279610409366004611b6e565b610af5565b61027961041c366004611bd6565b610c76565b61023360cf5481565b610279610438366004611b6e565b610e8b565b610233610f87565b60ca546102a9906001600160a01b031681565b61023360d05481565b61047461046f366004611c31565b610fe8565b6040805192835260208301919091520161023d565b610279611024565b61023360cc5481565b6102796104a8366004611b51565b611045565b6001600160a01b038116600090815260d3602090815260408083205460d2909252822054670de0b6b3a7640000906104e3610f87565b6104ed9190611c73565b6001600160a01b038516600090815260d560205260409020546105109190611c86565b61051a9190611c9d565b6105249190611cbf565b92915050565b6033546001600160a01b0316331461055d5760405162461bcd60e51b815260040161055490611cd2565b60405180910390fd5b60ca80546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146105a95760405162461bcd60e51b815260040161055490611cd2565b6001600160a01b0381166105ff5760405162461bcd60e51b815260206004820152601e60248201527f726577617264446973747269627574696f6e206d757374206e6f7420307800006044820152606401610554565b60d180546001600160a01b0319166001600160a01b0383169081179091556040519081527f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b4906020015b60405180910390a150565b600060ce5460cd546106669190611c86565b905090565b60026065540361068d5760405162461bcd60e51b815260040161055490611d07565b6002606555806106d35760405162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b6044820152606401610554565b6106dd33826110e0565b6106e6336112ee565b8060d460008282546106f89190611c73565b909155505033600090815260d560205260408120805483929061071c908490611c73565b909155505060ca54610738906001600160a01b0316338361134a565b60405181815233907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906020015b60405180910390a2506001606555565b60d1546001600160a01b031633146107d05760405162461bcd60e51b815260206004820152601760248201527f4e6f742072657761726473446973747269627574696f6e0000000000000000006044820152606401610554565b6107da60006112ee565b60c9546107f2906001600160a01b03163330846113b2565b60cc5442106108105760ce546108089082611c9d565b60cd55610852565b60004260cc546108209190611c73565b9050600060cd54826108329190611c86565b60ce549091506108428285611cbf565b61084c9190611c9d565b60cd5550505b4260cf81905560ce5461086491611cbf565b60cc556040518181527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d90602001610649565b6002606554036108b95760405162461bcd60e51b815260040161055490611d07565b60026065556108c7336112ee565b33600090815260d3602052604090205480156109385733600081815260d3602052604081205560c954610906916001600160a01b03909116908361134a565b60405181815233907fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048690602001610766565b506001606555565b6033546001600160a01b0316331461096a5760405162461bcd60e51b815260040161055490611cd2565b6109726113ea565b565b6001600160a01b038116600090815260d660209081526040808320805482518185028101850190935280835260609492939192909184015b828210156109f2578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906109ac565b505050509050919050565b6033546001600160a01b03163314610a275760405162461bcd60e51b815260040161055490611cd2565b60c980546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b03163314610a735760405162461bcd60e51b815260040161055490611cd2565b610972600061147d565b6033546001600160a01b03163314610aa75760405162461bcd60e51b815260040161055490611cd2565b60cb55565b600060cc544210610abe575060cc5490565b504290565b6033546001600160a01b03163314610aed5760405162461bcd60e51b815260040161055490611cd2565b6109726114cf565b600260655403610b175760405162461bcd60e51b815260040161055490611d07565b600260655560975460ff1615610b625760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610554565b60008111610ba35760405162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b6044820152606401610554565b610bac336112ee565b33600090815260d5602052604081208054839290610bcb908490611cbf565b909155505033600090815260d66020908152604080832081518083019092528482524282840190815281546001818101845592865293852092516002909402909201928355905191015560d48054839290610c27908490611cbf565b909155505060ca54610c44906001600160a01b03163330846113b2565b60405181815233907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90602001610766565b600054610100900460ff1680610c8f575060005460ff16155b610cab5760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff16158015610ccd576000805461ffff19166101011790555b6001600160a01b038516610d235760405162461bcd60e51b815260206004820152601760248201527f726577617264546f6b656e206d757374206e6f742030780000000000000000006044820152606401610554565b6001600160a01b038416610d6c5760405162461bcd60e51b815260206004820152601060248201526f0dad2d8d640daeae6e840dcdee84060f60831b6044820152606401610554565b6001600160a01b038616610dc25760405162461bcd60e51b815260206004820152601e60248201527f726577617264446973747269627574696f6e206d757374206e6f7420307800006044820152606401610554565b82600003610e125760405162461bcd60e51b815260206004820152601a60248201527f726577617264734475726174696f6e206d757374206e6f7420300000000000006044820152606401610554565b610e1a61154a565b610e226115c5565b610e2a611624565b60c980546001600160a01b038088166001600160a01b03199283161790925560ca805487841690831617905560d180549289169290911691909117905560ce83905560cb8290558015610e83576000805461ff00191690555b505050505050565b6033546001600160a01b03163314610eb55760405162461bcd60e51b815260040161055490611cd2565b60cc544211610f525760405162461bcd60e51b815260206004820152605860248201527f50726576696f7573207265776172647320706572696f64206d7573742062652060448201527f636f6d706c657465206265666f7265206368616e67696e67207468652064757260648201527f6174696f6e20666f7220746865206e657720706572696f640000000000000000608482015260a401610554565b60ce8190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d390602001610649565b600060d454600003610f9a575060d05490565b60d45460cd5460cf54610fab610aac565b610fb59190611c73565b610fbf9190611c86565b610fd190670de0b6b3a7640000611c86565b610fdb9190611c9d565b60d0546106669190611cbf565b60d6602052816000526040600020818154811061100457600080fd5b600091825260209091206002909102018054600190910154909250905082565b33600090815260d5602052604090205461103d9061066b565b610972610897565b6033546001600160a01b0316331461106f5760405162461bcd60e51b815260040161055490611cd2565b6001600160a01b0381166110d45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610554565b6110dd8161147d565b50565b6001600160a01b038216600090815260d66020908152604080832080548251818502810185019093528083529192909190849084015b8282101561115c57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611116565b505050509050600082905060005b82518110156112865760cb5483828151811061118857611188611d8c565b60200260200101516020015161119e9190611cbf565b421115611274578281815181106111b7576111b7611d8c565b602002602001015160000151821061121b578281815181106111db576111db611d8c565b602002602001015160000151826111f29190611c73565b6001600160a01b038616600090815260d6602052604081209193506112169161168b565b611274565b6001600160a01b038516600090815260d66020526040902080548391908390811061124857611248611d8c565b906000526020600020906002020160000160008282546112689190611c73565b90915550505050505050565b8061127e81611da2565b91505061116a565b5080156112e85760405162461bcd60e51b815260206004820152602a60248201527f454e45524759205354414b494e473a204e4f545f454e4f5547485f544f4b454e60448201526914d7d5539313d0d2d15160b21b6064820152608401610554565b50505050565b6112f6610f87565b60d055611301610aac565b60cf556001600160a01b038116156110dd5761131c816104ad565b6001600160a01b038216600090815260d3602090815260408083209390935560d05460d29091529190205550565b6040516001600160a01b0383166024820152604481018290526113ad90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611741565b505050565b6040516001600160a01b03808516602483015283166044820152606481018290526112e89085906323b872dd60e01b90608401611376565b60975460ff166114335760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610554565b6097805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60975460ff16156115155760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610554565b6097805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114603390565b600054610100900460ff1680611563575060005460ff16155b61157f5760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156115a1576000805461ffff19166101011790555b6115a9611813565b6115b161187d565b80156110dd576000805461ff001916905550565b600054610100900460ff16806115de575060005460ff16155b6115fa5760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff1615801561161c576000805461ffff19166101011790555b6115b16118dd565b600054610100900460ff168061163d575060005460ff16155b6116595760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff1615801561167b576000805461ffff19166101011790555b611683611813565b6115b161194d565b815b815461169b90600190611c73565b81101561170e57816116ae826001611cbf565b815481106116be576116be611d8c565b90600052602060002090600202018282815481106116de576116de611d8c565b6000918252602090912082546002909202019081556001918201549101558061170681611da2565b91505061168d565b508080548061171f5761171f611dbb565b6000828152602081206002600019909301928302018181556001015590555050565b6000611796826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119c29092919063ffffffff16565b8051909150156113ad57808060200190518101906117b49190611dd1565b6113ad5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610554565b600054610100900460ff168061182c575060005460ff16155b6118485760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156115b1576000805461ffff191661010117905580156110dd576000805461ff001916905550565b600054610100900460ff1680611896575060005460ff16155b6118b25760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156118d4576000805461ffff19166101011790555b6115b13361147d565b600054610100900460ff16806118f6575060005460ff16155b6119125760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff16158015611934576000805461ffff19166101011790555b600160655580156110dd576000805461ff001916905550565b600054610100900460ff1680611966575060005460ff16155b6119825760405162461bcd60e51b815260040161055490611d3e565b600054610100900460ff161580156119a4576000805461ffff19166101011790555b6097805460ff1916905580156110dd576000805461ff001916905550565b60606119d184846000856119db565b90505b9392505050565b606082471015611a3c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610554565b843b611a8a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610554565b600080866001600160a01b03168587604051611aa69190611e17565b60006040518083038185875af1925050503d8060008114611ae3576040519150601f19603f3d011682016040523d82523d6000602084013e611ae8565b606091505b5091509150611af8828286611b03565b979650505050505050565b60608315611b125750816119d4565b825115611b225782518084602001fd5b8160405162461bcd60e51b81526004016105549190611e33565b6001600160a01b03811681146110dd57600080fd5b600060208284031215611b6357600080fd5b81356119d481611b3c565b600060208284031215611b8057600080fd5b5035919050565b602080825282518282018190526000919060409081850190868401855b82811015611bc957815180518552860151868501529284019290850190600101611ba4565b5091979650505050505050565b600080600080600060a08688031215611bee57600080fd5b8535611bf981611b3c565b94506020860135611c0981611b3c565b93506040860135611c1981611b3c565b94979396509394606081013594506080013592915050565b60008060408385031215611c4457600080fd5b8235611c4f81611b3c565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561052457610524611c5d565b808202811582820484141761052457610524611c5d565b600082611cba57634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561052457610524611c5d565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b600060018201611db457611db4611c5d565b5060010190565b634e487b7160e01b600052603160045260246000fd5b600060208284031215611de357600080fd5b815180151581146119d457600080fd5b60005b83811015611e0e578181015183820152602001611df6565b50506000910152565b60008251611e29818460208701611df3565b9190910192915050565b6020815260008251806020840152611e52816040850160208701611df3565b601f01601f1916919091016040019291505056fea2646970667358221220a2fc0434dab2e51aebb3413987b1b42f9648e76c6a3c64535c965fb29e22fa8d64736f6c63430008130033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.