ETH Price: $3,719.93 (+4.43%)

Contract

0x2b228842B97aB8a1F3Dcd216ec5D553ada957915
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Exit195420772024-03-29 20:37:59245 days ago1711744679IN
0x2b228842...ada957915
0 ETH0.0042859229.93258338
Exit193017842024-02-25 3:02:11279 days ago1708830131IN
0x2b228842...ada957915
0 ETH0.0037137825.93682246
Exit176659652023-07-10 21:35:59508 days ago1689024959IN
0x2b228842...ada957915
0 ETH0.0025230720.01071587
Withdraw169880992023-04-06 7:20:11603 days ago1680765611IN
0x2b228842...ada957915
0 ETH0.002513427.58047627
Stake169787682023-04-04 23:30:35605 days ago1680651035IN
0x2b228842...ada957915
0 ETH0.0032261927.75768763
Stake169739442023-04-04 7:03:35605 days ago1680591815IN
0x2b228842...ada957915
0 ETH0.0020338817.49924477
Exit157172492022-10-10 10:57:11781 days ago1665399431IN
0x2b228842...ada957915
0 ETH0.0039392336.14444922
Exit156842352022-10-05 20:17:47786 days ago1665001067IN
0x2b228842...ada957915
0 ETH0.0027547428.73989562
Exit156427152022-09-30 0:56:35792 days ago1664499395IN
0x2b228842...ada957915
0 ETH0.0010517710.97301855
Exit155965822022-09-23 14:15:59798 days ago1663942559IN
0x2b228842...ada957915
0 ETH0.002180322.74683647
Exit141508602022-02-06 6:31:111027 days ago1644129071IN
0x2b228842...ada957915
0 ETH0.0059421247.12751944
Exit141506362022-02-06 5:43:201028 days ago1644126200IN
0x2b228842...ada957915
0 ETH0.0050372352.55277343
Stake141505462022-02-06 5:24:261028 days ago1644125066IN
0x2b228842...ada957915
0 ETH0.0053574246.09450299
Withdraw140021232022-01-14 6:47:061050 days ago1642142826IN
0x2b228842...ada957915
0 ETH0.01500939164.70316102
Stake140020922022-01-14 6:39:421050 days ago1642142382IN
0x2b228842...ada957915
0 ETH0.01757458177.29365251
Stake138944662021-12-28 15:13:191067 days ago1640704399IN
0x2b228842...ada957915
0 ETH0.0107228592.25785575
Withdraw138318712021-12-18 22:38:441077 days ago1639867124IN
0x2b228842...ada957915
0 ETH0.0049568843.5463731
Exit137683962021-12-09 2:16:551087 days ago1639016215IN
0x2b228842...ada957915
0 ETH0.0119483783.44652428
Exit136646902021-11-22 13:13:401103 days ago1637586820IN
0x2b228842...ada957915
0 ETH0.00994496103.75442532
Exit136109732021-11-14 0:59:101112 days ago1636851550IN
0x2b228842...ada957915
0 ETH0.01006435105
Stake134969002021-10-27 3:07:161130 days ago1635304036IN
0x2b228842...ada957915
0 ETH0.0097741898.60263187
Exit134867662021-10-25 13:01:511131 days ago1635166911IN
0x2b228842...ada957915
0 ETH0.0064492251.14941139
Exit134688632021-10-22 17:55:101134 days ago1634925310IN
0x2b228842...ada957915
0 ETH0.01482115117.54797385
Exit134609162021-10-21 12:08:121135 days ago1634818092IN
0x2b228842...ada957915
0 ETH0.0063687780.87234689
Get Reward133477382021-10-03 18:05:041153 days ago1633284304IN
0x2b228842...ada957915
0 ETH0.00810539172.95205136
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
123241542021-04-27 18:49:211312 days ago1619549361  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x3FD816A5...6bD818C9C
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
StakingRewards

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 9999 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2021-04-27
*/

// SPDX-License-Identifier: MIT

pragma solidity 0.5.17;

/*
 * Docs: https://docs.synthetix.io/
 *
 *
 * MIT License
 * ===========
 *
 * Copyright (c) 2020 Synthetix
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 */

library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract's constructor, its address will be reported as
     * not containing a contract.
     *
     * > It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

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

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

interface IStakingRewards {
    // Views
    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

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

    function getRewardForDuration() external view returns (uint256);

    function totalSupply() external view returns (uint256);

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

    // Mutative

    function stake(uint256 amount) external;

    function withdraw(uint256 amount) external;

    function getReward() external;

    function exit() external;
}

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

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

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

contract Owned {
    address public owner;
    address public nominatedOwner;

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

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

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

    modifier onlyOwner {
        _onlyOwner();
        _;
    }

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

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

contract Pausable is Owned {
    uint256 public lastPauseTime;
    bool public paused;

    constructor() internal {
        // This contract is abstract, and thus cannot be instantiated directly
        require(owner != address(0), "Owner must be set");
        // Paused will be false, and lastPauseTime will be 0 upon initialisation
    }

    /**
     * @notice Change the paused state of the contract
     * @dev Only the contract owner may call this.
     */
    function setPaused(bool _paused) external onlyOwner {
        // Ensure we're actually changing the state before we do anything
        if (_paused == paused) {
            return;
        }

        // Set our paused state.
        paused = _paused;

        // If applicable, set the last pause time.
        if (paused) {
            lastPauseTime = now;
        }

        // Let everyone know that our pause state has changed.
        emit PauseChanged(paused);
    }

    event PauseChanged(bool isPaused);

    modifier notPaused {
        require(
            !paused,
            "This action cannot be performed while the contract is paused"
        );
        _;
    }
}

contract ReentrancyGuard {
    /// @dev counter to allow mutex lock with only one SSTORE operation
    uint256 private _guardCounter;

    constructor() internal {
        // The counter starts at one to prevent changing it from zero to a non-zero
        // value, which is a more expensive operation.
        _guardCounter = 1;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _guardCounter += 1;
        uint256 localCounter = _guardCounter;
        _;
        require(
            localCounter == _guardCounter,
            "ReentrancyGuard: reentrant call"
        );
    }
}

contract RewardsDistributionRecipient is Owned {
    address public rewardsDistribution;

    function notifyRewardAmount(uint256 reward, address rewardHolder) external;

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

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

library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

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

    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance =
            token.allowance(address(this), spender).sub(value);
        callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves.

        // A Solidity high level call has three parts:
        //  1. The target address is checked to verify it contains contract code
        //  2. The call itself is made, and success asserted
        //  3. The return value is decoded, which in turn checks the size of the returned data.
        // solhint-disable-next-line max-line-length
        require(address(token).isContract(), "SafeERC20: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = address(token).call(data);
        require(success, "SafeERC20: low-level call failed");

        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: ERC20 operation did not succeed"
            );
        }
    }
}

library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

        return c;
    }

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

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

        return c;
    }

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

        return c;
    }

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

interface IChainLinkFeed {
    function latestAnswer() external view returns (int256);
}

contract StakingRewards is
    IStakingRewards,
    RewardsDistributionRecipient,
    ReentrancyGuard,
    Pausable
{
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    /* ========== STATE VARIABLES ========== */
    IChainLinkFeed public constant FASTGAS =
        IChainLinkFeed(0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C);

    IERC20 public rewardsToken;
    IERC20 public stakingToken;
    uint256 public periodFinish = 0;
    uint256 public rewardRate = 0;
    uint256 public rewardsDuration;
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;

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

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

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

    constructor(
        address _owner,
        address _rewardsDistribution,
        address _rewardsToken,
        address _stakingToken,
        uint256 _rewardsDuration
    ) public Owned(_owner) {
        rewardsToken = IERC20(_rewardsToken);
        stakingToken = IERC20(_stakingToken);
        rewardsDistribution = _rewardsDistribution;
        rewardsDuration = _rewardsDuration;
    }

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

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

    function getFastGas() external view returns (uint256) {
        return uint256(FASTGAS.latestAnswer());
    }

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

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

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

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

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

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

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

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

    function getReward() public nonReentrant updateReward(msg.sender) {
        uint256 reward = rewards[msg.sender];
        if (reward > 0) {
            // Safe gaurd against error if reward is greater than balance in contract
            uint256 balance = rewardsToken.balanceOf(address(this));
            if (rewards[msg.sender] > balance) {
                reward = balance;
            }
            rewards[msg.sender] = 0;
            rewardsToken.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

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

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

    function notifyRewardAmount(uint256 reward, address rewardHolder)
        external
        onlyRewardsDistribution
        updateReward(address(0))
    {
        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(rewardsDuration);
        } else {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = reward.add(leftover).div(rewardsDuration);
        }

        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(rewardsDuration);

        // handle the transfer of reward tokens via `transferFrom` to reduce the number
        // of transactions required and ensure correctness of the reward amount

        rewardsToken.safeTransferFrom(rewardHolder, address(this), reward);

        emit RewardAdded(reward);

    }

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

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

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

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

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

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

/**
 * @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.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be aplied to your functions to restrict their use to
 * the owner.
 */
contract Ownable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

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

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _owner;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * > Note: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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 onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(
            newOwner != address(0),
            "Ownable: new owner is the zero address"
        );
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

contract StakingRewardsFactory is Ownable {
    using SafeERC20 for IERC20;

    // immutables
    address public rewardsToken;
    uint256 public stakingRewardsGenesis;

    // the staking tokens for which the rewards contract has been deployed
    address[] public stakingTokens;

    // info about rewards for a particular staking token
    struct StakingRewardsInfo {
        address stakingRewards;
        uint256 rewardAmount;
    }

    // rewards info by staking token
    mapping(address => StakingRewardsInfo)
        public stakingRewardsInfoByStakingToken;

    constructor(address _rewardsToken, uint256 _stakingRewardsGenesis)
        public
        Ownable()
    {
        require(
            _stakingRewardsGenesis >= block.timestamp,
            "StakingRewardsFactory::constructor: genesis too soon"
        );

        rewardsToken = _rewardsToken;
        stakingRewardsGenesis = _stakingRewardsGenesis;
    }

    ///// permissioned functions

    // deploy a staking reward contract for the staking token, and store the reward amount
    // the reward will be distributed to the staking reward contract no sooner than the genesis
    function deploy(
        address stakingToken,
        uint256 rewardAmount,
        uint256 rewardsDuration
    ) public onlyOwner {
        StakingRewardsInfo storage info =
            stakingRewardsInfoByStakingToken[stakingToken];
        require(
            info.stakingRewards == address(0),
            "StakingRewardsFactory::deploy: already deployed"
        );

        // Args on the StakingRewards
        // address _owner,
        // address _rewardsDistribution,
        // address _rewardsToken,
        // address _stakingToken,
        // uint256 _rewardsDuration
        info.stakingRewards = address(
            new StakingRewards(
                /*_rewardsDistribution=*/
                owner(),
                address(this),
                rewardsToken,
                stakingToken,
                rewardsDuration
            )
        );
        info.rewardAmount = rewardAmount;
        stakingTokens.push(stakingToken);
    }

    // Fallback function to return money to reward distributer via pool deployer
    // In case of issues or incorrect calls or errors
    function refund(uint256 amount, address refundAddress) public onlyOwner {
        require(IERC20(rewardsToken).balanceOf(address(this)) >= amount, "StakingRewardsFactory::refund: Not enough tokens");
        IERC20(rewardsToken).safeTransfer(refundAddress, amount);
    }

    ///// permissionless functions

    // call notifyRewardAmount for all staking tokens.
    function notifyRewardAmounts() public {
        require(
            stakingTokens.length > 0,
            "StakingRewardsFactory::notifyRewardAmounts: called before any deploys"
        );
        for (uint256 i = 0; i < stakingTokens.length; i++) {
            notifyRewardAmount(stakingTokens[i]);
        }
    }

    // notify reward amount for an individual staking token.
    // this is a fallback in case the notifyRewardAmounts costs too much gas to call for all contracts
    function notifyRewardAmount(address stakingToken) public {
        require(
            block.timestamp >= stakingRewardsGenesis,
            "StakingRewardsFactory::notifyRewardAmount: not ready"
        );

        StakingRewardsInfo storage info =
            stakingRewardsInfoByStakingToken[stakingToken];
        require(
            info.stakingRewards != address(0),
            "StakingRewardsFactory::notifyRewardAmount: not deployed"
        );

        if (info.rewardAmount > 0) {
            uint256 rewardAmount = info.rewardAmount;
            info.rewardAmount = 0;

            IERC20(rewardsToken).approve(info.stakingRewards, rewardAmount);
            StakingRewards(info.stakingRewards).notifyRewardAmount(
                rewardAmount,
                address(this)
            );
        }
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_rewardsDistribution","type":"address"},{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isPaused","type":"bool"}],"name":"PauseChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","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":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"},{"constant":true,"inputs":[],"name":"FASTGAS","outputs":[{"internalType":"contract IChainLinkFeed","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"exit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getFastGas","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getReward","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getRewardForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastPauseTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"address","name":"rewardHolder","type":"address"}],"name":"notifyRewardAmount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardsDistribution","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardsDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_rewardsDistribution","type":"address"}],"name":"setRewardsDistribution","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_rewardsDuration","type":"uint256"}],"name":"setRewardsDuration","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061020a5760003560e01c806379ba50971161012a578063a694fc3a116100bd578063d1af0c7d1161008c578063df136d6511610071578063df136d651461050a578063e9fad8ee14610512578063ebe2b12b1461051a5761020a565b8063d1af0c7d146104fa578063dbbc4a57146105025761020a565b8063a694fc3a146104b0578063c8f33c91146104cd578063cc1a378f146104d5578063cd3daf9d146104f25761020a565b80638b876347116100f95780638b876347146104655780638da5cb5b14610498578063904440bd146104a057806391b4ded9146104a85761020a565b806379ba5097146104145780637b0a47ee1461041c57806380faa57d146104245780638980f11f1461042c5761020a565b8063386a9525116101a25780635c975abb116101715780635c975abb1461038457806368d53c43146103a057806370a08231146103d957806372f702f31461040c5761020a565b8063386a95251461033b5780633d18b912146103435780633fc6df6e1461034b57806353a47bb71461037c5761020a565b806318160ddd116101de57806318160ddd146102db57806319762143146102e35780631c1f78eb146103165780632e1a7d4d1461031e5761020a565b80628cc2621461020f5780630700037d146102545780631627540c1461028757806316c38b3c146102bc575b600080fd5b6102426004803603602081101561022557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610522565b60408051918252519081900360200190f35b6102426004803603602081101561026a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166105d2565b6102ba6004803603602081101561029d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166105e4565b005b6102ba600480360360208110156102d257600080fd5b50351515610665565b6102426106fd565b6102ba600480360360208110156102f957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610704565b610242610753565b6102ba6004803603602081101561033457600080fd5b5035610771565b610242610946565b6102ba61094c565b610353610b72565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610353610b8e565b61038c610baa565b604080519115158252519081900360200190f35b6102ba600480360360408110156103b657600080fd5b508035906020013573ffffffffffffffffffffffffffffffffffffffff16610bb3565b610242600480360360208110156103ef57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d71565b610353610d99565b6102ba610db5565b610242610eb0565b610242610eb6565b6102ba6004803603604081101561044257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610ec4565b6102426004803603602081101561047b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610fa8565b610353610fba565b610242610fd6565b610242611063565b6102ba600480360360208110156104c657600080fd5b5035611069565b61024261127d565b6102ba600480360360208110156104eb57600080fd5b5035611283565b610242611306565b610353611360565b610353611381565b610242611399565b6102ba61139f565b6102426113c2565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600d6020908152604080832054600c9092528220546105cc91906105c090670de0b6b3a7640000906105b49061058290610576611306565b9063ffffffff6113c816565b73ffffffffffffffffffffffffffffffffffffffff88166000908152600f60205260409020549063ffffffff61142516565b9063ffffffff61148516565b9063ffffffff6114ef16565b92915050565b600d6020526000908152604090205481565b6105ec611549565b6001805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b61066d611549565b60055460ff1615158115151415610683576106fa565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016821515179081905560ff16156106be57426004555b6005546040805160ff90921615158252517f8fb6c181ee25a520cf3dd6565006ef91229fcfe5a989566c2a3b8c115570cec59181900360200190a15b50565b600e545b90565b61070c611549565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600061076c60095460085461142590919063ffffffff16565b905090565b600380546001019081905533610785611306565b600b55610790610eb6565b600a5573ffffffffffffffffffffffffffffffffffffffff8116156107f1576107b881610522565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d6020908152604080832093909355600b54600c909152919020555b60008311610846576040805162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b600e54610859908463ffffffff6113c816565b600e55336000908152600f602052604090205461087c908463ffffffff6113c816565b336000818152600f60205260409020919091556006546108b59173ffffffffffffffffffffffffffffffffffffffff909116908561159f565b60408051848152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a2506003548114610942576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b5050565b60095481565b600380546001019081905533610960611306565b600b5561096b610eb6565b600a5573ffffffffffffffffffffffffffffffffffffffff8116156109cc5761099381610522565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d6020908152604080832093909355600b54600c909152919020555b336000908152600d60205260409020548015610b1a57600554604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092610100900473ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015610a5857600080fd5b505afa158015610a6c573d6000803e3d6000fd5b505050506040513d6020811015610a8257600080fd5b5051336000908152600d6020526040902054909150811015610aa2578091505b336000818152600d6020526040812055600554610ae29161010090910473ffffffffffffffffffffffffffffffffffffffff16908463ffffffff61159f16565b60408051838152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a2505b505060035481146106fa576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60055460ff1681565b60025473ffffffffffffffffffffffffffffffffffffffff163314610c095760405162461bcd60e51b815260040180806020018281038252602a8152602001806119f2602a913960400191505060405180910390fd5b6000610c13611306565b600b55610c1e610eb6565b600a5573ffffffffffffffffffffffffffffffffffffffff811615610c7f57610c4681610522565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d6020908152604080832093909355600b54600c909152919020555b6007544210610ca457600954610c9c90849063ffffffff61148516565b600855610cf3565b600754600090610cba904263ffffffff6113c816565b90506000610cd36008548361142590919063ffffffff16565b600954909150610ced906105b4878463ffffffff6114ef16565b60085550505b42600a819055600954610d0c919063ffffffff6114ef16565b600755600554610d3990610100900473ffffffffffffffffffffffffffffffffffffffff16833086611631565b6040805184815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a1505050565b73ffffffffffffffffffffffffffffffffffffffff166000908152600f602052604090205490565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff163314610e0b5760405162461bcd60e51b81526004018080602001828103825260358152602001806119316035913960400191505060405180910390fd5b6000546001546040805173ffffffffffffffffffffffffffffffffffffffff938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60085481565b600061076c426007546116cc565b610ecc611549565b60065473ffffffffffffffffffffffffffffffffffffffff83811691161415610f265760405162461bcd60e51b8152600401808060200182810382526021815260200180611a466021913960400191505060405180910390fd5b600054610f539073ffffffffffffffffffffffffffffffffffffffff84811691168363ffffffff61159f16565b6040805173ffffffffffffffffffffffffffffffffffffffff841681526020810183905281517f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa28929181900390910190a15050565b600c6020526000908152604090205481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b600073169e633a2d1e6c10dd91238ba11c4a708dfef37c73ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561103257600080fd5b505afa158015611046573d6000803e3d6000fd5b505050506040513d602081101561105c57600080fd5b5051905090565b60045481565b600380546001019081905560055460ff16156110b65760405162461bcd60e51b815260040180806020018281038252603c8152602001806119b6603c913960400191505060405180910390fd5b336110bf611306565b600b556110ca610eb6565b600a5573ffffffffffffffffffffffffffffffffffffffff81161561112b576110f281610522565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d6020908152604080832093909355600b54600c909152919020555b60008311611180576040805162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b600e54611193908463ffffffff6114ef16565b600e55336000908152600f60205260409020546111b6908463ffffffff6114ef16565b336000818152600f60205260409020919091556006546111f09173ffffffffffffffffffffffffffffffffffffffff909116903086611631565b60408051848152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a2506003548114610942576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600a5481565b61128b611549565b60075442116112cb5760405162461bcd60e51b81526004018080602001828103825260588152602001806118d96058913960600191505060405180910390fd5b60098190556040805182815290517ffb46ca5a5e06d4540d6387b930a7c978bce0db5f449ec6b3f5d07c6e1d44f2d39181900360200190a150565b6000600e546000141561131c5750600b54610701565b61076c611351600e546105b4670de0b6b3a7640000611345600854611345600a54610576610eb6565b9063ffffffff61142516565b600b549063ffffffff6114ef16565b600554610100900473ffffffffffffffffffffffffffffffffffffffff1681565b73169e633a2d1e6c10dd91238ba11c4a708dfef37c81565b600b5481565b336000908152600f60205260409020546113b890610771565b6113c061094c565b565b60075481565b60008282111561141f576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082611434575060006105cc565b8282028284828161144157fe5b041461147e5760405162461bcd60e51b81526004018080602001828103825260218152602001806119956021913960400191505060405180910390fd5b9392505050565b60008082116114db576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b60008284816114e657fe5b04949350505050565b60008282018381101561147e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60005473ffffffffffffffffffffffffffffffffffffffff1633146113c05760405162461bcd60e51b815260040180806020018281038252602f815260200180611966602f913960400191505060405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261162c9084906116e2565b505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526116c69085906116e2565b50505050565b60008183106116db578161147e565b5090919050565b6117018273ffffffffffffffffffffffffffffffffffffffff166118d2565b611752576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b602083106117bb57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161177e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461181d576040519150601f19603f3d011682016040523d82523d6000602084013e611822565b606091505b509150915081611879576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156116c65780806020019051602081101561189557600080fd5b50516116c65760405162461bcd60e51b815260040180806020018281038252602a815260200180611a1c602a913960400191505060405180910390fd5b3b15159056fe50726576696f7573207265776172647320706572696f64206d75737420626520636f6d706c657465206265666f7265206368616e67696e6720746865206475726174696f6e20666f7220746865206e657720706572696f64596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e6572736869704f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775468697320616374696f6e2063616e6e6f7420626520706572666f726d6564207768696c652074686520636f6e74726163742069732070617573656443616c6c6572206973206e6f742052657761726473446973747269627574696f6e20636f6e74726163745361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656443616e6e6f7420776974686472617720746865207374616b696e6720746f6b656ea265627a7a72315820e3390b57ce506a5d1c4f8635541af205a5dcc151ae030bd34c6f664fd560c4dc64736f6c63430005110032

Deployed Bytecode Sourcemap

17032:6732:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;17032:6732:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19259:265;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;19259:265:0;;;;:::i;:::-;;;;;;;;;;;;;;;;17715:42;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;17715:42:0;;;;:::i;6559:141::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;6559:141:0;;;;:::i;:::-;;7862:488;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;7862:488:0;;;;:::i;18354:93::-;;;:::i;9928:165::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;9928:165:0;;;;:::i;19532:121::-;;;:::i;20143:389::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;20143:389:0;;:::i;17534:30::-;;;:::i;20540:564::-;;;:::i;9603:34::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;6328:29;;;:::i;7448:18::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;21273:889;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;21273:889:0;;;;;;;;;:::i;18574:112::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;18574:112:0;;;;:::i;17427:26::-;;;:::i;6708:308::-;;;:::i;17498:29::-;;;:::i;18694:131::-;;;:::i;22277:362::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;22277:362:0;;;;;;;;;:::i;17651:57::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;17651:57:0;;;;:::i;6301:20::-;;;:::i;18455:111::-;;;:::i;7413:28::-;;;:::i;19715:420::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;19715:420:0;;:::i;17571:29::-;;;:::i;22647:360::-;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;22647:360:0;;:::i;18833:418::-;;;:::i;17394:26::-;;;:::i;17277:108::-;;;:::i;17607:35::-;;;:::i;21112:97::-;;;:::i;17460:31::-;;;:::i;19259:265::-;19499:16;;;19313:7;19499:16;;;:7;:16;;;;;;;;;19415:22;:31;;;;;;19353:163;;19499:16;19353:123;;19471:4;;19353:95;;19394:53;;:16;:14;:16::i;:::-;:20;:53;:20;:53;:::i;:::-;19353:18;;;;;;;:9;:18;;;;;;;:95;:40;:95;:::i;:::-;:117;:123;:117;:123;:::i;:::-;:145;:163;:145;:163;:::i;:::-;19333:183;19259:265;-1:-1:-1;;19259:265:0:o;17715:42::-;;;;;;;;;;;;;:::o;6559:141::-;7054:12;:10;:12::i;:::-;6631:14;:23;;;;;;;;;;;;;;6670:22;;;;;;;;;;;;;;;;6559:141;:::o;7862:488::-;7054:12;:10;:12::i;:::-;8015:6;;;;8004:17;;;;;;8000:56;;;8038:7;;8000:56;8102:6;:16;;;;;;;;;;;;;8187:6;8183:58;;;8226:3;8210:13;:19;8183:58;8335:6;;8322:20;;;8335:6;;;;8322:20;;;;;;;;;;;;;;7077:1;7862:488;:::o;18354:93::-;18427:12;;18354:93;;:::o;9928:165::-;7054:12;:10;:12::i;:::-;10043:19;:42;;;;;;;;;;;;;;;9928:165::o;19532:121::-;19587:7;19614:31;19629:15;;19614:10;;:14;;:31;;;;:::i;:::-;19607:38;;19532:121;:::o;20143:389::-;9336:13;:18;;9353:1;9336:18;;;;;20237:10;23133:16;:14;:16::i;:::-;23110:20;:39;23177:26;:24;:26::i;:::-;23160:14;:43;23218:21;;;;23214:157;;23275:15;23282:7;23275:6;:15::i;:::-;23256:16;;;;;;;:7;:16;;;;;;;;:34;;;;23339:20;;23305:22;:31;;;;;;:54;23214:157;20282:1;20273:6;:10;20265:40;;;;;-1:-1:-1;;;20265:40:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;20331:12;;:24;;20348:6;20331:24;:16;:24;:::i;:::-;20316:12;:39;20400:10;20390:21;;;;:9;:21;;;;;;:33;;20416:6;20390:33;:25;:33;:::i;:::-;20376:10;20366:21;;;;:9;:21;;;;;:57;;;;20434:12;;:45;;20366:21;20434:12;;;;20472:6;20434:25;:45::i;:::-;20495:29;;;;;;;;20505:10;;20495:29;;;;;;;;;;9412:1;9462:13;;9446:12;:29;9424:110;;;;;-1:-1:-1;;;9424:110:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;20143:389;;:::o;17534:30::-;;;;:::o;20540:564::-;9336:13;:18;;9353:1;9336:18;;;;;20594:10;23133:16;:14;:16::i;:::-;23110:20;:39;23177:26;:24;:26::i;:::-;23160:14;:43;23218:21;;;;23214:157;;23275:15;23282:7;23275:6;:15::i;:::-;23256:16;;;;;;;:7;:16;;;;;;;;:34;;;;23339:20;;23305:22;:31;;;;;;:54;23214:157;20642:10;20617:14;20634:19;;;:7;:19;;;;;;20668:10;;20664:433;;20800:12;;:37;;;;;;20831:4;20800:37;;;;;;-1:-1:-1;;20800:12:0;;;;;;:22;;:37;;;;;;;;;;;;;;:12;:37;;;5:2:-1;;;;30:1;27;20:12;5:2;20800:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;20800:37:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;20800:37:0;20864:10;20856:19;;;;:7;20800:37;20856:19;;;;;20800:37;;-1:-1:-1;20856:29:0;-1:-1:-1;20852:86:0;;;20915:7;20906:16;;20852:86;20960:10;20974:1;20952:19;;;:7;:19;;;;;:23;20990:12;;:45;;:12;;;;20952:19;20990:12;;21028:6;20990:45;:25;:45;:::i;:::-;21055:30;;;;;;;;21066:10;;21055:30;;;;;;;;;;20664:433;;23381:1;9412;9462:13;;9446:12;:29;9424:110;;;;;-1:-1:-1;;;9424:110:0;;;;;;;;;;;;;;;;;;;;;;;;;;;9603:34;;;;;;:::o;6328:29::-;;;;;;:::o;7448:18::-;;;;;;:::o;21273:889::-;9811:19;;;;9797:10;:33;9775:125;;;;-1:-1:-1;;;9775:125:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21420:1;23133:16;:14;:16::i;:::-;23110:20;:39;23177:26;:24;:26::i;:::-;23160:14;:43;23218:21;;;;23214:157;;23275:15;23282:7;23275:6;:15::i;:::-;23256:16;;;;;;;:7;:16;;;;;;;;:34;;;;23339:20;;23305:22;:31;;;;;;:54;23214:157;21463:12;;21444:15;:31;21440:318;;21516:15;;21505:27;;:6;;:27;:10;:27;:::i;:::-;21492:10;:40;21440:318;;;21585:12;;21565:17;;21585:33;;21602:15;21585:33;:16;:33;:::i;:::-;21565:53;;21633:16;21652:25;21666:10;;21652:9;:13;;:25;;;;:::i;:::-;21730:15;;21633:44;;-1:-1:-1;21705:41:0;;:20;:6;21633:44;21705:20;:10;:20;:::i;:41::-;21692:10;:54;-1:-1:-1;;21440:318:0;21787:15;21770:14;:32;;;21848:15;;21828:36;;21787:15;21828:36;:19;:36;:::i;:::-;21813:12;:51;22049:12;;:66;;:12;;;;;22079;22101:4;22108:6;22049:29;:66::i;:::-;22133:19;;;;;;;;;;;;;;;;;9911:1;21273:889;;:::o;18574:112::-;18660:18;;18633:7;18660:18;;;:9;:18;;;;;;;18574:112::o;17427:26::-;;;;;;:::o;6708:308::-;6791:14;;;;6777:10;:28;6755:131;;;;-1:-1:-1;;;6755:131:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6915:5;;;6922:14;6902:35;;;6915:5;;;;6902:35;;6922:14;;;;6902:35;;;;;;;;;;;;;;;;6956:14;;;;6948:22;;;;;;6956:14;;;6948:22;;;;6981:27;;;6708:308::o;17498:29::-;;;;:::o;18694:131::-;18751:7;18778:39;18787:15;18804:12;;18778:8;:39::i;22277:362::-;7054:12;:10;:12::i;:::-;22441;;;22417:37;;;22441:12;;22417:37;;22395:120;;;;-1:-1:-1;;;22395:120:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22560:5;;22526:53;;22560:5;22526:33;;;;22560:5;22567:11;22526:53;:33;:53;:::i;:::-;22595:36;;;;;;;;;;;;;;;;;;;;;;;;;;;22277:362;;:::o;17651:57::-;;;;;;;;;;;;;:::o;6301:20::-;;;;;;:::o;18455:111::-;18500:7;17342:42;18535:20;;;:22;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;18535:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;18535:22:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;18535:22:0;;-1:-1:-1;18455:111:0;:::o;7413:28::-;;;;:::o;19715:420::-;9336:13;:18;;9353:1;9336:18;;;;;8453:6;;;;8452:7;8430:117;;;;-1:-1:-1;;;8430:117:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19827:10;23133:16;:14;:16::i;:::-;23110:20;:39;23177:26;:24;:26::i;:::-;23160:14;:43;23218:21;;;;23214:157;;23275:15;23282:7;23275:6;:15::i;:::-;23256:16;;;;;;;:7;:16;;;;;;;;:34;;;;23339:20;;23305:22;:31;;;;;;:54;23214:157;19872:1;19863:6;:10;19855:37;;;;;-1:-1:-1;;;19855:37:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;19918:12;;:24;;19935:6;19918:24;:16;:24;:::i;:::-;19903:12;:39;19987:10;19977:21;;;;:9;:21;;;;;;:33;;20003:6;19977:33;:25;:33;:::i;:::-;19963:10;19953:21;;;;:9;:21;;;;;:57;;;;20021:12;;:64;;19953:21;20021:12;;;;20071:4;20078:6;20021:29;:64::i;:::-;20101:26;;;;;;;;20108:10;;20101:26;;;;;;;;;;8558:1;9462:13;;9446:12;:29;9424:110;;;;;-1:-1:-1;;;9424:110:0;;;;;;;;;;;;;;;;;;;;;;;;;;;17571:29;;;;:::o;22647:360::-;7054:12;:10;:12::i;:::-;22771;;22753:15;:30;22731:168;;;;-1:-1:-1;;;22731:168:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22910:15;:34;;;22960:39;;;;;;;;;;;;;;;;;22647:360;:::o;18833:418::-;18880:7;18904:12;;18920:1;18904:17;18900:77;;;-1:-1:-1;18945:20:0;;18938:27;;18900:77;19007:236;19050:178;19215:12;;19050:138;19183:4;19050:106;19145:10;;19050:68;19103:14;;19050:26;:24;:26::i;:68::-;:94;:106;:94;:106;:::i;:178::-;19007:20;;;:236;:24;:236;:::i;17394:26::-;;;;;;;;;:::o;17277:108::-;17342:42;17277:108;:::o;17607:35::-;;;;:::o;21112:97::-;21167:10;21157:21;;;;:9;:21;;;;;;21148:31;;:8;:31::i;:::-;21190:11;:9;:11::i;:::-;21112:97::o;17460:31::-;;;;:::o;14616:184::-;14674:7;14707:1;14702;:6;;14694:49;;;;;-1:-1:-1;;;14694:49:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;14766:5:0;;;14616:184::o;15051:470::-;15109:7;15353:6;15349:47;;-1:-1:-1;15383:1:0;15376:8;;15349:47;15420:5;;;15424:1;15420;:5;:1;15444:5;;;;;:10;15436:56;;;;-1:-1:-1;;;15436:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15512:1;15051:470;-1:-1:-1;;;15051:470:0:o;15989:333::-;16047:7;16146:1;16142;:5;16134:44;;;;;-1:-1:-1;;;16134:44:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;16189:9;16205:1;16201;:5;;;;;;;15989:333;-1:-1:-1;;;;15989:333:0:o;14160:181::-;14218:7;14250:5;;;14274:6;;;;14266:46;;;;;-1:-1:-1;;;14266:46:0;;;;;;;;;;;;;;;;;;;;;;;;;;;7094:170;7176:5;;;;7162:10;:19;7140:116;;;;-1:-1:-1;;;7140:116:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10192:247;10362:58;;;10385:14;10362:58;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;10362:58:0;;;;;;;;25:18:-1;;61:17;;10362:58:0;182:15:-1;10385:23:0;179:29:-1;160:49;;10309:122:0;;10342:5;;10309:18;:122::i;:::-;10192:247;;;:::o;10447:284::-;10644:68;;;10667:18;10644:68;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;10644:68:0;;;;;;;;25:18:-1;;61:17;;10644:68:0;182:15:-1;10667:27:0;179:29:-1;160:49;;10591:132:0;;10624:5;;10591:18;:132::i;:::-;10447:284;;;;:::o;5850:106::-;5908:7;5939:1;5935;:5;:13;;5947:1;5935:13;;;-1:-1:-1;5943:1:0;;5928:20;-1:-1:-1;5850:106:0:o;12722:1176::-;13326:27;13334:5;13326:25;;;:27::i;:::-;13318:71;;;;;-1:-1:-1;;;13318:71:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;13463:12;13477:23;13512:5;13504:19;;13524:4;13504:25;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;13504:25:0;;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;13462:67:0;;;;13548:7;13540:52;;;;;-1:-1:-1;;;13540:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13609:17;;:21;13605:286;;13782:10;13771:30;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;13771:30:0;13745:134;;;;-1:-1:-1;;;13745:134:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1725:444;2105:20;2153:8;;;1725:444::o

Swarm Source

bzzr://e3390b57ce506a5d1c4f8635541af205a5dcc151ae030bd34c6f664fd560c4dc

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.