ETH Price: $2,486.37 (+0.24%)

Contract

0xdCfF65e13aeeB5cc250dA25933a5A95b0d16Fe1c
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...200393912024-06-07 10:35:23263 days ago1717756523IN
0xdCfF65e1...b0d16Fe1c
0 ETH0.0005079210.61836158
Set Rewards Dura...200393372024-06-07 10:24:35263 days ago1717755875IN
0xdCfF65e1...b0d16Fe1c
0 ETH0.0003290511.28809818
Set Operator200393332024-06-07 10:23:47263 days ago1717755827IN
0xdCfF65e1...b0d16Fe1c
0 ETH0.0005203911.00011635

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VirtualStakingRewards

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 9 : VirtualStakingRewards.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;

import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "../interfaces/IVirtualStakingRewards.sol";

/**
 * @title VirtualStakingRewards
 * @author Truflation Team
 * @dev A contract for distributing rewards to stakers, fork of Synthetix StakingRewards.
 */
contract VirtualStakingRewards is IVirtualStakingRewards, Ownable2Step {
    using SafeERC20 for IERC20;

    error ZeroAddress();
    error ZeroAmount();
    error Forbidden(address sender);
    error RewardPeriodNotFinished();
    error DurationTooLong();

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

    address public rewardsDistribution;
    address public operator;

    address public immutable rewardsToken;
    uint256 public periodFinish;
    uint256 public rewardRate;
    uint256 public rewardsDuration = 30 days;
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;

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

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

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

    modifier onlyRewardsDistribution() {
        if (msg.sender != rewardsDistribution) {
            revert Forbidden(msg.sender);
        }
        _;
    }

    modifier onlyOperator() {
        if (msg.sender != operator) {
            revert Forbidden(msg.sender);
        }
        _;
    }

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

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

    constructor(address _rewardsDistribution, address _rewardsToken) {
        if (_rewardsToken == address(0) || _rewardsDistribution == address(0)) {
            revert ZeroAddress();
        }
        rewardsToken = _rewardsToken;
        rewardsDistribution = _rewardsDistribution;
    }

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

    /**
     * @dev Get the total supply of staked tokens.
     * @return uint256 The total supply of staked tokens.
     */
    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev Get the balance of the specified account.
     * @param account The address of the account.
     * @return uint256 The balance of the account.
     */
    function balanceOf(address account) external view returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev Get the last time the reward was applicable.
     * @return uint256 The last time the reward was applicable.
     */
    function lastTimeRewardApplicable() public view returns (uint256) {
        return block.timestamp < periodFinish ? block.timestamp : periodFinish;
    }

    /**
     * @dev Get the reward per token.
     * @return uint256 The reward per token.
     */
    function rewardPerToken() public view returns (uint256) {
        if (_totalSupply == 0) {
            return rewardPerTokenStored;
        }
        return
            rewardPerTokenStored + (((lastTimeRewardApplicable() - lastUpdateTime) * rewardRate * 1e18) / _totalSupply);
    }

    /**
     * @dev Get the amount of rewards earned by the specified account.
     * @param account The address of the account.
     * @return uint256 The amount of rewards earned by the account.
     */
    function earned(address account) public view returns (uint256) {
        return (_balances[account] * (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18 + rewards[account];
    }

    /**
     * @dev Get the total reward for the current duration.
     * @return uint256 The total reward for the current duration.
     */
    function getRewardForDuration() external view returns (uint256) {
        return rewardRate * rewardsDuration;
    }

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

    /**
     * @dev Stake a certain amount of tokens.
     * @param user The address of the user to stake for.
     * @param amount The amount of tokens to stake.
     */
    function stake(address user, uint256 amount) external updateReward(user) onlyOperator {
        if (amount == 0) {
            revert ZeroAmount();
        }
        if (user == address(0)) {
            revert ZeroAddress();
        }
        _totalSupply += amount;
        _balances[user] += amount;
        emit Staked(user, amount);
    }

    /**
     * @dev Withdraw a certain amount of staked tokens.
     * @param user The address of the user to withdraw for.
     * @param amount The amount of tokens to withdraw.
     */
    function withdraw(address user, uint256 amount) public updateReward(user) onlyOperator {
        if (amount == 0) {
            revert ZeroAmount();
        }
        _totalSupply -= amount;
        _balances[user] -= amount;
        emit Withdrawn(user, amount);
    }

    /**
     * @dev Get rewards for the caller.
     * @param user The address of the user that owns the rewards.
     * @param to The address of the user to send the rewards to.
     * @return reward The amount of rewards to be claimed.
     */
    function getReward(address user, address to) public updateReward(user) onlyOperator returns (uint256 reward) {
        reward = rewards[user];
        if (reward != 0) {
            rewards[user] = 0;
            IERC20(rewardsToken).safeTransfer(to, reward);
            emit RewardPaid(user, to, reward);
        }
    }

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

    /**
     * @dev Notify the contract about the amount of rewards to be distributed.
     * @param reward The amount of rewards to be distributed.
     */
    function notifyRewardAmount(uint256 reward) external onlyRewardsDistribution updateReward(address(0)) {
        IERC20(rewardsToken).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);
    }

    /**
     * @dev Sets the duration of the rewards distribution.
     * @param _rewardsDuration The duration of the rewards distribution.
     */
    function setRewardsDuration(uint256 _rewardsDuration) external onlyOwner {
        if (block.timestamp <= periodFinish) {
            revert RewardPeriodNotFinished();
        } else if (_rewardsDuration == 0) {
            revert ZeroAmount();
        } else if (_rewardsDuration > 5 * 365 days) {
            revert DurationTooLong();
        }

        rewardsDuration = _rewardsDuration;
        emit RewardsDurationUpdated(_rewardsDuration);
    }

    /**
     * @dev Sets the address of the rewards distributor.
     * @param _rewardsDistribution The address of the rewards distributor.
     */
    function setRewardsDistribution(address _rewardsDistribution) external onlyOwner {
        if (_rewardsDistribution == address(0)) {
            revert ZeroAddress();
        }
        rewardsDistribution = _rewardsDistribution;

        emit RewardsDistributionUpdated(_rewardsDistribution);
    }

    /**
     * @dev Sets the address of the operator.
     * @param _operator The address of the operator.
     */
    function setOperator(address _operator) external onlyOwner {
        if (_operator == address(0)) {
            revert ZeroAddress();
        }
        operator = _operator;

        emit OperatorUpdated(_operator);
    }

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

    event RewardAdded(uint256 reward);
    event Staked(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, address indexed to, uint256 reward);
    event RewardsDurationUpdated(uint256 newDuration);
    event RewardsDistributionUpdated(address indexed rewardsDistribution);
    event OperatorUpdated(address indexed operator);
}

File 2 of 9 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides 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} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

File 3 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 5 of 9 : IVirtualStakingRewards.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;

interface IVirtualStakingRewards {
    // Views

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

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

    function getRewardForDuration() external view returns (uint256);

    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function rewardsDistribution() external view returns (address);

    function rewardsToken() external view returns (address);

    function totalSupply() external view returns (uint256);

    // Mutative

    function getReward(address user, address to) external returns (uint256);

    function stake(address user, uint256 amount) external;

    function withdraw(address user, uint256 amount) external;
}

File 6 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

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

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

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

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

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

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

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

File 7 of 9 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@uniswap/v2-periphery/=lib/uniswap-v2-periphery/contracts/",
    "murky/src/=lib/murky/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"},{"internalType":"address","name":"_rewardsToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DurationTooLong","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"Forbidden","type":"error"},{"inputs":[],"name":"RewardPeriodNotFinished","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"}],"name":"OperatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"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":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"rewardsDistribution","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":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"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":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"getReward","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"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":[],"name":"rewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","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":"address","name":"user","type":"address"},{"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":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405262278d0060065534801561001757600080fd5b506040516113fe3803806113fe8339810160408190526100369161012d565b61003f336100a5565b6001600160a01b038116158061005c57506001600160a01b038216155b1561007a5760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03908116608052600280546001600160a01b03191692909116919091179055610160565b600180546001600160a01b03191690556100be816100c1565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811461012857600080fd5b919050565b6000806040838503121561014057600080fd5b61014983610111565b915061015760208401610111565b90509250929050565b6080516112756101896000396000818161036a0152818161057d015261071c01526112756000f3fe608060405234801561001057600080fd5b50600436106101c35760003560e01c806380faa57d116100f9578063cd3daf9d11610097578063e30c397811610071578063e30c397814610395578063ebe2b12b146103a6578063f2fde38b146103af578063f3fef3a3146103c257600080fd5b8063cd3daf9d1461035d578063d1af0c7d14610365578063df136d651461038c57600080fd5b8063adc9772e116100d3578063adc9772e1461031b578063b3ab15fb1461032e578063c8f33c9114610341578063cc1a378f1461034a57600080fd5b806380faa57d146102e25780638b876347146102ea5780638da5cb5b1461030a57600080fd5b80633fc6df6e1161016657806370a082311161014057806370a08231146102a0578063715018a6146102c957806379ba5097146102d15780637b0a47ee146102d957600080fd5b80633fc6df6e1461024f578063570ca7351461027a5780636b0916951461028d57600080fd5b806319762143116101a257806319762143146102165780631c1f78eb1461022b578063386a9525146102335780633c6b16ab1461023c57600080fd5b80628cc262146101c85780630700037d146101ee57806318160ddd1461020e575b600080fd5b6101db6101d636600461109d565b6103d5565b6040519081526020015b60405180910390f35b6101db6101fc36600461109d565b600a6020526000908152604090205481565b600b546101db565b61022961022436600461109d565b610452565b005b6101db6104cb565b6101db60065481565b61022961024a3660046110bf565b6104e2565b600254610262906001600160a01b031681565b6040516001600160a01b0390911681526020016101e5565b600354610262906001600160a01b031681565b6101db61029b3660046110d8565b610651565b6101db6102ae36600461109d565b6001600160a01b03166000908152600c602052604090205490565b610229610798565b6102296107ac565b6101db60055481565b6101db610826565b6101db6102f836600461109d565b60096020526000908152604090205481565b6000546001600160a01b0316610262565b61022961032936600461110b565b61083d565b61022961033c36600461109d565b610995565b6101db60075481565b6102296103583660046110bf565b610a0e565b6101db610ab9565b6102627f000000000000000000000000000000000000000000000000000000000000000081565b6101db60085481565b6001546001600160a01b0316610262565b6101db60045481565b6102296103bd36600461109d565b610b1a565b6102296103d036600461110b565b610b8b565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054670de0b6b3a76400009061040b610ab9565b610415919061114b565b6001600160a01b0385166000908152600c6020526040902054610438919061115e565b6104429190611175565b61044c9190611197565b92915050565b61045a610cb3565b6001600160a01b0381166104815760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b490600090a250565b60006006546005546104dd919061115e565b905090565b6002546001600160a01b031633146105145760405163a59d7f4d60e01b81523360048201526024015b60405180910390fd5b600061051e610ab9565b600855610529610826565b6007556001600160a01b0381161561057057610544816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6105a56001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085610d0d565b60045442106105c3576006546105bb9083611175565b600555610605565b6000426004546105d3919061114b565b90506000600554826105e5919061115e565b6006549091506105f58286611197565b6105ff9190611175565b60055550505b42600781905560065461061791611197565b6004556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a15050565b60008261065c610ab9565b600855610667610826565b6007556001600160a01b038116156106ae57610682816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6003546001600160a01b031633146106db5760405163a59d7f4d60e01b815233600482015260240161050b565b6001600160a01b0384166000908152600a602052604090205491508115610791576001600160a01b038085166000908152600a6020526040812055610743907f0000000000000000000000000000000000000000000000000000000000000000168484610d7e565b826001600160a01b0316846001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e8460405161078891815260200190565b60405180910390a35b5092915050565b6107a0610cb3565b6107aa6000610db3565b565b60015433906001600160a01b0316811461081a5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840161050b565b61082381610db3565b50565b60006004544210610838575060045490565b504290565b81610846610ab9565b600855610851610826565b6007556001600160a01b038116156108985761086c816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6003546001600160a01b031633146108c55760405163a59d7f4d60e01b815233600482015260240161050b565b816000036108e657604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b03831661090d5760405163d92e233d60e01b815260040160405180910390fd5b81600b600082825461091f9190611197565b90915550506001600160a01b0383166000908152600c60205260408120805484929061094c908490611197565b90915550506040518281526001600160a01b038416907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906020015b60405180910390a2505050565b61099d610cb3565b6001600160a01b0381166109c45760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517fb3b3f5f64ab192e4b5fefde1f51ce9733bbdcf831951543b325aebd49cc27ec490600090a250565b610a16610cb3565b6004544211610a3857604051639634abc160e01b815260040160405180910390fd5b80600003610a5957604051631f2a200560e01b815260040160405180910390fd5b6309660180811115610a7e57604051634a94fa8360e11b815260040160405180910390fd5b60068190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d39060200160405180910390a150565b6000600b54600003610acc575060085490565b600b54600554600754610add610826565b610ae7919061114b565b610af1919061115e565b610b0390670de0b6b3a764000061115e565b610b0d9190611175565b6008546104dd9190611197565b610b22610cb3565b600180546001600160a01b0383166001600160a01b03199091168117909155610b536000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b81610b94610ab9565b600855610b9f610826565b6007556001600160a01b03811615610be657610bba816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6003546001600160a01b03163314610c135760405163a59d7f4d60e01b815233600482015260240161050b565b81600003610c3457604051631f2a200560e01b815260040160405180910390fd5b81600b6000828254610c46919061114b565b90915550506001600160a01b0383166000908152600c602052604081208054849290610c7390849061114b565b90915550506040518281526001600160a01b038416907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d590602001610988565b6000546001600160a01b031633146107aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161050b565b6040516001600160a01b0380851660248301528316604482015260648101829052610d789085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610dcc565b50505050565b6040516001600160a01b038316602482015260448101829052610dae90849063a9059cbb60e01b90606401610d41565b505050565b600180546001600160a01b031916905561082381610ea1565b6000610e21826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610ef19092919063ffffffff16565b9050805160001480610e42575080806020019051810190610e4291906111aa565b610dae5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161050b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610f008484600085610f08565b949350505050565b606082471015610f695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161050b565b600080866001600160a01b03168587604051610f8591906111f0565b60006040518083038185875af1925050503d8060008114610fc2576040519150601f19603f3d011682016040523d82523d6000602084013e610fc7565b606091505b5091509150610fd887838387610fe3565b979650505050505050565b6060831561105257825160000361104b576001600160a01b0385163b61104b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161050b565b5081610f00565b610f0083838151156110675781518083602001fd5b8060405162461bcd60e51b815260040161050b919061120c565b80356001600160a01b038116811461109857600080fd5b919050565b6000602082840312156110af57600080fd5b6110b882611081565b9392505050565b6000602082840312156110d157600080fd5b5035919050565b600080604083850312156110eb57600080fd5b6110f483611081565b915061110260208401611081565b90509250929050565b6000806040838503121561111e57600080fd5b61112783611081565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561044c5761044c611135565b808202811582820484141761044c5761044c611135565b60008261119257634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561044c5761044c611135565b6000602082840312156111bc57600080fd5b815180151581146110b857600080fd5b60005b838110156111e75781810151838201526020016111cf565b50506000910152565b600082516112028184602087016111cc565b9190910192915050565b602081526000825180602084015261122b8160408501602087016111cc565b601f01601f1916919091016040019291505056fea26469706673582212203ac814aefc6ea1f783e96fe5740649e1a99a67e80e934d9be08e471081ac17d664736f6c63430008190033000000000000000000000000ae9946fb686bb2e8c448066a8339d0d204e868a300000000000000000000000038c2a4a7330b22788374b8ff70bba513c8d848ca

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c35760003560e01c806380faa57d116100f9578063cd3daf9d11610097578063e30c397811610071578063e30c397814610395578063ebe2b12b146103a6578063f2fde38b146103af578063f3fef3a3146103c257600080fd5b8063cd3daf9d1461035d578063d1af0c7d14610365578063df136d651461038c57600080fd5b8063adc9772e116100d3578063adc9772e1461031b578063b3ab15fb1461032e578063c8f33c9114610341578063cc1a378f1461034a57600080fd5b806380faa57d146102e25780638b876347146102ea5780638da5cb5b1461030a57600080fd5b80633fc6df6e1161016657806370a082311161014057806370a08231146102a0578063715018a6146102c957806379ba5097146102d15780637b0a47ee146102d957600080fd5b80633fc6df6e1461024f578063570ca7351461027a5780636b0916951461028d57600080fd5b806319762143116101a257806319762143146102165780631c1f78eb1461022b578063386a9525146102335780633c6b16ab1461023c57600080fd5b80628cc262146101c85780630700037d146101ee57806318160ddd1461020e575b600080fd5b6101db6101d636600461109d565b6103d5565b6040519081526020015b60405180910390f35b6101db6101fc36600461109d565b600a6020526000908152604090205481565b600b546101db565b61022961022436600461109d565b610452565b005b6101db6104cb565b6101db60065481565b61022961024a3660046110bf565b6104e2565b600254610262906001600160a01b031681565b6040516001600160a01b0390911681526020016101e5565b600354610262906001600160a01b031681565b6101db61029b3660046110d8565b610651565b6101db6102ae36600461109d565b6001600160a01b03166000908152600c602052604090205490565b610229610798565b6102296107ac565b6101db60055481565b6101db610826565b6101db6102f836600461109d565b60096020526000908152604090205481565b6000546001600160a01b0316610262565b61022961032936600461110b565b61083d565b61022961033c36600461109d565b610995565b6101db60075481565b6102296103583660046110bf565b610a0e565b6101db610ab9565b6102627f00000000000000000000000038c2a4a7330b22788374b8ff70bba513c8d848ca81565b6101db60085481565b6001546001600160a01b0316610262565b6101db60045481565b6102296103bd36600461109d565b610b1a565b6102296103d036600461110b565b610b8b565b6001600160a01b0381166000908152600a60209081526040808320546009909252822054670de0b6b3a76400009061040b610ab9565b610415919061114b565b6001600160a01b0385166000908152600c6020526040902054610438919061115e565b6104429190611175565b61044c9190611197565b92915050565b61045a610cb3565b6001600160a01b0381166104815760405163d92e233d60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040517f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b490600090a250565b60006006546005546104dd919061115e565b905090565b6002546001600160a01b031633146105145760405163a59d7f4d60e01b81523360048201526024015b60405180910390fd5b600061051e610ab9565b600855610529610826565b6007556001600160a01b0381161561057057610544816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6105a56001600160a01b037f00000000000000000000000038c2a4a7330b22788374b8ff70bba513c8d848ca16333085610d0d565b60045442106105c3576006546105bb9083611175565b600555610605565b6000426004546105d3919061114b565b90506000600554826105e5919061115e565b6006549091506105f58286611197565b6105ff9190611175565b60055550505b42600781905560065461061791611197565b6004556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a15050565b60008261065c610ab9565b600855610667610826565b6007556001600160a01b038116156106ae57610682816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6003546001600160a01b031633146106db5760405163a59d7f4d60e01b815233600482015260240161050b565b6001600160a01b0384166000908152600a602052604090205491508115610791576001600160a01b038085166000908152600a6020526040812055610743907f00000000000000000000000038c2a4a7330b22788374b8ff70bba513c8d848ca168484610d7e565b826001600160a01b0316846001600160a01b03167f540798df468d7b23d11f156fdb954cb19ad414d150722a7b6d55ba369dea792e8460405161078891815260200190565b60405180910390a35b5092915050565b6107a0610cb3565b6107aa6000610db3565b565b60015433906001600160a01b0316811461081a5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b606482015260840161050b565b61082381610db3565b50565b60006004544210610838575060045490565b504290565b81610846610ab9565b600855610851610826565b6007556001600160a01b038116156108985761086c816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6003546001600160a01b031633146108c55760405163a59d7f4d60e01b815233600482015260240161050b565b816000036108e657604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b03831661090d5760405163d92e233d60e01b815260040160405180910390fd5b81600b600082825461091f9190611197565b90915550506001600160a01b0383166000908152600c60205260408120805484929061094c908490611197565b90915550506040518281526001600160a01b038416907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d906020015b60405180910390a2505050565b61099d610cb3565b6001600160a01b0381166109c45760405163d92e233d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517fb3b3f5f64ab192e4b5fefde1f51ce9733bbdcf831951543b325aebd49cc27ec490600090a250565b610a16610cb3565b6004544211610a3857604051639634abc160e01b815260040160405180910390fd5b80600003610a5957604051631f2a200560e01b815260040160405180910390fd5b6309660180811115610a7e57604051634a94fa8360e11b815260040160405180910390fd5b60068190556040518181527ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d39060200160405180910390a150565b6000600b54600003610acc575060085490565b600b54600554600754610add610826565b610ae7919061114b565b610af1919061115e565b610b0390670de0b6b3a764000061115e565b610b0d9190611175565b6008546104dd9190611197565b610b22610cb3565b600180546001600160a01b0383166001600160a01b03199091168117909155610b536000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b81610b94610ab9565b600855610b9f610826565b6007556001600160a01b03811615610be657610bba816103d5565b6001600160a01b0382166000908152600a60209081526040808320939093556008546009909152919020555b6003546001600160a01b03163314610c135760405163a59d7f4d60e01b815233600482015260240161050b565b81600003610c3457604051631f2a200560e01b815260040160405180910390fd5b81600b6000828254610c46919061114b565b90915550506001600160a01b0383166000908152600c602052604081208054849290610c7390849061114b565b90915550506040518281526001600160a01b038416907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d590602001610988565b6000546001600160a01b031633146107aa5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161050b565b6040516001600160a01b0380851660248301528316604482015260648101829052610d789085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610dcc565b50505050565b6040516001600160a01b038316602482015260448101829052610dae90849063a9059cbb60e01b90606401610d41565b505050565b600180546001600160a01b031916905561082381610ea1565b6000610e21826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610ef19092919063ffffffff16565b9050805160001480610e42575080806020019051810190610e4291906111aa565b610dae5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161050b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060610f008484600085610f08565b949350505050565b606082471015610f695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161050b565b600080866001600160a01b03168587604051610f8591906111f0565b60006040518083038185875af1925050503d8060008114610fc2576040519150601f19603f3d011682016040523d82523d6000602084013e610fc7565b606091505b5091509150610fd887838387610fe3565b979650505050505050565b6060831561105257825160000361104b576001600160a01b0385163b61104b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161050b565b5081610f00565b610f0083838151156110675781518083602001fd5b8060405162461bcd60e51b815260040161050b919061120c565b80356001600160a01b038116811461109857600080fd5b919050565b6000602082840312156110af57600080fd5b6110b882611081565b9392505050565b6000602082840312156110d157600080fd5b5035919050565b600080604083850312156110eb57600080fd5b6110f483611081565b915061110260208401611081565b90509250929050565b6000806040838503121561111e57600080fd5b61112783611081565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561044c5761044c611135565b808202811582820484141761044c5761044c611135565b60008261119257634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561044c5761044c611135565b6000602082840312156111bc57600080fd5b815180151581146110b857600080fd5b60005b838110156111e75781810151838201526020016111cf565b50506000910152565b600082516112028184602087016111cc565b9190910192915050565b602081526000825180602084015261122b8160408501602087016111cc565b601f01601f1916919091016040019291505056fea26469706673582212203ac814aefc6ea1f783e96fe5740649e1a99a67e80e934d9be08e471081ac17d664736f6c63430008190033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000ae9946fb686bb2e8c448066a8339d0d204e868a300000000000000000000000038c2a4a7330b22788374b8ff70bba513c8d848ca

-----Decoded View---------------
Arg [0] : _rewardsDistribution (address): 0xAE9946fB686BB2E8c448066a8339D0d204e868A3
Arg [1] : _rewardsToken (address): 0x38C2a4a7330b22788374B8Ff70BBa513C8D848cA

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ae9946fb686bb2e8c448066a8339d0d204e868a3
Arg [1] : 00000000000000000000000038c2a4a7330b22788374b8ff70bba513c8d848ca


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
[ Download: CSV Export  ]

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.