ETH Price: $3,636.03 (-2.40%)

Contract

0x3B67fe44216d3e147bA8ccF6E49d2E576441cb10
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw164020702023-01-14 2:31:35688 days ago1673663495IN
0x3B67fe44...76441cb10
0 ETH0.0033453826.5270682
Get Reward130811462021-08-23 10:58:261197 days ago1629716306IN
0x3B67fe44...76441cb10
0 ETH0.0037419136
Withdraw130810992021-08-23 10:47:111197 days ago1629715631IN
0x3B67fe44...76441cb10
0 ETH0.0052807636
Withdraw130810612021-08-23 10:39:501197 days ago1629715190IN
0x3B67fe44...76441cb10
0 ETH0.003645
Get Reward129841332021-08-08 11:20:461212 days ago1628421646IN
0x3B67fe44...76441cb10
0 ETH0.0026118225.12772652
Withdraw129840952021-08-08 11:13:511212 days ago1628421231IN
0x3B67fe44...76441cb10
0 ETH0.0036456724.85325604
Get Reward127022332021-06-25 8:33:441256 days ago1624610024IN
0x3B67fe44...76441cb10
0 ETH0.0013515814.00000145
Withdraw126879422021-06-23 3:02:461258 days ago1624417366IN
0x3B67fe44...76441cb10
0 ETH0.0022003215
Withdraw126707712021-06-20 10:41:131261 days ago1624185673IN
0x3B67fe44...76441cb10
0 ETH0.00334827
Get Reward And S...126694612021-06-20 5:48:281261 days ago1624168108IN
0x3B67fe44...76441cb10
0 ETH0.0015376610
Withdraw126694602021-06-20 5:48:131261 days ago1624168093IN
0x3B67fe44...76441cb10
0 ETH0.00114610
Withdraw126373462021-06-15 6:05:451266 days ago1623737145IN
0x3B67fe44...76441cb10
0 ETH0.0012398810
Get Reward And S...126316842021-06-14 9:10:421267 days ago1623661842IN
0x3B67fe44...76441cb10
0 ETH0.0018591110
Get Reward And S...126130372021-06-11 11:41:421270 days ago1623411702IN
0x3B67fe44...76441cb10
0 ETH0.0017953211
Withdraw126107862021-06-11 3:15:121270 days ago1623381312IN
0x3B67fe44...76441cb10
0 ETH0.0022317818
Get Reward And S...126089592021-06-10 20:30:011270 days ago1623357001IN
0x3B67fe44...76441cb10
0 ETH0.0034454422
Withdraw126059492021-06-10 9:21:161271 days ago1623316876IN
0x3B67fe44...76441cb10
0 ETH0.00198416
Get Reward125779242021-06-06 1:21:441275 days ago1622942504IN
0x3B67fe44...76441cb10
0 ETH0.0019573518
Get Reward125668842021-06-04 8:31:531277 days ago1622795513IN
0x3B67fe44...76441cb10
0 ETH0.0017369418
Withdraw125608942021-06-03 10:03:201278 days ago1622714600IN
0x3B67fe44...76441cb10
0 ETH0.00272822
Get Reward125541682021-06-02 9:18:431279 days ago1622625523IN
0x3B67fe44...76441cb10
0 ETH0.0022651518
Withdraw125528832021-06-02 4:30:031279 days ago1622608203IN
0x3B67fe44...76441cb10
0 ETH0.0035205124
Get Reward125476872021-06-01 9:16:221280 days ago1622538982IN
0x3B67fe44...76441cb10
0 ETH0.0018844919.52
Get Reward125327862021-05-30 1:28:441282 days ago1622338124IN
0x3B67fe44...76441cb10
0 ETH0.0020932819.25000023
Withdraw125323422021-05-29 23:50:231282 days ago1622332223IN
0x3B67fe44...76441cb10
0 ETH0.0017284118.81000023
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CoFiXStakingRewards

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 6666 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-10-12
*/

// SPDX-License-Identifier: GPL-3.0-or-later

/**

Author: CoFiX Core, https://cofix.io
Commit hash: v0.9.5-1-g7141c43
Repository: https://github.com/Computable-Finance/CoFiX
Issues: https://github.com/Computable-Finance/CoFiX/issues

*/

pragma solidity 0.6.12;


// 
/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        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-contracts/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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        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) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// 
// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

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

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

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

// 
/**
 * @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].
 */
contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

// 
interface ICoFiXStakingRewards {
    // Views

    /// @dev The rewards vault contract address set in factory contract
    /// @return Returns the vault address
    function rewardsVault() external view returns (address);

    /// @dev The lastBlock reward applicable
    /// @return Returns the latest block.number on-chain
    function lastBlockRewardApplicable() external view returns (uint256);

    /// @dev Reward amount represents by per staking token
    function rewardPerToken() external view returns (uint256);

    /// @dev How many reward tokens a user has earned but not claimed at present
    /// @param  account The target account
    /// @return The amount of reward tokens a user earned
    function earned(address account) external view returns (uint256);

    /// @dev How many reward tokens accrued recently
    /// @return The amount of reward tokens accrued recently
    function accrued() external view returns (uint256);

    /// @dev Get the latest reward rate of this mining pool (tokens amount per block)
    /// @return The latest reward rate
    function rewardRate() external view returns (uint256);

    /// @dev How many stakingToken (XToken) deposited into to this reward pool (mining pool)
    /// @return The total amount of XTokens deposited in this mining pool
    function totalSupply() external view returns (uint256);

    /// @dev How many stakingToken (XToken) deposited by the target account
    /// @param  account The target account
    /// @return The total amount of XToken deposited in this mining pool
    function balanceOf(address account) external view returns (uint256);

    /// @dev Get the address of token for staking in this mining pool
    /// @return The staking token address
    function stakingToken() external view returns (address);

    /// @dev Get the address of token for rewards in this mining pool
    /// @return The rewards token address
    function rewardsToken() external view returns (address);

    // Mutative

    /// @dev Stake/Deposit into the reward pool (mining pool)
    /// @param  amount The target amount
    function stake(uint256 amount) external;

    /// @dev Stake/Deposit into the reward pool (mining pool) for other account
    /// @param  other The target account
    /// @param  amount The target amount
    function stakeForOther(address other, uint256 amount) external;

    /// @dev Withdraw from the reward pool (mining pool), get the original tokens back
    /// @param  amount The target amount
    function withdraw(uint256 amount) external;

    /// @dev Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw() external;

    /// @dev Claim the reward the user earned
    function getReward() external;

    function getRewardAndStake() external;

    /// @dev User exit the reward pool, it's actually withdraw and getReward
    function exit() external;

    /// @dev Add reward to the mining pool
    function addReward(uint256 amount) external;

    // Events
    event RewardAdded(address sender, uint256 reward);
    event Staked(address indexed user, uint256 amount);
    event StakedForOther(address indexed user, address indexed other, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);
}

// 
interface ICoFiXVaultForLP {

    enum POOL_STATE {INVALID, ENABLED, DISABLED}

    event NewPoolAdded(address pool, uint256 index);
    event PoolEnabled(address pool);
    event PoolDisabled(address pool);

    function setGovernance(address _new) external;
    function setInitCoFiRate(uint256 _new) external;
    function setDecayPeriod(uint256 _new) external;
    function setDecayRate(uint256 _new) external;

    function addPool(address pool) external;
    function enablePool(address pool) external;
    function disablePool(address pool) external;
    function setPoolWeight(address pool, uint256 weight) external;
    function batchSetPoolWeight(address[] memory pools, uint256[] memory weights) external;
    function distributeReward(address to, uint256 amount) external;

    function getPendingRewardOfLP(address pair) external view returns (uint256);
    function currentPeriod() external view returns (uint256);
    function currentCoFiRate() external view returns (uint256);
    function currentPoolRate(address pool) external view returns (uint256 poolRate);
    function currentPoolRateByPair(address pair) external view returns (uint256 poolRate);

    /// @dev Get the award staking pool address of pair (XToken)
    /// @param  pair The address of XToken(pair) contract
    /// @return pool The pool address
    function stakingPoolForPair(address pair) external view returns (address pool);

    function getPoolInfo(address pool) external view returns (POOL_STATE state, uint256 weight);
    function getPoolInfoByPair(address pair) external view returns (POOL_STATE state, uint256 weight);

    function getEnabledPoolCnt() external view returns (uint256);

    function getCoFiStakingPool() external view returns (address pool);

}

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

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

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

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

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

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

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

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

// 
interface ICoFiStakingRewards {
    // Views

    /// @dev Reward amount represents by per staking token
    function rewardPerToken() external view returns (uint256);

    /// @dev How many reward tokens a user has earned but not claimed at present
    /// @param  account The target account
    /// @return The amount of reward tokens a user earned
    function earned(address account) external view returns (uint256);

    /// @dev How many reward tokens accrued recently
    /// @return The amount of reward tokens accrued recently
    function accrued() external view returns (uint256);

    /// @dev How many stakingToken (XToken) deposited into to this reward pool (staking pool)
    /// @return The total amount of XTokens deposited in this staking pool
    function totalSupply() external view returns (uint256);

    /// @dev How many stakingToken (XToken) deposited by the target account
    /// @param  account The target account
    /// @return The total amount of XToken deposited in this staking pool
    function balanceOf(address account) external view returns (uint256);

    /// @dev Get the address of token for staking in this staking pool
    /// @return The staking token address
    function stakingToken() external view returns (address);

    /// @dev Get the address of token for rewards in this staking pool
    /// @return The rewards token address
    function rewardsToken() external view returns (address);

    // Mutative

    /// @dev Stake/Deposit into the reward pool (staking pool)
    /// @param  amount The target amount
    function stake(uint256 amount) external;

    /// @dev Stake/Deposit into the reward pool (staking pool) for other account
    /// @param  other The target account
    /// @param  amount The target amount
    function stakeForOther(address other, uint256 amount) external;

    /// @dev Withdraw from the reward pool (staking pool), get the original tokens back
    /// @param  amount The target amount
    function withdraw(uint256 amount) external;
    
    /// @dev Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw() external;

    /// @dev Claim the reward the user earned
    function getReward() external;

    /// @dev Add ETH reward to the staking pool
    function addETHReward() external payable;

    /// @dev User exit the reward pool, it's actually withdraw and getReward
    function exit() external;

    // Events
    event Staked(address indexed user, uint256 amount);
    event StakedForOther(address indexed user, address indexed other, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event SavingWithdrawn(address indexed to, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);
    
}

// 
interface ICoFiXFactory {
    // All pairs: {ETH <-> ERC20 Token}
    event PairCreated(address indexed token, address pair, uint256);
    event NewGovernance(address _new);
    event NewController(address _new);
    event NewFeeReceiver(address _new);
    event NewFeeVaultForLP(address token, address feeVault);
    event NewVaultForLP(address _new);
    event NewVaultForTrader(address _new);
    event NewVaultForCNode(address _new);

    /// @dev Create a new token pair for trading
    /// @param  token the address of token to trade
    /// @return pair the address of new token pair
    function createPair(
        address token
        )
        external
        returns (address pair);

    function getPair(address token) external view returns (address pair);
    function allPairs(uint256) external view returns (address pair);
    function allPairsLength() external view returns (uint256);

    function getTradeMiningStatus(address token) external view returns (bool status);
    function setTradeMiningStatus(address token, bool status) external;
    function getFeeVaultForLP(address token) external view returns (address feeVault); // for LPs
    function setFeeVaultForLP(address token, address feeVault) external;

    function setGovernance(address _new) external;
    function setController(address _new) external;
    function setFeeReceiver(address _new) external;
    function setVaultForLP(address _new) external;
    function setVaultForTrader(address _new) external;
    function setVaultForCNode(address _new) external;
    function getController() external view returns (address controller);
    function getFeeReceiver() external view returns (address feeReceiver); // For CoFi Holders
    function getVaultForLP() external view returns (address vaultForLP);
    function getVaultForTrader() external view returns (address vaultForTrader);
    function getVaultForCNode() external view returns (address vaultForCNode);
}

// 
// Stake XToken to earn CoFi Token
contract CoFiXStakingRewards is ICoFiXStakingRewards, ReentrancyGuard {
    using SafeMath for uint256;

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

    address public override immutable rewardsToken; // CoFi
    address public override immutable stakingToken; // XToken or CNode

    address public immutable factory;

    uint256 public lastUpdateBlock;
    uint256 public rewardPerTokenStored;

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

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

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

    constructor(
        address _rewardsToken,
        address _stakingToken,
        address _factory
    ) public {
        rewardsToken = _rewardsToken;
        stakingToken = _stakingToken;
        require(ICoFiXFactory(_factory).getVaultForLP() != address(0), "VaultForLP not set yet"); // check
        factory = _factory;
        lastUpdateBlock = 11040688; // https://etherscan.io/block/countdown/11040688    
    }

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

    // replace cofixVault with rewardsVault, this could introduce more calls, but clear is more important 
    function rewardsVault() public virtual override view returns (address) {
        return ICoFiXFactory(factory).getVaultForLP();
    }

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

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

    function lastBlockRewardApplicable() public override view returns (uint256) {
        return block.number;
    }

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

    function _rewardPerTokenAndAccrued() internal view returns (uint256, uint256) {
        if (_totalSupply == 0) {
            // use the old rewardPerTokenStored, and accrued should be zero here
            // if not the new accrued amount will never be distributed to anyone
            return (rewardPerTokenStored, 0);
        }
        uint256 _accrued = accrued();
        uint256 _rewardPerToken = rewardPerTokenStored.add(
                _accrued.mul(1e18).div(_totalSupply)
            );
        return (_rewardPerToken, _accrued);
    }

    function rewardRate() public virtual override view returns (uint256) {
        return ICoFiXVaultForLP(rewardsVault()).currentPoolRate(address(this));
    }

    function accrued() public virtual override view returns (uint256) {
        // calc block rewards
        uint256 blockReward = lastBlockRewardApplicable().sub(lastUpdateBlock).mul(rewardRate());
        // query pair trading rewards
        uint256 tradingReward = ICoFiXVaultForLP(rewardsVault()).getPendingRewardOfLP(stakingToken);
        return blockReward.add(tradingReward);
    }

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

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

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

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

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

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw() external override nonReentrant {
        uint256 amount = _balances[msg.sender];
        require(amount > 0, "Cannot withdraw 0");
        _totalSupply = _totalSupply.sub(amount);
        _balances[msg.sender] = 0;
        rewards[msg.sender] = 0;
        TransferHelper.safeTransfer(stakingToken, msg.sender, amount);
        emit EmergencyWithdraw(msg.sender, amount);
    }

    function getReward() public override nonReentrant updateReward(msg.sender) {
        uint256 reward = rewards[msg.sender];
        if (reward > 0) {
            rewards[msg.sender] = 0;
            // TransferHelper.safeTransfer(rewardsToken, msg.sender, reward);
            uint256 transferred = _safeCoFiTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, transferred);
        }
    }

    // get CoFi rewards and staking into CoFiStakingRewards pool
    function getRewardAndStake() external override nonReentrant updateReward(msg.sender) {
        uint256 reward = rewards[msg.sender];
        if (reward > 0) {
            rewards[msg.sender] = 0;
            address cofiStakingPool = ICoFiXVaultForLP(rewardsVault()).getCoFiStakingPool(); // also work for VaultForCNode
            require(cofiStakingPool != address(0), "cofiStakingPool not set");
            // approve to staking pool
            address _rewardsToken = rewardsToken;
            IERC20(_rewardsToken).approve(cofiStakingPool, reward);
            ICoFiStakingRewards(cofiStakingPool).stakeForOther(msg.sender, reward);
            IERC20(_rewardsToken).approve(cofiStakingPool, 0); // ensure
            emit RewardPaid(msg.sender, reward);
        }
    }

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

    // add reward from trading pool or anyone else
    function addReward(uint256 amount) public override nonReentrant updateReward(address(0)) {
        // transfer from caller (router contract)
        TransferHelper.safeTransferFrom(rewardsToken, msg.sender, address(this), amount);
        // update rewardPerTokenStored
        rewardPerTokenStored = rewardPerTokenStored.add(amount.mul(1e18).div(_totalSupply));
        emit RewardAdded(msg.sender, amount);
    }

    // Safe CoFi transfer function, just in case if rounding error or ending of mining causes pool to not have enough CoFis.
    function _safeCoFiTransfer(address _to, uint256 _amount) internal returns (uint256) {
        uint256 cofiBal = IERC20(rewardsToken).balanceOf(address(this));
        if (_amount > cofiBal) {
            _amount = cofiBal;
        }
        TransferHelper.safeTransfer(rewardsToken, _to, _amount); // allow zero amount
        return _amount;
    }

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

    modifier updateReward(address account) virtual {
        // rewardPerTokenStored = rewardPerToken();
        // uint256 newAccrued = accrued();
        (uint256 newRewardPerToken, uint256 newAccrued) = _rewardPerTokenAndAccrued();
        rewardPerTokenStored = newRewardPerToken;
        if (newAccrued > 0) {
            // distributeReward could fail if CoFiXVaultForLP is not minter of CoFi anymore
            // Should set reward rate to zero first, and then do a settlement of pool reward by call getReward
            ICoFiXVaultForLP(rewardsVault()).distributeReward(address(this), newAccrued);
        } 
        lastUpdateBlock = lastBlockRewardApplicable();
        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
        }
        _;
    }

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

    event RewardAdded(address sender, uint256 reward);
    event Staked(address indexed user, uint256 amount);
    event StakedForOther(address indexed user, address indexed other, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"address","name":"_factory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"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":"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":true,"internalType":"address","name":"other","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakedForOther","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"accrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getRewardAndStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastBlockRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"other","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeForOther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"address","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"}]

60e060405234801561001057600080fd5b50604051611f92380380611f928339818101604052606081101561003357600080fd5b508051602080830151604093840151600160009081556001600160601b0319606086811b821660805284901b1660a052855163696bfc0b60e11b8152955194959294919390926001600160a01b0385169263d2d7f81692600480840193919291829003018186803b1580156100a757600080fd5b505afa1580156100bb573d6000803e3d6000fd5b505050506040513d60208110156100d157600080fd5b50516001600160a01b0316141561012f576040805162461bcd60e51b815260206004820152601660248201527f5661756c74466f724c50206e6f74207365742079657400000000000000000000604482015290519081900360640190fd5b6001600160601b031960609190911b1660c052505062a877b060015560805160601c60a05160601c60c05160601c611de06101b260003980610c1552806112435250806109f35280610cba5280610f5c52806111d552806113b2528061162552508061065e5280610e20528061129f52806119e85280611a925250611de06000f3fe608060405234801561001057600080fd5b506004361061018c5760003560e01c80638b876347116100e3578063cd3daf9d1161008c578063df136d6511610066578063df136d6514610318578063e9fad8ee14610320578063fe72bd01146103285761018c565b8063cd3daf9d14610300578063d1af0c7d14610308578063db2e21bc146103105761018c565b8063a694fc3a116100bd578063a694fc3a146102d3578063abe0429c146102f0578063c45a0155146102f85761018c565b80638b8763471461029d578063a07e52a2146102c3578063a218141b146102cb5761018c565b80633d18b9121161014557806372f702f31161011f57806372f702f31461027057806374de4ec4146102785780637b0a47ee146102955761018c565b80633d18b9121461021e5780635579ed011461022657806370a082311461024a5761018c565b806318160ddd1161017657806318160ddd146101ef57806327e63443146101f75780632e1a7d4d146102015761018c565b80628cc262146101915780630700037d146101c9575b600080fd5b6101b7600480360360208110156101a757600080fd5b50356001600160a01b0316610354565b60408051918252519081900360200190f35b6101b7600480360360208110156101df57600080fd5b50356001600160a01b03166103d2565b6101b76103e4565b6101ff6103eb565b005b6101ff6004803603602081101561021757600080fd5b503561081b565b6101ff610a5a565b61022e610c11565b604080516001600160a01b039092168252519081900360200190f35b6101b76004803603602081101561026057600080fd5b50356001600160a01b0316610c9d565b61022e610cb8565b6101ff6004803603602081101561028e57600080fd5b5035610cdc565b6101b7610eb6565b6101b7600480360360208110156102b357600080fd5b50356001600160a01b0316610f0c565b6101b7610f1e565b6101b7610ff7565b6101ff600480360360208110156102e957600080fd5b5035610ffd565b6101b761123d565b61022e611241565b6101b7611265565b61022e61129d565b6101ff6112c1565b6101b7611416565b6101ff61141c565b6101ff6004803603604081101561033e57600080fd5b506001600160a01b03813516906020013561143f565b6001600160a01b03811660009081526004602090815260408083205460039092528220546103cc91906103c690670de0b6b3a7640000906103c0906103a19061039b611265565b90611698565b6001600160a01b038816600090815260066020526040902054906116e1565b9061173a565b9061177c565b92915050565b60046020526000908152604090205481565b6005545b90565b60026000541415610443576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081553390806104556117d6565b6002829055909250905080156104dc5761046d610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156104c357600080fd5b505af11580156104d7573d6000803e3d6000fd5b505050505b6104e461123d565b6001556001600160a01b0383161561052b576104ff83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b3360009081526004602052604090205480156108105733600090815260046020526040812081905561055b610c11565b6001600160a01b031663af1734ac6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059357600080fd5b505afa1580156105a7573d6000803e3d6000fd5b505050506040513d60208110156105bd57600080fd5b505190506001600160a01b03811661061c576040805162461bcd60e51b815260206004820152601760248201527f636f66695374616b696e67506f6f6c206e6f7420736574000000000000000000604482015290519081900360640190fd5b604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820185905291517f00000000000000000000000000000000000000000000000000000000000000009283169163095ea7b39160448083019260209291908290030181600087803b1580156106a857600080fd5b505af11580156106bc573d6000803e3d6000fd5b505050506040513d60208110156106d257600080fd5b5050604080517ffe72bd010000000000000000000000000000000000000000000000000000000081523360048201526024810185905290516001600160a01b0384169163fe72bd0191604480830192600092919082900301818387803b15801561073b57600080fd5b505af115801561074f573d6000803e3d6000fd5b50505050806001600160a01b031663095ea7b38360006040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b505050506040513d60208110156107d557600080fd5b505060408051848152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a250505b505060016000555050565b60026000541415610873576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081553390806108856117d6565b60028290559092509050801561090c5761089d610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156108f357600080fd5b505af1158015610907573d6000803e3d6000fd5b505050505b61091461123d565b6001556001600160a01b0383161561095b5761092f83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b600084116109b0576040805162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b6005546109bd9085611698565b600555336000908152600660205260409020546109da9085611698565b33600081815260066020526040902091909155610a19907f0000000000000000000000000000000000000000000000000000000000000000908661182d565b60408051858152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a2505060016000555050565b60026000541415610ab2576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155339080610ac46117d6565b600282905590925090508015610b4b57610adc610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050505b610b5361123d565b6001556001600160a01b03831615610b9a57610b6e83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b3360009081526004602052604090205480156108105733600081815260046020526040812081905590610bcd90836119e3565b60408051828152905191925033917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869181900360200190a250505060016000555050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d2d7f8166040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6c57600080fd5b505afa158015610c80573d6000803e3d6000fd5b505050506040513d6020811015610c9657600080fd5b5051905090565b6001600160a01b031660009081526006602052604090205490565b7f000000000000000000000000000000000000000000000000000000000000000081565b60026000541415610d34576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081558080610d456117d6565b600282905590925090508015610dcc57610d5d610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610db357600080fd5b505af1158015610dc7573d6000803e3d6000fd5b505050505b610dd461123d565b6001556001600160a01b03831615610e1b57610def83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b610e477f0000000000000000000000000000000000000000000000000000000000000000333087611ac0565b600554610e6d90610e64906103c087670de0b6b3a76400006116e1565b6002549061177c565b600255604080513381526020810186905281517fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e29929181900390910190a1505060016000555050565b6000610ec0610c11565b6001600160a01b031663643a8b24306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610c6c57600080fd5b60036020526000908152604090205481565b600080610f40610f2c610eb6565b610f3a60015461039b61123d565b906116e1565b90506000610f4c610c11565b6001600160a01b031663a66771db7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fb857600080fd5b505afa158015610fcc573d6000803e3d6000fd5b505050506040513d6020811015610fe257600080fd5b50519050610ff0828261177c565b9250505090565b60015481565b60026000541415611055576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081553390806110676117d6565b6002829055909250905080156110ee5761107f610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156110d557600080fd5b505af11580156110e9573d6000803e3d6000fd5b505050505b6110f661123d565b6001556001600160a01b0383161561113d5761111183610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b60008411611192576040805162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b60055461119f908561177c565b600555336000908152600660205260409020546111bc908561177c565b336000818152600660205260409020919091556111fc907f0000000000000000000000000000000000000000000000000000000000000000903087611ac0565b60408051858152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a2505060016000555050565b4390565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006005546000141561127b57506002546103e8565b611298610e646005546103c0670de0b6b3a7640000610f3a610f1e565b905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b60026000541415611319576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155338152600660205260409020548061137f576040805162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b60055461138c9082611698565b60055533600081815260066020908152604080832083905560049091528120556113d8907f0000000000000000000000000000000000000000000000000000000000000000908361182d565b60408051828152905133917f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695919081900360200190a2506001600055565b60025481565b336000908152600660205260409020546114359061081b565b61143d610a5a565b565b60026000541415611497576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081558290806114a96117d6565b600282905590925090508015611530576114c1610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561151757600080fd5b505af115801561152b573d6000803e3d6000fd5b505050505b61153861123d565b6001556001600160a01b0383161561157f5761155383610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b600084116115d4576040805162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b6005546115e1908561177c565b6005556001600160a01b038516600090815260066020526040902054611607908561177c565b6001600160a01b03861660009081526006602052604090205561164c7f0000000000000000000000000000000000000000000000000000000000000000333087611ac0565b6040805185815290516001600160a01b0387169133917ff6709c821eb43e8e9953ad8ac910b4591a380ae9f014d75ce7d7a2a34299e0ef9181900360200190a350506001600055505050565b60006116da83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c69565b9392505050565b6000826116f0575060006103cc565b828202828482816116fd57fe5b04146116da5760405162461bcd60e51b8152600401808060200182810382526021815260200180611d666021913960400191505060405180910390fd5b60006116da83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611d00565b6000828201838110156116da576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600080600554600014156117f05750506002546000611829565b60006117fa610f1e565b90506000611822610e646005546103c0670de0b6b3a7640000866116e190919063ffffffff16565b9350909150505b9091565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b602083106118f657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118b9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611958576040519150601f19603f3d011682016040523d82523d6000602084013e61195d565b606091505b509150915081801561198b57508051158061198b575080806020019051602081101561198857600080fd5b50515b6119dc576040805162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b5050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611a5357600080fd5b505afa158015611a67573d6000803e3d6000fd5b505050506040513d6020811015611a7d57600080fd5b5051905080831115611a8d578092505b611ab87f0000000000000000000000000000000000000000000000000000000000000000858561182d565b509092915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b60208310611b9157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611b54565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611bf3576040519150601f19603f3d011682016040523d82523d6000602084013e611bf8565b606091505b5091509150818015611c26575080511580611c265750808060200190516020811015611c2357600080fd5b50515b611c615760405162461bcd60e51b8152600401808060200182810382526024815260200180611d876024913960400191505060405180910390fd5b505050505050565b60008184841115611cf85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611cbd578181015183820152602001611ca5565b50505050905090810190601f168015611cea5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611d4f5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611cbd578181015183820152602001611ca5565b506000838581611d5b57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544a264697066735822122029434a061ef3a1af10e3b8271f5c6f1f3a29663a852160d590ac645867308d1f64736f6c634300060c00330000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea1000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d00000000000000000000000066c64ecc3a6014733325a8f2ebee46b4ca3ed550

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061018c5760003560e01c80638b876347116100e3578063cd3daf9d1161008c578063df136d6511610066578063df136d6514610318578063e9fad8ee14610320578063fe72bd01146103285761018c565b8063cd3daf9d14610300578063d1af0c7d14610308578063db2e21bc146103105761018c565b8063a694fc3a116100bd578063a694fc3a146102d3578063abe0429c146102f0578063c45a0155146102f85761018c565b80638b8763471461029d578063a07e52a2146102c3578063a218141b146102cb5761018c565b80633d18b9121161014557806372f702f31161011f57806372f702f31461027057806374de4ec4146102785780637b0a47ee146102955761018c565b80633d18b9121461021e5780635579ed011461022657806370a082311461024a5761018c565b806318160ddd1161017657806318160ddd146101ef57806327e63443146101f75780632e1a7d4d146102015761018c565b80628cc262146101915780630700037d146101c9575b600080fd5b6101b7600480360360208110156101a757600080fd5b50356001600160a01b0316610354565b60408051918252519081900360200190f35b6101b7600480360360208110156101df57600080fd5b50356001600160a01b03166103d2565b6101b76103e4565b6101ff6103eb565b005b6101ff6004803603602081101561021757600080fd5b503561081b565b6101ff610a5a565b61022e610c11565b604080516001600160a01b039092168252519081900360200190f35b6101b76004803603602081101561026057600080fd5b50356001600160a01b0316610c9d565b61022e610cb8565b6101ff6004803603602081101561028e57600080fd5b5035610cdc565b6101b7610eb6565b6101b7600480360360208110156102b357600080fd5b50356001600160a01b0316610f0c565b6101b7610f1e565b6101b7610ff7565b6101ff600480360360208110156102e957600080fd5b5035610ffd565b6101b761123d565b61022e611241565b6101b7611265565b61022e61129d565b6101ff6112c1565b6101b7611416565b6101ff61141c565b6101ff6004803603604081101561033e57600080fd5b506001600160a01b03813516906020013561143f565b6001600160a01b03811660009081526004602090815260408083205460039092528220546103cc91906103c690670de0b6b3a7640000906103c0906103a19061039b611265565b90611698565b6001600160a01b038816600090815260066020526040902054906116e1565b9061173a565b9061177c565b92915050565b60046020526000908152604090205481565b6005545b90565b60026000541415610443576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081553390806104556117d6565b6002829055909250905080156104dc5761046d610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156104c357600080fd5b505af11580156104d7573d6000803e3d6000fd5b505050505b6104e461123d565b6001556001600160a01b0383161561052b576104ff83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b3360009081526004602052604090205480156108105733600090815260046020526040812081905561055b610c11565b6001600160a01b031663af1734ac6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059357600080fd5b505afa1580156105a7573d6000803e3d6000fd5b505050506040513d60208110156105bd57600080fd5b505190506001600160a01b03811661061c576040805162461bcd60e51b815260206004820152601760248201527f636f66695374616b696e67506f6f6c206e6f7420736574000000000000000000604482015290519081900360640190fd5b604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526024820185905291517f0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea19283169163095ea7b39160448083019260209291908290030181600087803b1580156106a857600080fd5b505af11580156106bc573d6000803e3d6000fd5b505050506040513d60208110156106d257600080fd5b5050604080517ffe72bd010000000000000000000000000000000000000000000000000000000081523360048201526024810185905290516001600160a01b0384169163fe72bd0191604480830192600092919082900301818387803b15801561073b57600080fd5b505af115801561074f573d6000803e3d6000fd5b50505050806001600160a01b031663095ea7b38360006040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156107ab57600080fd5b505af11580156107bf573d6000803e3d6000fd5b505050506040513d60208110156107d557600080fd5b505060408051848152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a250505b505060016000555050565b60026000541415610873576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081553390806108856117d6565b60028290559092509050801561090c5761089d610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156108f357600080fd5b505af1158015610907573d6000803e3d6000fd5b505050505b61091461123d565b6001556001600160a01b0383161561095b5761092f83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b600084116109b0576040805162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b6005546109bd9085611698565b600555336000908152600660205260409020546109da9085611698565b33600081815260066020526040902091909155610a19907f000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d908661182d565b60408051858152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a2505060016000555050565b60026000541415610ab2576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155339080610ac46117d6565b600282905590925090508015610b4b57610adc610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050505b610b5361123d565b6001556001600160a01b03831615610b9a57610b6e83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b3360009081526004602052604090205480156108105733600081815260046020526040812081905590610bcd90836119e3565b60408051828152905191925033917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04869181900360200190a250505060016000555050565b60007f00000000000000000000000066c64ecc3a6014733325a8f2ebee46b4ca3ed5506001600160a01b031663d2d7f8166040518163ffffffff1660e01b815260040160206040518083038186803b158015610c6c57600080fd5b505afa158015610c80573d6000803e3d6000fd5b505050506040513d6020811015610c9657600080fd5b5051905090565b6001600160a01b031660009081526006602052604090205490565b7f000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d81565b60026000541415610d34576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081558080610d456117d6565b600282905590925090508015610dcc57610d5d610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610db357600080fd5b505af1158015610dc7573d6000803e3d6000fd5b505050505b610dd461123d565b6001556001600160a01b03831615610e1b57610def83610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b610e477f0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea1333087611ac0565b600554610e6d90610e64906103c087670de0b6b3a76400006116e1565b6002549061177c565b600255604080513381526020810186905281517fac24935fd910bc682b5ccb1a07b718cadf8cf2f6d1404c4f3ddc3662dae40e29929181900390910190a1505060016000555050565b6000610ec0610c11565b6001600160a01b031663643a8b24306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610c6c57600080fd5b60036020526000908152604090205481565b600080610f40610f2c610eb6565b610f3a60015461039b61123d565b906116e1565b90506000610f4c610c11565b6001600160a01b031663a66771db7f000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fb857600080fd5b505afa158015610fcc573d6000803e3d6000fd5b505050506040513d6020811015610fe257600080fd5b50519050610ff0828261177c565b9250505090565b60015481565b60026000541415611055576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081553390806110676117d6565b6002829055909250905080156110ee5761107f610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156110d557600080fd5b505af11580156110e9573d6000803e3d6000fd5b505050505b6110f661123d565b6001556001600160a01b0383161561113d5761111183610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b60008411611192576040805162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b60055461119f908561177c565b600555336000908152600660205260409020546111bc908561177c565b336000818152600660205260409020919091556111fc907f000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d903087611ac0565b60408051858152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a2505060016000555050565b4390565b7f00000000000000000000000066c64ecc3a6014733325a8f2ebee46b4ca3ed55081565b60006005546000141561127b57506002546103e8565b611298610e646005546103c0670de0b6b3a7640000610f3a610f1e565b905090565b7f0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea181565b60026000541415611319576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026000908155338152600660205260409020548061137f576040805162461bcd60e51b815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b60055461138c9082611698565b60055533600081815260066020908152604080832083905560049091528120556113d8907f000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d908361182d565b60408051828152905133917f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695919081900360200190a2506001600055565b60025481565b336000908152600660205260409020546114359061081b565b61143d610a5a565b565b60026000541415611497576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600260009081558290806114a96117d6565b600282905590925090508015611530576114c1610c11565b6001600160a01b0316631ec8bb8c30836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b15801561151757600080fd5b505af115801561152b573d6000803e3d6000fd5b505050505b61153861123d565b6001556001600160a01b0383161561157f5761155383610354565b6001600160a01b0384166000908152600460209081526040808320939093556002546003909152919020555b600084116115d4576040805162461bcd60e51b815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b6005546115e1908561177c565b6005556001600160a01b038516600090815260066020526040902054611607908561177c565b6001600160a01b03861660009081526006602052604090205561164c7f000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d333087611ac0565b6040805185815290516001600160a01b0387169133917ff6709c821eb43e8e9953ad8ac910b4591a380ae9f014d75ce7d7a2a34299e0ef9181900360200190a350506001600055505050565b60006116da83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c69565b9392505050565b6000826116f0575060006103cc565b828202828482816116fd57fe5b04146116da5760405162461bcd60e51b8152600401808060200182810382526021815260200180611d666021913960400191505060405180910390fd5b60006116da83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611d00565b6000828201838110156116da576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600080600554600014156117f05750506002546000611829565b60006117fa610f1e565b90506000611822610e646005546103c0670de0b6b3a7640000866116e190919063ffffffff16565b9350909150505b9091565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b602083106118f657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118b9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611958576040519150601f19603f3d011682016040523d82523d6000602084013e61195d565b606091505b509150915081801561198b57508051158061198b575080806020019051602081101561198857600080fd5b50515b6119dc576040805162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b5050505050565b6000807f0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea16001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015611a5357600080fd5b505afa158015611a67573d6000803e3d6000fd5b505050506040513d6020811015611a7d57600080fd5b5051905080831115611a8d578092505b611ab87f0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea1858561182d565b509092915050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b60208310611b9157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611b54565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611bf3576040519150601f19603f3d011682016040523d82523d6000602084013e611bf8565b606091505b5091509150818015611c26575080511580611c265750808060200190516020811015611c2357600080fd5b50515b611c615760405162461bcd60e51b8152600401808060200182810382526024815260200180611d876024913960400191505060405180910390fd5b505050505050565b60008184841115611cf85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611cbd578181015183820152602001611ca5565b50505050905090810190601f168015611cea5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611d4f5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611cbd578181015183820152602001611ca5565b506000838581611d5b57fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544a264697066735822122029434a061ef3a1af10e3b8271f5c6f1f3a29663a852160d590ac645867308d1f64736f6c634300060c0033

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

0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea1000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d00000000000000000000000066c64ecc3a6014733325a8f2ebee46b4ca3ed550

-----Decoded View---------------
Arg [0] : _rewardsToken (address): 0x1a23a6BfBAdB59fa563008c0fB7cf96dfCF34Ea1
Arg [1] : _stakingToken (address): 0xb2b7BeDd7d7fc19804C7Dd4a4E8174C4c73C210d
Arg [2] : _factory (address): 0x66C64ecC3A6014733325a8f2EBEE46B4CA3ED550

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000001a23a6bfbadb59fa563008c0fb7cf96dfcf34ea1
Arg [1] : 000000000000000000000000b2b7bedd7d7fc19804c7dd4a4e8174c4c73c210d
Arg [2] : 00000000000000000000000066c64ecc3a6014733325a8f2ebee46b4ca3ed550


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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