ETH Price: $2,651.41 (-0.92%)

Contract

0x0000000000017b2a2a6a336079Abc67f6f48aB9A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Exit208581102024-09-29 18:32:116 hrs ago1727634731IN
0x00000000...f6f48aB9A
0 ETH0.001047519.72301542
Get Reward208561602024-09-29 12:00:5913 hrs ago1727611259IN
0x00000000...f6f48aB9A
0 ETH0.000247725.7
Withdraw208561582024-09-29 12:00:3513 hrs ago1727611235IN
0x00000000...f6f48aB9A
0 ETH0.00045015.34113322
Exit208544532024-09-29 6:17:5918 hrs ago1727590679IN
0x00000000...f6f48aB9A
0 ETH0.000536086.39116767
Get Reward208544372024-09-29 6:14:3518 hrs ago1727590475IN
0x00000000...f6f48aB9A
0 ETH0.000549126.61575272
Exit208415242024-09-27 11:00:352 days ago1727434835IN
0x00000000...f6f48aB9A
0 ETH0.0013351910.99208088
Exit208342932024-09-26 10:48:473 days ago1727347727IN
0x00000000...f6f48aB9A
0 ETH0.0015655512.88848822
Exit208333172024-09-26 7:33:113 days ago1727335991IN
0x00000000...f6f48aB9A
0 ETH0.0027402422.55920857
Stake208233732024-09-24 22:13:595 days ago1727216039IN
0x00000000...f6f48aB9A
0 ETH0.0020492420.47094048
Exit208071112024-09-22 15:47:477 days ago1727020067IN
0x00000000...f6f48aB9A
0 ETH0.0009851811.74529183
Exit208056962024-09-22 11:03:357 days ago1727003015IN
0x00000000...f6f48aB9A
0 ETH0.0012380111.49120117
Exit208031532024-09-22 2:33:237 days ago1726972403IN
0x00000000...f6f48aB9A
0 ETH0.0013529611.13833401
Get Reward207945942024-09-20 21:50:119 days ago1726869011IN
0x00000000...f6f48aB9A
0 ETH0.0009967714.37874818
Exit207944632024-09-20 21:23:599 days ago1726867439IN
0x00000000...f6f48aB9A
0 ETH0.0029140234.7408029
Get Reward207877042024-09-19 22:43:4710 days ago1726785827IN
0x00000000...f6f48aB9A
0 ETH0.000492965.939136
Exit207837502024-09-19 9:29:3510 days ago1726738175IN
0x00000000...f6f48aB9A
0 ETH0.0013893711.43811335
Get Reward207804132024-09-18 22:18:4711 days ago1726697927IN
0x00000000...f6f48aB9A
0 ETH0.000804589.69343183
Exit207755772024-09-18 6:05:2311 days ago1726639523IN
0x00000000...f6f48aB9A
0 ETH0.000516436.1568653
Get Reward207755672024-09-18 6:03:2311 days ago1726639403IN
0x00000000...f6f48aB9A
0 ETH0.000466115.61559382
Exit207725342024-09-17 19:52:3512 days ago1726602755IN
0x00000000...f6f48aB9A
0 ETH0.0017728616.45567148
Exit207698812024-09-17 10:58:2312 days ago1726570703IN
0x00000000...f6f48aB9A
0 ETH0.000293922.41976082
Get Reward207589892024-09-15 22:24:3514 days ago1726439075IN
0x00000000...f6f48aB9A
0 ETH0.000107741.55417484
Exit207562812024-09-15 13:21:4714 days ago1726406507IN
0x00000000...f6f48aB9A
0 ETH0.00028133.35373515
Exit207536392024-09-15 4:31:2314 days ago1726374683IN
0x00000000...f6f48aB9A
0 ETH0.000172371.6
Stake207468502024-09-14 5:45:4715 days ago1726292747IN
0x00000000...f6f48aB9A
0 ETH0.000169991.62044255
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
186378632023-11-24 0:00:35311 days ago1700784035  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingRewards

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 888888 runs

Other Settings:
london EvmVersion
File 1 of 10 : StakingRewards.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.8.20;

import "./StakingRewardsEvents.sol";

/// @title StakingRewards
/// @author Forked from Angle Protocol
/// https://github.com/AngleProtocol/angle-core/blob/main/contracts/staking/StakingRewards.sol
/// @notice The `StakingRewards` contracts allows to stake an ERC20 token to receive as reward another ERC20
/// @dev This contracts is managed by the reward distributor and implements the staking interface
contract StakingRewards is StakingRewardsEvents, IStakingRewards, ReentrancyGuard {
    using SafeERC20 for IERC20;

    /// @notice Checks to see if it is the `rewardsDistribution` calling this contract
    /// @dev There is no Access Control here, because it can be handled cheaply through these modifiers
    modifier onlyRewardsDistribution() {
        require(msg.sender == rewardsDistribution, "1");
        _;
    }

    // ============================ References to contracts ========================

    /// @notice ERC20 token given as reward
    IERC20 public immutable override rewardToken;

    /// @notice ERC20 token used for staking
    IERC20 public immutable stakingToken;

    /// @notice Base of the staked token, it is going to be used in the case of sanTokens
    /// which are not in base 10**18
    uint256 public immutable stakingBase;

    /// @notice Rewards Distribution contract for this staking contract
    address public rewardsDistribution;

    // ============================ Staking parameters =============================

    /// @notice Time at which distribution ends
    uint256 public periodFinish;

    /// @notice Reward per second given to the staking contract, split among the staked tokens
    uint256 public rewardRate;

    /// @notice Duration of the reward distribution
    uint256 public rewardsDuration;

    /// @notice Last time `rewardPerTokenStored` was updated
    uint256 public lastUpdateTime;

    /// @notice Helps to compute the amount earned by someone
    /// Cumulates rewards accumulated for one token since the beginning.
    /// Stored as a uint so it is actually a float times the base of the reward token
    uint256 public rewardPerTokenStored;

    /// @notice Stores for each account the `rewardPerToken`: we do the difference
    /// between the current and the old value to compute what has been earned by an account
    mapping(address => uint256) public userRewardPerTokenPaid;

    /// @notice Stores for each account the accumulated rewards
    mapping(address => uint256) public rewards;

    uint256 private _totalSupply;

    mapping(address => uint256) private _balances;

    // ============================ Constructor ====================================

    /// @notice Initializes the staking contract with a first set of parameters
    /// @param _rewardsDistribution Address owning the rewards token
    /// @param _rewardToken ERC20 token given as reward
    /// @param _stakingToken ERC20 token used for staking
    /// @param _rewardsDuration Duration of the staking contract
    constructor(address _rewardsDistribution, address _rewardToken, address _stakingToken, uint256 _rewardsDuration) {
        require(_stakingToken != address(0) && _rewardToken != address(0) && _rewardsDistribution != address(0), "0");

        // NOTE: These are the only 2 lines we added to the contract forked from Angle.
        require(_stakingToken != _rewardToken, "StakingRewards: staking and reward tokens must be different");
        require(_rewardsDuration != 0, "StakingRewards: rewards duration is 0");

        // We are not checking the compatibility of the reward token between the distributor and this contract here
        // because it is checked by the `RewardsDistributor` when activating the staking contract
        // Parameters
        rewardToken = IERC20(_rewardToken);
        stakingToken = IERC20(_stakingToken);
        rewardsDuration = _rewardsDuration;
        rewardsDistribution = _rewardsDistribution;

        stakingBase = 10 ** IERC20Metadata(_stakingToken).decimals();
    }

    // ============================ Modifiers ======================================

    /// @notice Checks to see if the calling address is the zero address
    /// @param account Address to check
    modifier zeroCheck(address account) {
        require(account != address(0), "0");
        _;
    }

    /// @notice Called frequently to update the staking parameters associated to an address
    /// @param account Address of the account to update
    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();
        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
        }
        _;
    }

    // ============================ View functions =================================

    /// @notice Accesses the total supply
    /// @dev Used instead of having a public variable to respect the ERC20 standard
    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    /// @notice Accesses the number of token staked by an account
    /// @param account Account to query the balance of
    /// @dev Used instead of having a public variable to respect the ERC20 standard
    function balanceOf(address account) external view returns (uint256) {
        return _balances[account];
    }

    /// @notice Queries the last timestamp at which a reward was distributed
    /// @dev Returns the current timestamp if a reward is being distributed and the end of the staking
    /// period if staking is done
    function lastTimeRewardApplicable() public view returns (uint256) {
        return Math.min(block.timestamp, periodFinish);
    }

    /// @notice Used to actualize the `rewardPerTokenStored`
    /// @dev It adds to the reward per token: the time elapsed since the `rewardPerTokenStored` was
    /// last updated multiplied by the `rewardRate` divided by the number of tokens
    function rewardPerToken() public view returns (uint256) {
        if (_totalSupply == 0) {
            return rewardPerTokenStored;
        }
        return
            rewardPerTokenStored +
            (((lastTimeRewardApplicable() - lastUpdateTime) * rewardRate * stakingBase) / _totalSupply);
    }

    /// @notice Returns how much a given account earned rewards
    /// @param account Address for which the request is made
    /// @return How much a given account earned rewards
    /// @dev It adds to the rewards the amount of reward earned since last time that is the difference
    /// in reward per token from now and last time multiplied by the number of tokens staked by the person
    function earned(address account) public view returns (uint256) {
        return
            (_balances[account] * (rewardPerToken() - userRewardPerTokenPaid[account])) /
            stakingBase +
            rewards[account];
    }

    // ======================== Mutative functions forked ==========================

    /// @notice Lets someone stake a given amount of `stakingTokens`
    /// @param amount Amount of ERC20 staking token that the `msg.sender` wants to stake
    function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
        _stake(amount, msg.sender);
    }

    /// @notice Lets a user withdraw a given amount of collateral from the staking contract
    /// @param amount Amount of the ERC20 staking token that the `msg.sender` wants to withdraw
    function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) {
        require(amount > 0, "89");
        _totalSupply = _totalSupply - amount;
        _balances[msg.sender] = _balances[msg.sender] - amount;
        stakingToken.safeTransfer(msg.sender, amount);
        emit Withdrawn(msg.sender, amount);
    }

    /// @notice Triggers a payment of the reward earned to the msg.sender
    function getReward() public nonReentrant updateReward(msg.sender) {
        uint256 reward = rewards[msg.sender];
        if (reward > 0) {
            rewards[msg.sender] = 0;
            rewardToken.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

    /// @notice Exits someone
    /// @dev This function lets the caller withdraw its staking and claim rewards
    // Attention here, there may be reentrancy attacks because of the following call
    // to an external contract done before other things are modified, yet since the `rewardToken`
    // is WETH, this is not an issue. If the `rewardToken` changes to an untrusted contract, this need to be updated.
    function exit() external {
        withdraw(_balances[msg.sender]);
        getReward();
    }

    // ====================== Functions added by Angle Core Team ===================

    /// @notice Allows to stake on behalf of another address
    /// @param amount Amount to stake
    /// @param onBehalf Address to stake onBehalf of
    function stakeOnBehalf(
        uint256 amount,
        address onBehalf
    ) external nonReentrant zeroCheck(onBehalf) updateReward(onBehalf) {
        _stake(amount, onBehalf);
    }

    /// @notice Internal function to stake called by `stake` and `stakeOnBehalf`
    /// @param amount Amount to stake
    /// @param onBehalf Address to stake on behalf of
    /// @dev Before calling this function, it has already been verified whether this address was a zero address or not
    function _stake(uint256 amount, address onBehalf) internal {
        require(amount > 0, "90");
        stakingToken.safeTransferFrom(msg.sender, address(this), amount);
        _totalSupply = _totalSupply + amount;
        _balances[onBehalf] = _balances[onBehalf] + amount;
        emit Staked(onBehalf, amount);
    }

    // ====================== Restricted Functions =================================

    /// @notice Adds rewards to be distributed
    /// @param reward Amount of reward tokens to distribute
    /// @dev This reward will be distributed during `rewardsDuration` set previously
    function notifyRewardAmount(
        uint256 reward
    ) external override onlyRewardsDistribution nonReentrant updateReward(address(0)) {
        if (block.timestamp >= periodFinish) {
            // If no reward is currently being distributed, the new rate is just `reward / duration`
            rewardRate = reward / rewardsDuration;
        } else {
            // Otherwise, cancel the future reward and add the amount left to distribute to reward
            uint256 remaining = periodFinish - block.timestamp;
            uint256 leftover = remaining * rewardRate;
            rewardRate = (reward + leftover) / rewardsDuration;
        }

        // Ensures the provided reward amount is not more than the balance in the contract.
        // This keeps the reward rate in the right range, preventing overflows due to
        // very high values of `rewardRate` in the earned and `rewardsPerToken` functions;
        // Reward + leftover must be less than 2^256 / 10^18 to avoid overflow.
        uint256 balance = rewardToken.balanceOf(address(this));
        require(rewardRate <= balance / rewardsDuration, "91");

        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp + rewardsDuration; // Change the duration
        emit RewardAdded(reward);
    }

    /// @notice Withdraws ERC20 tokens that could accrue on this contract
    /// @param tokenAddress Address of the ERC20 token to withdraw
    /// @param to Address to transfer to
    /// @param amount Amount to transfer
    /// @dev A use case would be to claim tokens if the staked tokens accumulate rewards
    function recoverERC20(address tokenAddress, address to, uint256 amount) external override onlyRewardsDistribution {
        require(tokenAddress != address(stakingToken) && tokenAddress != address(rewardToken), "20");

        IERC20(tokenAddress).safeTransfer(to, amount);
        emit Recovered(tokenAddress, to, amount);
    }

    /// @notice Changes the rewards distributor associated to this contract
    /// @param _rewardsDistribution Address of the new rewards distributor contract
    /// @dev This function was also added by Angle Core Team
    /// @dev A compatibility check of the reward token is already performed in the current `RewardsDistributor` implementation
    /// which has right to call this function
    function setNewRewardsDistribution(address _rewardsDistribution) external override onlyRewardsDistribution {
        rewardsDistribution = _rewardsDistribution;
        emit RewardsDistributionUpdated(_rewardsDistribution);
    }
}

File 2 of 10 : StakingRewardsEvents.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import "./interfaces/IStakingRewards.sol";

/// @title StakingRewardsEvents
/// @notice All the events used in `StakingRewards` contract
contract StakingRewardsEvents {
    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 Recovered(address indexed tokenAddress, address indexed to, uint256 amount);

    event RewardsDistributionUpdated(address indexed _rewardsDistribution);
}

File 3 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 4 of 10 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

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

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

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

File 5 of 10 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 6 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @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.encodeCall(token.approve, (spender, value));

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

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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(token).code.length > 0;
    }
}

File 7 of 10 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 8 of 10 : IStakingRewards.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.7;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/// @title IStakingRewardsFunctions
/// @notice Interface for the staking rewards contract that interact with the `RewardsDistributor` contract
interface IStakingRewardsFunctions {
    function notifyRewardAmount(uint256 reward) external;

    function recoverERC20(address tokenAddress, address to, uint256 tokenAmount) external;

    function setNewRewardsDistribution(address newRewardsDistribution) external;
}

/// @title IStakingRewards
/// @notice Previous interface with additionnal getters for public variables
interface IStakingRewards is IStakingRewardsFunctions {
    function periodFinish() external view returns (uint256);

    function rewardToken() external view returns (IERC20);

    function getReward() external;

    function stake(uint256 amount) external;

    function withdraw(uint256 amount) external;

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

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

    function stakeOnBehalf(uint256 amount, address staker) external;
}

File 9 of 10 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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 10 of 10 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

Settings
{
  "remappings": [
    "@ensdomains/=node_modules/@ensdomains/",
    "@looksrare/=node_modules/@looksrare/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@uniswap/=node_modules/@uniswap/",
    "base64-sol/=node_modules/base64-sol/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/",
    "solmate/=node_modules/solmate/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 888888
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","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":true,"internalType":"address","name":"_rewardsDistribution","type":"address"}],"name":"RewardsDistributionUpdated","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":[{"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":"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":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","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":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"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":"address","name":"_rewardsDistribution","type":"address"}],"name":"setNewRewardsDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"onBehalf","type":"address"}],"name":"stakeOnBehalf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingBase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","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"}]

60e060409080825234620002cd5760808162001a558038038091620000258285620002d2565b833981010312620002cd576200003b816200030c565b906020906200004c8282016200030c565b9060606200005c8683016200030c565b91015160016000908155946001600160a01b039283169390919084151580620002c1575b80620002b5575b156200028d57831680851462000223578115620001d15760805260a08490526004908155600180546001600160a01b03191693909216929092179055845163313ce56760e01b815292918291849182905afa908115620001c757839162000183575b5060ff91501690604d82116200016f5750600a0a60c05251611733908162000322823960805181818161017301528181610334015281816109d901528181610b1c0152610f90015260a0518181816102790152818161082d01528181610d6401528181610ec601526112e5015260c0518181816108e901528181611183015261120f0152f35b634e487b7160e01b81526011600452602490fd5b905081813d8311620001bf575b6200019c8183620002d2565b81010312620001bb575160ff81168103620001bb5760ff9038620000e9565b5080fd5b503d62000190565b84513d85823e3d90fd5b875162461bcd60e51b815260048101879052602560248201527f5374616b696e67526577617264733a2072657761726473206475726174696f6e604482015264020697320360dc1b6064820152608490fd5b875162461bcd60e51b815260048101879052603b60248201527f5374616b696e67526577617264733a207374616b696e6720616e64207265776160448201527f726420746f6b656e73206d75737420626520646966666572656e7400000000006064820152608490fd5b875162461bcd60e51b81526004810187905260016024820152600360fc1b6044820152606490fd5b50838316151562000087565b50838116151562000080565b600080fd5b601f909101601f19168101906001600160401b03821190821017620002f657604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620002cd5756fe6040608081526004908136101561001557600080fd5b600091823560e01c9081628cc2621461101a5781630700037d14610fb85781631171bda914610e5657816318160ddd14610e195781632e1a7d4d14610caa578163386a952514610c6e5781633c6b16ab14610a565781633d18b9121461095f5781633fc6df6e1461090c5781636041c34f146108b357816370a082311461085157816372f702f3146107e25781637b0a47ee146107a557816380faa57d1461076a578163873291bb146106b75781638b87634714610655578163a694fc3a146105cc578163aceccf8f146104cd578163c8f33c9114610490578163cd3daf9d1461044e578163df136d6514610411578163e9fad8ee146101d757508063ebe2b12b1461019b5763f7c618c11461012a57600080fd5b3461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906002549051908152f35b90503461040d57827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d57338352602090600a82528284205461021d6116c2565b610225611153565b6006556102306110a9565b60055533151591826103e9575b811561038d5750610250816009546110be565b600955338552600a835261026781858720546110be565b338652600a84528486205561029d81337f000000000000000000000000000000000000000000000000000000000000000061147b565b83519081527f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5833392a2600184556102d36116c2565b6102db611153565b6006556102e66110a9565b600555610369575b3383526008815281832090815492848461030a575b6001815580f35b7fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486935561035884337f000000000000000000000000000000000000000000000000000000000000000061147b565b519283523392a23880808084610303565b610372336111ba565b338452600882528284205560065460078252828420556102ee565b606490848651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f38390000000000000000000000000000000000000000000000000000000000006044820152fd5b6103f2336111ba565b3387526008855285872055600654600785528587205561023d565b8280fd5b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906006549051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019757602090610489611153565b9051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906005549051908152f35b8391503461019757827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019757610506611086565b9061050f6116c2565b73ffffffffffffffffffffffffffffffffffffffff8216801561056f5793610303939461053a611153565b6006556105456110a9565b600555610551846111ba565b90865260086020528186205560065490600760205285205535611244565b60648260208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600160248201527f30000000000000000000000000000000000000000000000000000000000000006044820152fd5b90503461040d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d57610303916106096116c2565b610611611153565b60065561061c6110a9565b6005553361062e575b50339035611244565b610637336111ba565b33855260086020528185205560065490600760205284205538610625565b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197578060209273ffffffffffffffffffffffffffffffffffffffff6106a761105e565b1681526007845220549051908152f35b83346107675760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610767577fffffffffffffffffffffffff000000000000000000000000000000000000000061071061105e565b6001549073ffffffffffffffffffffffffffffffffffffffff9061073782841633146113d5565b1691829116176001557f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b48280a280f35b80fd5b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906104896110a9565b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906003549051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197578060209273ffffffffffffffffffffffffffffffffffffffff6108a361105e565b168152600a845220549051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019757602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101975760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576109976116c2565b61099f611153565b6006556109aa6110a9565b60055533610a30575b33825260086020528082209082825492836109d1575b506001815580f35b556109fd82337f000000000000000000000000000000000000000000000000000000000000000061147b565b519081527fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048660203392a2388082816109c9565b610a39336111ba565b3383526008602052818320556006546007602052818320556109b3565b8391503461019757602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d5760248135918373ffffffffffffffffffffffffffffffffffffffff610ab4816001541633146113d5565b610abc6116c2565b610ac4611153565b600655610acf6110a9565b600555600254428111610c3b5750610ae883548661110d565b6003555b8751938480927f70a0823100000000000000000000000000000000000000000000000000000000825230868301527f0000000000000000000000000000000000000000000000000000000000000000165afa918215610c31578592610bfe575b50600354610b5c8254809461110d565b10610ba2575093610b937fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d94954260055542611146565b60025551908152a16001815580f35b606490848751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f39310000000000000000000000000000000000000000000000000000000000006044820152fd5b9091508381813d8311610c2a575b610c16818361143a565b81010312610c2657519086610b4c565b8480fd5b503d610c0c565b86513d87823e3d90fd5b610c5e610c58610c4f610c669342906110be565b600354906110fa565b87611146565b84549061110d565b600355610aec565b90503461040d57827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d5760209250549051908152f35b9190503461040d57602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610e1557823592610ce96116c2565b610cf1611153565b600655610cfc6110a9565b60055533610df1575b8315610d965750907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d591610d3b846009546110be565b600955338552600a8252610d5284828720546110be565b338652600a835281862055610d8884337f000000000000000000000000000000000000000000000000000000000000000061147b565b519283523392a26001815580f35b8260649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f38390000000000000000000000000000000000000000000000000000000000006044820152fd5b610dfa336111ba565b33865260088452828620556006546007845282862055610d05565b8380fd5b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906009549051908152f35b90503461040d5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d57610e8f61105e565b610e97611086565b6044359373ffffffffffffffffffffffffffffffffffffffff8093610ec1826001541633146113d5565b1693837f00000000000000000000000000000000000000000000000000000000000000001685141580610f8c575b15610f30575091817ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b64893610f26876020958861147b565b519586521693a380f35b602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f32300000000000000000000000000000000000000000000000000000000000006044820152fd5b50837f000000000000000000000000000000000000000000000000000000000000000016851415610eef565b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197578060209273ffffffffffffffffffffffffffffffffffffffff61100a61105e565b1681526008845220549051908152f35b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101975760209061048961105961105e565b6111ba565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361108157565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361108157565b6002548042106000146110bb57504290565b90565b919082039182116110cb57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818102929181159184041417156110cb57565b8115611117570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b919082018092116110cb57565b60095480156111b3576110bb906111ad600654916111a8611181610c4f6111786110a9565b600554906110be565b7f0000000000000000000000000000000000000000000000000000000000000000906110fa565b61110d565b90611146565b5060065490565b73ffffffffffffffffffffffffffffffffffffffff6110bb911660406000828152600a60205261123461120d838320546112076111f5611153565b878652600760205286862054906110be565b906110fa565b7f00000000000000000000000000000000000000000000000000000000000000009061110d565b9281526008602052205490611146565b908115611377576040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201528260648201526064815260a081019080821067ffffffffffffffff831117611348577f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9261130973ffffffffffffffffffffffffffffffffffffffff926020946040527f00000000000000000000000000000000000000000000000000000000000000006114f0565b61131585600954611146565b600955169283600052600a825261133181604060002054611146565b84600052600a8352604060002055604051908152a2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f39300000000000000000000000000000000000000000000000000000000000006044820152fd5b156113dc57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f31000000000000000000000000000000000000000000000000000000000000006044820152fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761134857604052565b9173ffffffffffffffffffffffffffffffffffffffff604051927fa9059cbb000000000000000000000000000000000000000000000000000000006020850152166024830152604482015260448152608081019181831067ffffffffffffffff841117611348576114ee926040526114f0565b565b73ffffffffffffffffffffffffffffffffffffffff1690600080826020829451910182865af13d15611616573d9067ffffffffffffffff82116115e95790611578916040519161156860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116018461143a565b82523d84602084013e5b84611622565b9081519182151592836115c1575b5050506115905750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126101975760200151908115918215036107675750388080611586565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b61157890606090611572565b90611661575080511561163757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806116b9575b611672575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561166a565b6002600054146116d3576002600055565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fdfea26469706673582212207ad9f67af357b99e5929b1addc74f9195d27c0ccaa470f3daaffddf789d18c5f64736f6c63430008140033000000000000000000000000000000000018658fc319f3eeac9bbd054ded4856000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce40000000000000000000000000000000000000000000000000000000000093a80

Deployed Bytecode

0x6040608081526004908136101561001557600080fd5b600091823560e01c9081628cc2621461101a5781630700037d14610fb85781631171bda914610e5657816318160ddd14610e195781632e1a7d4d14610caa578163386a952514610c6e5781633c6b16ab14610a565781633d18b9121461095f5781633fc6df6e1461090c5781636041c34f146108b357816370a082311461085157816372f702f3146107e25781637b0a47ee146107a557816380faa57d1461076a578163873291bb146106b75781638b87634714610655578163a694fc3a146105cc578163aceccf8f146104cd578163c8f33c9114610490578163cd3daf9d1461044e578163df136d6514610411578163e9fad8ee146101d757508063ebe2b12b1461019b5763f7c618c11461012a57600080fd5b3461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2168152f35b5080fd5b503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906002549051908152f35b90503461040d57827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d57338352602090600a82528284205461021d6116c2565b610225611153565b6006556102306110a9565b60055533151591826103e9575b811561038d5750610250816009546110be565b600955338552600a835261026781858720546110be565b338652600a84528486205561029d81337f000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce461147b565b83519081527f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5833392a2600184556102d36116c2565b6102db611153565b6006556102e66110a9565b600555610369575b3383526008815281832090815492848461030a575b6001815580f35b7fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486935561035884337f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261147b565b519283523392a23880808084610303565b610372336111ba565b338452600882528284205560065460078252828420556102ee565b606490848651917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f38390000000000000000000000000000000000000000000000000000000000006044820152fd5b6103f2336111ba565b3387526008855285872055600654600785528587205561023d565b8280fd5b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906006549051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019757602090610489611153565b9051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906005549051908152f35b8391503461019757827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019757610506611086565b9061050f6116c2565b73ffffffffffffffffffffffffffffffffffffffff8216801561056f5793610303939461053a611153565b6006556105456110a9565b600555610551846111ba565b90865260086020528186205560065490600760205285205535611244565b60648260208751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600160248201527f30000000000000000000000000000000000000000000000000000000000000006044820152fd5b90503461040d5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d57610303916106096116c2565b610611611153565b60065561061c6110a9565b6005553361062e575b50339035611244565b610637336111ba565b33855260086020528185205560065490600760205284205538610625565b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197578060209273ffffffffffffffffffffffffffffffffffffffff6106a761105e565b1681526007845220549051908152f35b83346107675760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610767577fffffffffffffffffffffffff000000000000000000000000000000000000000061071061105e565b6001549073ffffffffffffffffffffffffffffffffffffffff9061073782841633146113d5565b1691829116176001557f1c794a043683a294127c95bc365bae91b63b651eb9884a2c9120afee2bb690b48280a280f35b80fd5b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906104896110a9565b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906003549051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020905173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce4168152f35b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197578060209273ffffffffffffffffffffffffffffffffffffffff6108a361105e565b168152600a845220549051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261019757602090517f0000000000000000000000000000000000000000000000000de0b6b3a76400008152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101975760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576109976116c2565b61099f611153565b6006556109aa6110a9565b60055533610a30575b33825260086020528082209082825492836109d1575b506001815580f35b556109fd82337f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261147b565b519081527fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048660203392a2388082816109c9565b610a39336111ba565b3383526008602052818320556006546007602052818320556109b3565b8391503461019757602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d5760248135918373ffffffffffffffffffffffffffffffffffffffff610ab4816001541633146113d5565b610abc6116c2565b610ac4611153565b600655610acf6110a9565b600555600254428111610c3b5750610ae883548661110d565b6003555b8751938480927f70a0823100000000000000000000000000000000000000000000000000000000825230868301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2165afa918215610c31578592610bfe575b50600354610b5c8254809461110d565b10610ba2575093610b937fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d94954260055542611146565b60025551908152a16001815580f35b606490848751917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f39310000000000000000000000000000000000000000000000000000000000006044820152fd5b9091508381813d8311610c2a575b610c16818361143a565b81010312610c2657519086610b4c565b8480fd5b503d610c0c565b86513d87823e3d90fd5b610c5e610c58610c4f610c669342906110be565b600354906110fa565b87611146565b84549061110d565b600355610aec565b90503461040d57827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d5760209250549051908152f35b9190503461040d57602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610e1557823592610ce96116c2565b610cf1611153565b600655610cfc6110a9565b60055533610df1575b8315610d965750907f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d591610d3b846009546110be565b600955338552600a8252610d5284828720546110be565b338652600a835281862055610d8884337f000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce461147b565b519283523392a26001815580f35b8260649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f38390000000000000000000000000000000000000000000000000000000000006044820152fd5b610dfa336111ba565b33865260088452828620556006546007845282862055610d05565b8380fd5b50503461019757817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197576020906009549051908152f35b90503461040d5760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261040d57610e8f61105e565b610e97611086565b6044359373ffffffffffffffffffffffffffffffffffffffff8093610ec1826001541633146113d5565b1693837f000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce41685141580610f8c575b15610f30575091817ffff3b3844276f57024e0b42afec1a37f75db36511e43819a4f2a63ab7862b64893610f26876020958861147b565b519586521693a380f35b602060649251917f08c379a0000000000000000000000000000000000000000000000000000000008352820152600260248201527f32300000000000000000000000000000000000000000000000000000000000006044820152fd5b50837f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216851415610eef565b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610197578060209273ffffffffffffffffffffffffffffffffffffffff61100a61105e565b1681526008845220549051908152f35b5050346101975760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101975760209061048961105961105e565b6111ba565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361108157565b600080fd5b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361108157565b6002548042106000146110bb57504290565b90565b919082039182116110cb57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818102929181159184041417156110cb57565b8115611117570490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b919082018092116110cb57565b60095480156111b3576110bb906111ad600654916111a8611181610c4f6111786110a9565b600554906110be565b7f0000000000000000000000000000000000000000000000000de0b6b3a7640000906110fa565b61110d565b90611146565b5060065490565b73ffffffffffffffffffffffffffffffffffffffff6110bb911660406000828152600a60205261123461120d838320546112076111f5611153565b878652600760205286862054906110be565b906110fa565b7f0000000000000000000000000000000000000000000000000de0b6b3a76400009061110d565b9281526008602052205490611146565b908115611377576040517f23b872dd0000000000000000000000000000000000000000000000000000000060208201523360248201523060448201528260648201526064815260a081019080821067ffffffffffffffff831117611348577f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9261130973ffffffffffffffffffffffffffffffffffffffff926020946040527f000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce46114f0565b61131585600954611146565b600955169283600052600a825261133181604060002054611146565b84600052600a8352604060002055604051908152a2565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f39300000000000000000000000000000000000000000000000000000000000006044820152fd5b156113dc57565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600160248201527f31000000000000000000000000000000000000000000000000000000000000006044820152fd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761134857604052565b9173ffffffffffffffffffffffffffffffffffffffff604051927fa9059cbb000000000000000000000000000000000000000000000000000000006020850152166024830152604482015260448152608081019181831067ffffffffffffffff841117611348576114ee926040526114f0565b565b73ffffffffffffffffffffffffffffffffffffffff1690600080826020829451910182865af13d15611616573d9067ffffffffffffffff82116115e95790611578916040519161156860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116018461143a565b82523d84602084013e5b84611622565b9081519182151592836115c1575b5050506115905750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126101975760200151908115918215036107675750388080611586565b6024837f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b61157890606090611572565b90611661575080511561163757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806116b9575b611672575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b1561166a565b6002600054146116d3576002600055565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fdfea26469706673582212207ad9f67af357b99e5929b1addc74f9195d27c0ccaa470f3daaffddf789d18c5f64736f6c63430008140033

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

000000000000000000000000000000000018658fc319f3eeac9bbd054ded4856000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce40000000000000000000000000000000000000000000000000000000000093a80

-----Decoded View---------------
Arg [0] : _rewardsDistribution (address): 0x000000000018658fC319f3EeAc9bbD054dEd4856
Arg [1] : _rewardToken (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [2] : _stakingToken (address): 0xe7baC7d798D66D353b9e50EbFC6859950fE13Ce4
Arg [3] : _rewardsDuration (uint256): 604800

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000018658fc319f3eeac9bbd054ded4856
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 000000000000000000000000e7bac7d798d66d353b9e50ebfc6859950fe13ce4
Arg [3] : 0000000000000000000000000000000000000000000000000000000000093a80


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  ]
[ 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.