ETH Price: $1,643.58 (+2.69%)
Gas: 16 Gwei
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
Value
0x60806040111951542020-11-05 4:52:131057 days 10 hrs ago1604551933IN
 Create: RewardDistributionFactory
0 ETH0.0668851833.73208163

Latest 1 internal transaction

Advanced mode:
Advanced Filter
Parent Txn Hash Block From To Value
111953422020-11-05 5:38:541057 days 10 hrs ago1604554734
Kp2r Network: Reward Distribution
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RewardDistributionFactory

Compiler Version
v0.5.17+commit.d19bba13

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-11-05
*/

// SPDX-License-Identifier: MIT


/**
 * KP2R.NETWORK
 * A standard implementation of kp3rv1 protocol
 * Optimized Dapp
 * Scalability
 * Clean & tested code
 */


pragma solidity ^0.5.17;

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

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

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

/**
 * @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(uint a, uint b) internal pure returns (uint) {
        uint 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(uint a, uint b) internal pure returns (uint) {
        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.
     *
     * _Available since v2.4.0._
     */
    function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
        require(b <= a, errorMessage);
        uint 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(uint a, uint b) internal pure returns (uint) {
        // 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;
        }

        uint 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(uint a, uint b) internal pure returns (uint) {
        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.
     *
     * _Available since v2.4.0._
     */
    function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
        // Solidity only automatically asserts when dividing by 0
        require(b > 0, errorMessage);
        uint 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(uint a, uint b) internal pure returns (uint) {
        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.
     *
     * _Available since v2.4.0._
     */
    function mod(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

/**
 * @dev Interface of the ERC20 standard as defined in the EIP. Does not include
 * the optional functions; to access them see {ERC20Detailed}.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint);

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

    /**
     * @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, uint 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 (uint);

    /**
     * @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, uint 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, uint 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, uint 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, uint value);
}

/**
 * @dev Collection of functions related to the address type
 */
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.
     *
     * IMPORTANT: It is unsafe to assume that an address for which this
     * function returns false is an externally-owned account (EOA) and not a
     * contract.
     */
    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.

        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != 0x0 && codehash != accountHash);
    }

    /**
     * @dev Converts an `address` into `address payable`. Note that this is
     * simply a type cast: the actual underlying value is not changed.
     *
     * _Available since v2.4.0._
     */
    function toPayable(address account) internal pure returns (address payable) {
        return address(uint160(account));
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     *
     * _Available since v2.4.0._
     */
    function sendValue(address payable recipient, uint amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-call-value
        (bool success, ) = recipient.call.value(amount)("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }
}

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using SafeMath for uint;
    using Address for address;

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

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

    function safeApprove(IERC20 token, address spender, uint 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, uint value) internal {
        uint newAllowance = token.allowance(address(this), spender).add(value);
        callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint value) internal {
        uint newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        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");
        }
    }
}

contract IRewardDistributionRecipient {
    address rewardDistribution;

    function notifyRewardAmount(uint reward) external;

    modifier onlyRewardDistribution() {
        require(msg.sender == rewardDistribution, "Caller is not reward distribution");
        _;
    }
}

contract LPTokenDelegate {
    using SafeMath for uint;
    using SafeERC20 for IERC20;

    IERC20 public lp;
    
    /// @notice EIP-20 token name for this token
    string public name;

    /// @notice EIP-20 token symbol for this token
    string public symbol;

    /// @notice EIP-20 token decimals for this token
    uint8 public decimals;
    
    /// @notice A record of each accounts delegate
    mapping (address => address) public delegates;
    
    /// @notice A record of votes checkpoints for each account, by index
    mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;

    /// @notice The number of checkpoints for each account
    mapping (address => uint32) public numCheckpoints;

    /// @notice The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint chainId,address verifyingContract)");

    /// @notice The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint nonce,uint expiry)");

    /// @notice A record of states for signing / validating signatures
    mapping (address => uint) public nonces;

    /// @notice An event thats emitted when an account changes its delegate
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /// @notice An event thats emitted when a delegate account's vote balance changes
    event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
    
    /// @notice A checkpoint for marking number of votes from a given block
    struct Checkpoint {
        uint32 fromBlock;
        uint votes;
    }
    
    /**
     * @notice Delegate votes from `msg.sender` to `delegatee`
     * @param delegatee The address to delegate votes to
     */
    function delegate(address delegatee) public {
        return _delegate(msg.sender, delegatee);
    }
    
    /**
     * @notice Delegates votes from signatory to `delegatee`
     * @param delegatee The address to delegate votes to
     * @param nonce The contract state required to match the signature
     * @param expiry The time at which to expire the signature
     * @param v The recovery byte of the signature
     * @param r Half of the ECDSA signature pair
     * @param s Half of the ECDSA signature pair
     */
    function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "::delegateBySig: invalid signature");
        require(nonce == nonces[signatory]++, "::delegateBySig: invalid nonce");
        require(now <= expiry, "::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

    /**
     * @notice Gets the current votes balance for `account`
     * @param account The address to get votes balance
     * @return The number of current votes for `account`
     */
    function getCurrentVotes(address account) external view returns (uint) {
        uint32 nCheckpoints = numCheckpoints[account];
        return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

    /**
     * @notice Determine the prior number of votes for an account as of a block number
     * @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
     * @param account The address of the account to check
     * @param blockNumber The block number to get the vote balance at
     * @return The number of votes the account had as of the given block
     */
    function getPriorVotes(address account, uint blockNumber) public view returns (uint) {
        require(blockNumber < block.number, "::getPriorVotes: not yet determined");

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }

    function _delegate(address delegator, address delegatee) internal {
        address currentDelegate = delegates[delegator];
        uint delegatorBalance = _balances[delegator];
        delegates[delegator] = delegatee;

        emit DelegateChanged(delegator, currentDelegate, delegatee);

        _moveDelegates(currentDelegate, delegatee, delegatorBalance);
    }

    function _moveDelegates(address srcRep, address dstRep, uint amount) internal {
        if (srcRep != dstRep && amount > 0) {
            if (srcRep != address(0)) {
                uint32 srcRepNum = numCheckpoints[srcRep];
                uint srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
                uint srcRepNew = srcRepOld.sub(amount, "::_moveVotes: vote amount underflows");
                _writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
            }

            if (dstRep != address(0)) {
                uint32 dstRepNum = numCheckpoints[dstRep];
                uint dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
                uint dstRepNew = dstRepOld.add(amount);
                _writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
            }
        }
    }

    function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint oldVotes, uint newVotes) internal {
      uint32 blockNumber = safe32(block.number, "::_writeCheckpoint: block number exceeds 32 bits");

      if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
          checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
      } else {
          checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
          numCheckpoints[delegatee] = nCheckpoints + 1;
      }

      emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
    }

    function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
        require(n < 2**32, errorMessage);
        return uint32(n);
    }

    function getChainId() internal pure returns (uint) {
        uint chainId;
        assembly { chainId := chainid() }
        return chainId;
    }

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

    function totalSupply() public view returns (uint) {
        return _totalSupply;
    }

    function balanceOf(address account) public view returns (uint) {
        return _balances[account];
    }

    function stake(uint amount) public {
        _totalSupply = _totalSupply.add(amount);
        _balances[msg.sender] = _balances[msg.sender].add(amount);
        lp.safeTransferFrom(msg.sender, address(this), amount);
    }

    function withdraw(uint amount) public {
        _totalSupply = _totalSupply.sub(amount);
        _balances[msg.sender] = _balances[msg.sender].sub(amount);
        lp.safeTransfer(msg.sender, amount);
    }
}

contract RewardDistributionVoter is LPTokenDelegate, IRewardDistributionRecipient {
    IERC20 public earn;
    uint public constant DURATION = 7 days;

    uint public periodFinish = 0;
    uint public rewardRate = 0;
    uint public lastUpdateTime;
    uint public rewardPerTokenStored;
    mapping(address => uint) public userRewardPerTokenPaid;
    mapping(address => uint) public rewards;

    event RewardAdded(uint reward);
    event Staked(address indexed user, uint amount);
    event Withdrawn(address indexed user, uint amount);
    event RewardPaid(address indexed user, uint reward);

    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = lastTimeRewardApplicable();
        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
        }
        _;
    }
    
    constructor(
        IERC20 lp_, 
        IERC20 earn_, 
        address rewardDistribution_,
        uint8 decimals_,
        string memory name_,
        string memory symbol_
    ) public {
        lp = lp_;
        earn = earn_;
        rewardDistribution = rewardDistribution_;
        decimals = decimals_;
        name = name_;
        symbol = symbol_;
    }

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

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

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

    // stake visibility is public as overriding LPTokenWrapper's stake() function
    function stake(uint amount) public updateReward(msg.sender) {
        require(amount > 0, "Cannot stake 0");
        super.stake(amount);
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint amount) public updateReward(msg.sender) {
        require(amount > 0, "Cannot withdraw 0");
        super.withdraw(amount);
        emit Withdrawn(msg.sender, amount);
    }

    function exit() external {
        withdraw(balanceOf(msg.sender));
        getReward();
    }

    function getReward() public updateReward(msg.sender) {
        uint reward = earned(msg.sender);
        if (reward > 0) {
            rewards[msg.sender] = 0;
            earn.safeTransfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

    function notifyRewardAmount(uint reward)
        external
        onlyRewardDistribution
        updateReward(address(0))
    {
        earn.safeTransferFrom(msg.sender, address(this), reward);
        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(DURATION);
        } else {
            uint remaining = periodFinish.sub(block.timestamp);
            uint leftover = remaining.mul(rewardRate);
            rewardRate = reward.add(leftover).div(DURATION);
        }
        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(DURATION);
        emit RewardAdded(reward);
    }
}

contract RewardDistributionFactory {
    function deploy(
        IERC20 lp_, 
        IERC20 earn_, 
        address rewardDistribution_,
        uint8 decimals_,
        string calldata name_,
        string calldata symbol_
    ) external returns (address) {
        return address(new RewardDistributionVoter(lp_, earn_, rewardDistribution_, decimals_, name_, symbol_));
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"internalType":"contract IERC20","name":"lp_","type":"address"},{"internalType":"contract IERC20","name":"earn_","type":"address"},{"internalType":"address","name":"rewardDistribution_","type":"address"},{"internalType":"uint8","name":"decimals_","type":"uint8"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"}],"name":"deploy","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506122eb806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063045ae12114610030575b600080fd5b61011d600480360360c081101561004657600080fd5b6001600160a01b038235811692602081013582169260408201359092169160ff606083013516919081019060a08101608082013564010000000081111561008c57600080fd5b82018360208201111561009e57600080fd5b803590602001918460018302840111640100000000831117156100c057600080fd5b9193909290916020810190356401000000008111156100de57600080fd5b8201836020820111156100f057600080fd5b8035906020019184600183028401116401000000008311171561011257600080fd5b509092509050610139565b604080516001600160a01b039092168252519081900360200190f35b6000888888888888888860405161014f906101ff565b6001600160a01b03808a16825288811660208301528716604082015260ff8616606082015260c06080820181815290820185905260a0820160e08301878780828437600083820152601f01601f1916909101848103835285815260200190508585808284376000838201819052604051601f909201601f19169093018190039d509b50909950505050505050505050f0801580156101f1573d6000803e3d6000fd5b509998505050505050505050565b6120aa8061020d8339019056fe60806040526000600c556000600d553480156200001b57600080fd5b50604051620020aa380380620020aa833981810160405260c08110156200004157600080fd5b81516020830151604080850151606086015160808701805193519597949692959194919392820192846401000000008211156200007d57600080fd5b9083019060208201858111156200009357600080fd5b8251640100000000811182820188101715620000ae57600080fd5b82525081516020918201929091019080838360005b83811015620000dd578181015183820152602001620000c3565b50505050905090810190601f1680156200010b5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200012f57600080fd5b9083019060208201858111156200014557600080fd5b82516401000000008111828201881017156200016057600080fd5b82525081516020918201929091019080838360005b838110156200018f57818101518382015260200162000175565b50505050905090810190601f168015620001bd5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b03199081166001600160a01b038a811691909117909255600b80548216898416179055600a8054909116918716919091179055506003805460ff191660ff851617905581516200022690600190602085019062000249565b5080516200023c90600290602084019062000249565b50505050505050620002ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028c57805160ff1916838001178555620002bc565b82800160010185558215620002bc579182015b82811115620002bc5782518255916020019190600101906200029f565b50620002ca929150620002ce565b5090565b620002eb91905b80821115620002ca5760008155600101620002d5565b90565b611dac80620002fe6000396000f3fe608060405234801561001057600080fd5b50600436106101ef5760003560e01c80637b0a47ee1161010f578063c8f33c91116100a2578063e7a324dc11610071578063e7a324dc14610558578063e9fad8ee14610560578063ebe2b12b14610568578063f1127ed814610570576101ef565b8063c8f33c9114610538578063cd3daf9d14610540578063d389800f14610548578063df136d6514610550576101ef565b806395d89b41116100de57806395d89b41146104a6578063a694fc3a146104ae578063b4b5ea57146104cb578063c3cda520146104f1576101ef565b80637b0a47ee1461044a5780637ecebe001461045257806380faa57d146104785780638b87634714610480576101ef565b8063313ce567116101875780635c19a95c116101565780635c19a95c146103935780636fcfff45146103b957806370a08231146103f8578063782d6fe11461041e576101ef565b8063313ce5671461032a5780633c6b16ab146103485780633d18b91214610365578063587cde1e1461036d576101ef565b80631be05289116101c35780631be05289146102d757806320606b70146102df5780632e1a7d4d146102e7578063313c06a014610306576101ef565b80628cc262146101f457806306fdde031461022c5780630700037d146102a957806318160ddd146102cf575b600080fd5b61021a6004803603602081101561020a57600080fd5b50356001600160a01b03166105c2565b60408051918252519081900360200190f35b610234610648565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61021a600480360360208110156102bf57600080fd5b50356001600160a01b03166106d5565b61021a6106e7565b61021a6106ee565b61021a6106f5565b610304600480360360208110156102fd57600080fd5b5035610711565b005b61030e6107f8565b604080516001600160a01b039092168252519081900360200190f35b610332610807565b6040805160ff9092168252519081900360200190f35b6103046004803603602081101561035e57600080fd5b5035610810565b610304610998565b61030e6004803603602081101561038357600080fd5b50356001600160a01b0316610a6a565b610304600480360360208110156103a957600080fd5b50356001600160a01b0316610a85565b6103df600480360360208110156103cf57600080fd5b50356001600160a01b0316610a92565b6040805163ffffffff9092168252519081900360200190f35b61021a6004803603602081101561040e57600080fd5b50356001600160a01b0316610aaa565b61021a6004803603604081101561043457600080fd5b506001600160a01b038135169060200135610ac5565b61021a610ccd565b61021a6004803603602081101561046857600080fd5b50356001600160a01b0316610cd3565b61021a610ce5565b61021a6004803603602081101561049657600080fd5b50356001600160a01b0316610cf8565b610234610d0a565b610304600480360360208110156104c457600080fd5b5035610d62565b61021a600480360360208110156104e157600080fd5b50356001600160a01b0316610e46565b610304600480360360c081101561050757600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135610eaa565b61021a611191565b61021a611197565b61030e6111eb565b61021a6111fa565b61021a611200565b61030461121b565b61021a611236565b6105a26004803603604081101561058657600080fd5b5080356001600160a01b0316906020013563ffffffff1661123c565b6040805163ffffffff909316835260208301919091528051918290030190f35b6001600160a01b0381166000908152601160209081526040808320546010909252822054610642919061063690670de0b6b3a76400009061062a9061061590610609611197565b9063ffffffff61126916565b61061e88610aaa565b9063ffffffff6112ab16565b9063ffffffff61130416565b9063ffffffff61134616565b92915050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b820191906000526020600020905b8154815290600101906020018083116106b057829003601f168201915b505050505081565b60116020526000908152604090205481565b6008545b90565b62093a8081565b6040518080611c65604091396040019050604051809103902081565b3361071a611197565b600f55610725610ce5565b600e556001600160a01b0381161561076c57610740816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b600082116107b5576040805162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b604482015290519081900360640190fd5b6107be826113a0565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b6000546001600160a01b031681565b60035460ff1681565b600a546001600160a01b031633146108595760405162461bcd60e51b8152600401808060200182810382526021815260200180611ce96021913960400191505060405180910390fd5b6000610863611197565b600f5561086e610ce5565b600e556001600160a01b038116156108b557610889816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b600b546108d3906001600160a01b031633308563ffffffff61140116565b600c5442106108f7576108ef8262093a8063ffffffff61130416565b600d55610945565b600c5460009061090d904263ffffffff61126916565b90506000610926600d54836112ab90919063ffffffff16565b905061093f62093a8061062a868463ffffffff61134616565b600d5550505b42600e81905561095e9062093a8063ffffffff61134616565b600c556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a15050565b336109a1611197565b600f556109ac610ce5565b600e556001600160a01b038116156109f3576109c7816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b60006109fe336105c2565b90508015610a665733600081815260116020526040812055600b54610a2f916001600160a01b039091169083611461565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b5050565b6004602052600090815260409020546001600160a01b031681565b610a8f33826114b8565b50565b60066020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526009602052604090205490565b6000438210610b055760405162461bcd60e51b8152600401808060200182810382526023815260200180611cc66023913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680610b33576000915050610642565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610ba2576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff16835292905220600101549050610642565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610bdd576000915050610642565b600060001982015b8163ffffffff168163ffffffff161115610c9657600282820363ffffffff16048103610c0f611bc5565b506001600160a01b038716600090815260056020908152604080832063ffffffff808616855290835292819020815180830190925280549093168082526001909301549181019190915290871415610c71576020015194506106429350505050565b805163ffffffff16871115610c8857819350610c8f565b6001820392505b5050610be5565b506001600160a01b038516600090815260056020908152604080832063ffffffff9094168352929052206001015491505092915050565b600d5481565b60076020526000908152604090205481565b6000610cf342600c54611532565b905090565b60106020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b33610d6b611197565b600f55610d76610ce5565b600e556001600160a01b03811615610dbd57610d91816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b60008211610e03576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b610e0c82611548565b60408051838152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a25050565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610e71576000610ea3565b6001600160a01b038316600090815260056020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b60006040518080611c65604091396040019050604051809103902060016040518082805460018160011615610100020316600290048015610f225780601f10610f00576101008083540402835291820191610f22565b820191906000526020600020905b815481529060010190602001808311610f0e575b50509150506040518091039020610f376115aa565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405160208183030381529060405280519060200120905060006040518080611bdd60349139604080519182900360340182206020808401919091526001600160a01b038c1683830152606083018b905260808084018b90528251808503909101815260a08401835280519082012061190160f01b60c085015260c2840187905260e2808501829052835180860390910181526101028501808552815191840191909120600091829052610122860180865281905260ff8c1661014287015261016286018b905261018286018a9052935191965092945091926001926101a28083019392601f198301929081900390910190855afa158015611075573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166110c75760405162461bcd60e51b8152600401808060200182810382526022815260200180611d2c6022913960400191505060405180910390fd5b6001600160a01b0381166000908152600760205260409020805460018101909155891461113b576040805162461bcd60e51b815260206004820152601e60248201527f3a3a64656c656761746542795369673a20696e76616c6964206e6f6e63650000604482015290519081900360640190fd5b8742111561117a5760405162461bcd60e51b8152600401808060200182810382526022815260200180611d0a6022913960400191505060405180910390fd5b611184818b6114b8565b505050505b505050505050565b600e5481565b60006111a16106e7565b6111ae5750600f546106eb565b610cf36111dc6111bc6106e7565b61062a670de0b6b3a764000061061e600d5461061e600e54610609610ce5565b600f549063ffffffff61134616565b600b546001600160a01b031681565b600f5481565b604051806034611bdd82396034019050604051809103902081565b61122c61122733610aaa565b610711565b611234610998565b565b600c5481565b60056020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6000610ea383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115ae565b6000826112ba57506000610642565b828202828482816112c757fe5b0414610ea35760405162461bcd60e51b8152600401808060200182810382526021815260200180611ca56021913960400191505060405180910390fd5b6000610ea383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611645565b600082820183811015610ea3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6008546113b3908263ffffffff61126916565b600855336000908152600960205260409020546113d6908263ffffffff61126916565b336000818152600960205260408120929092559054610a8f916001600160a01b039091169083611461565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261145b9085906116aa565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526114b39084906116aa565b505050565b6001600160a01b03808316600081815260046020818152604080842080546009845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461145b828483611862565b60008183106115415781610ea3565b5090919050565b60085461155b908263ffffffff61134616565b6008553360009081526009602052604090205461157e908263ffffffff61134616565b336000818152600960205260408120929092559054610a8f916001600160a01b03909116903084611401565b4690565b6000818484111561163d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116025781810151838201526020016115ea565b50505050905090810190601f16801561162f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836116945760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156116025781810151838201526020016115ea565b5060008385816116a057fe5b0495945050505050565b6116bc826001600160a01b03166119c6565b61170d576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061174b5780518252601f19909201916020918201910161172c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117ad576040519150601f19603f3d011682016040523d82523d6000602084013e6117b2565b606091505b509150915081611809576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561145b5780806020019051602081101561182557600080fd5b505161145b5760405162461bcd60e51b815260040180806020018281038252602a815260200180611d4e602a913960400191505060405180910390fd5b816001600160a01b0316836001600160a01b0316141580156118845750600081115b156114b3576001600160a01b03831615611937576001600160a01b03831660009081526006602052604081205463ffffffff1690816118c45760006118f6565b6001600160a01b038516600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b9050600061192584604051806060016040528060248152602001611c116024913984919063ffffffff6115ae16565b905061193386848484611a02565b5050505b6001600160a01b038216156114b3576001600160a01b03821660009081526006602052604081205463ffffffff1690816119725760006119a4565b6001600160a01b038416600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b905060006119b8828563ffffffff61134616565b905061118985848484611a02565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906119fa5750808214155b949350505050565b6000611a2643604051806060016040528060308152602001611c3560309139611b67565b905060008463ffffffff16118015611a6f57506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611aac576001600160a01b038516600090815260056020908152604080832063ffffffff60001989011684529091529020600101829055611b1d565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600584528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260069092529390208054928801909116919092161790555b604080518481526020810184905281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b6000816401000000008410611bbd5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156116025781810151838201526020016115ea565b509192915050565b60408051808201909152600080825260208201529056fe44656c65676174696f6e28616464726573732064656c6567617465652c75696e74206e6f6e63652c75696e7420657870697279293a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77733a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473454950373132446f6d61696e28737472696e67206e616d652c75696e7420636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f773a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e656443616c6c6572206973206e6f742072657761726420646973747269627574696f6e3a3a64656c656761746542795369673a207369676e617475726520657870697265643a3a64656c656761746542795369673a20696e76616c6964207369676e61747572655361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158201fef87549370e87e8c9fc142bf21542f73b045cdfe990dd25193b5a84bc1e39464736f6c63430005110032a265627a7a723158203d6f7a6b8a3b3802dc719c126afbdb0d77b9ce299942f93371d9673ea12927f664736f6c63430005110032

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063045ae12114610030575b600080fd5b61011d600480360360c081101561004657600080fd5b6001600160a01b038235811692602081013582169260408201359092169160ff606083013516919081019060a08101608082013564010000000081111561008c57600080fd5b82018360208201111561009e57600080fd5b803590602001918460018302840111640100000000831117156100c057600080fd5b9193909290916020810190356401000000008111156100de57600080fd5b8201836020820111156100f057600080fd5b8035906020019184600183028401116401000000008311171561011257600080fd5b509092509050610139565b604080516001600160a01b039092168252519081900360200190f35b6000888888888888888860405161014f906101ff565b6001600160a01b03808a16825288811660208301528716604082015260ff8616606082015260c06080820181815290820185905260a0820160e08301878780828437600083820152601f01601f1916909101848103835285815260200190508585808284376000838201819052604051601f909201601f19169093018190039d509b50909950505050505050505050f0801580156101f1573d6000803e3d6000fd5b509998505050505050505050565b6120aa8061020d8339019056fe60806040526000600c556000600d553480156200001b57600080fd5b50604051620020aa380380620020aa833981810160405260c08110156200004157600080fd5b81516020830151604080850151606086015160808701805193519597949692959194919392820192846401000000008211156200007d57600080fd5b9083019060208201858111156200009357600080fd5b8251640100000000811182820188101715620000ae57600080fd5b82525081516020918201929091019080838360005b83811015620000dd578181015183820152602001620000c3565b50505050905090810190601f1680156200010b5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200012f57600080fd5b9083019060208201858111156200014557600080fd5b82516401000000008111828201881017156200016057600080fd5b82525081516020918201929091019080838360005b838110156200018f57818101518382015260200162000175565b50505050905090810190601f168015620001bd5780820380516001836020036101000a031916815260200191505b506040525050600080546001600160a01b03199081166001600160a01b038a811691909117909255600b80548216898416179055600a8054909116918716919091179055506003805460ff191660ff851617905581516200022690600190602085019062000249565b5080516200023c90600290602084019062000249565b50505050505050620002ee565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200028c57805160ff1916838001178555620002bc565b82800160010185558215620002bc579182015b82811115620002bc5782518255916020019190600101906200029f565b50620002ca929150620002ce565b5090565b620002eb91905b80821115620002ca5760008155600101620002d5565b90565b611dac80620002fe6000396000f3fe608060405234801561001057600080fd5b50600436106101ef5760003560e01c80637b0a47ee1161010f578063c8f33c91116100a2578063e7a324dc11610071578063e7a324dc14610558578063e9fad8ee14610560578063ebe2b12b14610568578063f1127ed814610570576101ef565b8063c8f33c9114610538578063cd3daf9d14610540578063d389800f14610548578063df136d6514610550576101ef565b806395d89b41116100de57806395d89b41146104a6578063a694fc3a146104ae578063b4b5ea57146104cb578063c3cda520146104f1576101ef565b80637b0a47ee1461044a5780637ecebe001461045257806380faa57d146104785780638b87634714610480576101ef565b8063313ce567116101875780635c19a95c116101565780635c19a95c146103935780636fcfff45146103b957806370a08231146103f8578063782d6fe11461041e576101ef565b8063313ce5671461032a5780633c6b16ab146103485780633d18b91214610365578063587cde1e1461036d576101ef565b80631be05289116101c35780631be05289146102d757806320606b70146102df5780632e1a7d4d146102e7578063313c06a014610306576101ef565b80628cc262146101f457806306fdde031461022c5780630700037d146102a957806318160ddd146102cf575b600080fd5b61021a6004803603602081101561020a57600080fd5b50356001600160a01b03166105c2565b60408051918252519081900360200190f35b610234610648565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026e578181015183820152602001610256565b50505050905090810190601f16801561029b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61021a600480360360208110156102bf57600080fd5b50356001600160a01b03166106d5565b61021a6106e7565b61021a6106ee565b61021a6106f5565b610304600480360360208110156102fd57600080fd5b5035610711565b005b61030e6107f8565b604080516001600160a01b039092168252519081900360200190f35b610332610807565b6040805160ff9092168252519081900360200190f35b6103046004803603602081101561035e57600080fd5b5035610810565b610304610998565b61030e6004803603602081101561038357600080fd5b50356001600160a01b0316610a6a565b610304600480360360208110156103a957600080fd5b50356001600160a01b0316610a85565b6103df600480360360208110156103cf57600080fd5b50356001600160a01b0316610a92565b6040805163ffffffff9092168252519081900360200190f35b61021a6004803603602081101561040e57600080fd5b50356001600160a01b0316610aaa565b61021a6004803603604081101561043457600080fd5b506001600160a01b038135169060200135610ac5565b61021a610ccd565b61021a6004803603602081101561046857600080fd5b50356001600160a01b0316610cd3565b61021a610ce5565b61021a6004803603602081101561049657600080fd5b50356001600160a01b0316610cf8565b610234610d0a565b610304600480360360208110156104c457600080fd5b5035610d62565b61021a600480360360208110156104e157600080fd5b50356001600160a01b0316610e46565b610304600480360360c081101561050757600080fd5b506001600160a01b038135169060208101359060408101359060ff6060820135169060808101359060a00135610eaa565b61021a611191565b61021a611197565b61030e6111eb565b61021a6111fa565b61021a611200565b61030461121b565b61021a611236565b6105a26004803603604081101561058657600080fd5b5080356001600160a01b0316906020013563ffffffff1661123c565b6040805163ffffffff909316835260208301919091528051918290030190f35b6001600160a01b0381166000908152601160209081526040808320546010909252822054610642919061063690670de0b6b3a76400009061062a9061061590610609611197565b9063ffffffff61126916565b61061e88610aaa565b9063ffffffff6112ab16565b9063ffffffff61130416565b9063ffffffff61134616565b92915050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b820191906000526020600020905b8154815290600101906020018083116106b057829003601f168201915b505050505081565b60116020526000908152604090205481565b6008545b90565b62093a8081565b6040518080611c65604091396040019050604051809103902081565b3361071a611197565b600f55610725610ce5565b600e556001600160a01b0381161561076c57610740816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b600082116107b5576040805162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b604482015290519081900360640190fd5b6107be826113a0565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b6000546001600160a01b031681565b60035460ff1681565b600a546001600160a01b031633146108595760405162461bcd60e51b8152600401808060200182810382526021815260200180611ce96021913960400191505060405180910390fd5b6000610863611197565b600f5561086e610ce5565b600e556001600160a01b038116156108b557610889816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b600b546108d3906001600160a01b031633308563ffffffff61140116565b600c5442106108f7576108ef8262093a8063ffffffff61130416565b600d55610945565b600c5460009061090d904263ffffffff61126916565b90506000610926600d54836112ab90919063ffffffff16565b905061093f62093a8061062a868463ffffffff61134616565b600d5550505b42600e81905561095e9062093a8063ffffffff61134616565b600c556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a15050565b336109a1611197565b600f556109ac610ce5565b600e556001600160a01b038116156109f3576109c7816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b60006109fe336105c2565b90508015610a665733600081815260116020526040812055600b54610a2f916001600160a01b039091169083611461565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b5050565b6004602052600090815260409020546001600160a01b031681565b610a8f33826114b8565b50565b60066020526000908152604090205463ffffffff1681565b6001600160a01b031660009081526009602052604090205490565b6000438210610b055760405162461bcd60e51b8152600401808060200182810382526023815260200180611cc66023913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680610b33576000915050610642565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610ba2576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff16835292905220600101549050610642565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610bdd576000915050610642565b600060001982015b8163ffffffff168163ffffffff161115610c9657600282820363ffffffff16048103610c0f611bc5565b506001600160a01b038716600090815260056020908152604080832063ffffffff808616855290835292819020815180830190925280549093168082526001909301549181019190915290871415610c71576020015194506106429350505050565b805163ffffffff16871115610c8857819350610c8f565b6001820392505b5050610be5565b506001600160a01b038516600090815260056020908152604080832063ffffffff9094168352929052206001015491505092915050565b600d5481565b60076020526000908152604090205481565b6000610cf342600c54611532565b905090565b60106020526000908152604090205481565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156106cd5780601f106106a2576101008083540402835291602001916106cd565b33610d6b611197565b600f55610d76610ce5565b600e556001600160a01b03811615610dbd57610d91816105c2565b6001600160a01b038216600090815260116020908152604080832093909355600f546010909152919020555b60008211610e03576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b610e0c82611548565b60408051838152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a25050565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610e71576000610ea3565b6001600160a01b038316600090815260056020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b60006040518080611c65604091396040019050604051809103902060016040518082805460018160011615610100020316600290048015610f225780601f10610f00576101008083540402835291820191610f22565b820191906000526020600020905b815481529060010190602001808311610f0e575b50509150506040518091039020610f376115aa565b3060405160200180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405160208183030381529060405280519060200120905060006040518080611bdd60349139604080519182900360340182206020808401919091526001600160a01b038c1683830152606083018b905260808084018b90528251808503909101815260a08401835280519082012061190160f01b60c085015260c2840187905260e2808501829052835180860390910181526101028501808552815191840191909120600091829052610122860180865281905260ff8c1661014287015261016286018b905261018286018a9052935191965092945091926001926101a28083019392601f198301929081900390910190855afa158015611075573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166110c75760405162461bcd60e51b8152600401808060200182810382526022815260200180611d2c6022913960400191505060405180910390fd5b6001600160a01b0381166000908152600760205260409020805460018101909155891461113b576040805162461bcd60e51b815260206004820152601e60248201527f3a3a64656c656761746542795369673a20696e76616c6964206e6f6e63650000604482015290519081900360640190fd5b8742111561117a5760405162461bcd60e51b8152600401808060200182810382526022815260200180611d0a6022913960400191505060405180910390fd5b611184818b6114b8565b505050505b505050505050565b600e5481565b60006111a16106e7565b6111ae5750600f546106eb565b610cf36111dc6111bc6106e7565b61062a670de0b6b3a764000061061e600d5461061e600e54610609610ce5565b600f549063ffffffff61134616565b600b546001600160a01b031681565b600f5481565b604051806034611bdd82396034019050604051809103902081565b61122c61122733610aaa565b610711565b611234610998565b565b600c5481565b60056020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6000610ea383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115ae565b6000826112ba57506000610642565b828202828482816112c757fe5b0414610ea35760405162461bcd60e51b8152600401808060200182810382526021815260200180611ca56021913960400191505060405180910390fd5b6000610ea383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611645565b600082820183811015610ea3576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6008546113b3908263ffffffff61126916565b600855336000908152600960205260409020546113d6908263ffffffff61126916565b336000818152600960205260408120929092559054610a8f916001600160a01b039091169083611461565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261145b9085906116aa565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526114b39084906116aa565b505050565b6001600160a01b03808316600081815260046020818152604080842080546009845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461145b828483611862565b60008183106115415781610ea3565b5090919050565b60085461155b908263ffffffff61134616565b6008553360009081526009602052604090205461157e908263ffffffff61134616565b336000818152600960205260408120929092559054610a8f916001600160a01b03909116903084611401565b4690565b6000818484111561163d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116025781810151838201526020016115ea565b50505050905090810190601f16801561162f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836116945760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156116025781810151838201526020016115ea565b5060008385816116a057fe5b0495945050505050565b6116bc826001600160a01b03166119c6565b61170d576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061174b5780518252601f19909201916020918201910161172c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117ad576040519150601f19603f3d011682016040523d82523d6000602084013e6117b2565b606091505b509150915081611809576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561145b5780806020019051602081101561182557600080fd5b505161145b5760405162461bcd60e51b815260040180806020018281038252602a815260200180611d4e602a913960400191505060405180910390fd5b816001600160a01b0316836001600160a01b0316141580156118845750600081115b156114b3576001600160a01b03831615611937576001600160a01b03831660009081526006602052604081205463ffffffff1690816118c45760006118f6565b6001600160a01b038516600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b9050600061192584604051806060016040528060248152602001611c116024913984919063ffffffff6115ae16565b905061193386848484611a02565b5050505b6001600160a01b038216156114b3576001600160a01b03821660009081526006602052604081205463ffffffff1690816119725760006119a4565b6001600160a01b038416600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b905060006119b8828563ffffffff61134616565b905061118985848484611a02565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906119fa5750808214155b949350505050565b6000611a2643604051806060016040528060308152602001611c3560309139611b67565b905060008463ffffffff16118015611a6f57506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611aac576001600160a01b038516600090815260056020908152604080832063ffffffff60001989011684529091529020600101829055611b1d565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600584528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260069092529390208054928801909116919092161790555b604080518481526020810184905281516001600160a01b038816927fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724928290030190a25050505050565b6000816401000000008410611bbd5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156116025781810151838201526020016115ea565b509192915050565b60408051808201909152600080825260208201529056fe44656c65676174696f6e28616464726573732064656c6567617465652c75696e74206e6f6e63652c75696e7420657870697279293a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77733a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473454950373132446f6d61696e28737472696e67206e616d652c75696e7420636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f773a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e656443616c6c6572206973206e6f742072657761726420646973747269627574696f6e3a3a64656c656761746542795369673a207369676e617475726520657870697265643a3a64656c656761746542795369673a20696e76616c6964207369676e61747572655361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158201fef87549370e87e8c9fc142bf21542f73b045cdfe990dd25193b5a84bc1e39464736f6c63430005110032a265627a7a723158203d6f7a6b8a3b3802dc719c126afbdb0d77b9ce299942f93371d9673ea12927f664736f6c63430005110032

Deployed Bytecode Sourcemap

28125:393:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;28125:393:0;;;;;;;;;;;;;;;;;;;28167:348;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;28167:348:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21:11:-1;5:28;;2:2;;;46:1;43;36:12;2:2;28167:348:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;28167:348:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;28167:348:0;;;;;;;;;;;21:11:-1;5:28;;2:2;;;46:1;43;36:12;2:2;28167:348:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;28167:348:0;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;-1:-1;28167:348:0;;-1:-1:-1;28167:348:0;-1:-1:-1;28167:348:0;:::i;:::-;;;;-1:-1:-1;;;;;28167:348:0;;;;;;;;;;;;;;;28384:7;28447:3;28452:5;28459:19;28480:9;28491:5;;28498:7;;28419:87;;;;;:::i;:::-;-1:-1:-1;;;;;28419:87:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1:33:-1;99:1;81:16;;;74:27;137:4;117:14;-1:-1;;113:30;157:16;;;28419:87:0;;;;;;;;;;;-1:-1:-1;28419:87:0;;;;;1:33:-1;99:1;81:16;;;74:27;;;28419:87:0;;137:4:-1;117:14;;;-1:-1;;113:30;157:16;;;28419:87:0;;;;-1:-1:-1;28419:87:0;-1:-1:-1;99:1;;-1:-1;;;;;;;;;;28419:87:0;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;28404:103:0;28167:348;-1:-1:-1;;;;;;;;;28167:348:0:o;28125:393::-;;;;;;;;:::o

Swarm Source

bzzr://3d6f7a6b8a3b3802dc719c126afbdb0d77b9ce299942f93371d9673ea12927f6

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.