Contract 0xcC8A884396a7B3a6e61591D5f8949076Ed0c7353

 
Txn Hash
Block
From
To
Value [Txn Fee]
0x30f64194357594d43fef22edd46abc13a174fe90f31a201349a0972e62f48c78500552021-07-01 12:33:1078 days 7 hrs ago0x904b5993fc92979eeedc19ccc58bed6b7216667c IN  Contract Creation0 ETH0.006714731346 ETH
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RewardDistribution

Compiler Version
v0.7.4+commit.3f05b770

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 9 : RewardDistribution.sol
// SPDX-License-Identifier: GPL
pragma solidity 0.7.4;

import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";

import { IAuthenticator } from "../../interfaces/IAuthenticator.sol";
import { IComponent } from "../../interfaces/IComponent.sol";

interface IXMCB {
    function rawTotalSupply() external view returns (uint256);

    function rawBalanceOf(address account) external view returns (uint256);
}

contract RewardDistribution is Initializable, IComponent {
    using AddressUpgradeable for address;
    using SafeMathUpgradeable for uint256;
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    bytes32 public constant REWARD_DISTRIBUTION_ADMIN_ROLE =
        keccak256("REWARD_DISTRIBUTION_ADMIN_ROLE");

    IXMCB public xmcb;
    IAuthenticator public authenticator;

    struct RewardPlan {
        IERC20Upgradeable rewardToken;
        uint256 periodFinish;
        uint256 rewardRate;
        uint256 lastUpdateTime;
        uint256 rewardPerTokenStored;
        mapping(address => uint256) userRewardPerTokenPaid;
        mapping(address => uint256) rewards;
    }
    mapping(address => RewardPlan) internal _rewardPlans;
    EnumerableSetUpgradeable.AddressSet internal _activeReward;

    event RewardPaid(address indexed user, uint256 reward);
    event RewardAdded(uint256 reward, uint256 periodFinish);
    event RewardRateChanged(uint256 previousRate, uint256 currentRate, uint256 periodFinish);
    event RewardPlanCreated(address indexed token, uint256 rewardRate);

    modifier onlyAuthorized() {
        require(
            authenticator.hasRoleOrAdmin(REWARD_DISTRIBUTION_ADMIN_ROLE, msg.sender),
            "caller is not authorized"
        );
        _;
    }

    modifier updateReward(address token, address account) {
        _updateReward(token, account);
        _;
    }

    modifier onlyOnExistPlan(address token) {
        require(hasPlan(token), "plan not exists");
        _;
    }

    function initialize(address authenticator_, address XMCB_) external initializer {
        require(authenticator_.isContract(), "authenticator must be a contract");
        require(XMCB_.isContract(), "authenticator must be a contract");

        authenticator = IAuthenticator(authenticator_);
        xmcb = IXMCB(XMCB_);
    }

    /**
     * @notice  The address of base token.
     */
    function baseToken() external view override returns (address) {
        return address(xmcb);
    }

    /**
     * @notice  Implement of IComponent interface which is call when user deposits MCB into XMCB.
     */
    function beforeMintingToken(
        address account,
        uint256,
        uint256
    ) external override {
        uint256 length = _activeReward.length();
        for (uint256 i = 0; i < length; i++) {
            _updateReward(_activeReward.at(i), account);
        }
    }

    /**
     * @notice  Implement of IComponent interface which is call when user withdraws MCB from XMCB.
     */
    function beforeBurningToken(
        address account,
        uint256,
        uint256
    ) external override {
        uint256 length = _activeReward.length();
        for (uint256 i = 0; i < length; i++) {
            _updateReward(_activeReward.at(i), account);
        }
    }

    /**
     * @notice  Check if there is any reward plan for given token.
     */
    function hasPlan(address token) public view returns (bool) {
        return address(_rewardPlans[token].rewardToken) != address(0);
    }

    /**
     * @notice  Create a new reward plan for given token, setting the reward rate. Duplicated creation will be reverted.
     */
    function createRewardPlan(address token, uint256 rewardRate) external onlyAuthorized {
        require(token != address(0), "invalid reward token");
        require(token.isContract(), "reward token must be contract");
        require(!hasPlan(token), "plan already exists");
        _rewardPlans[token].rewardToken = IERC20Upgradeable(token);
        _rewardPlans[token].rewardRate = rewardRate;
        _activeReward.add(token);
        emit RewardPlanCreated(token, rewardRate);
    }

    /**
     * @notice  Get the reward tokens, including the finished reward plan.
     */
    function getRewardTokens() external view returns (address[] memory) {
        uint256 tokenCount = _activeReward.length();
        address[] memory results = new address[](tokenCount);
        for (uint256 i = 0; i < tokenCount; i++) {
            results[i] = _activeReward.at(i);
        }
        return results;
    }

    /**
     * @notice  Get the finished time and reward rate of a reward plan.
     */
    function getRewardPlan(address token) external view returns (uint256, uint256) {
        RewardPlan storage plan = _rewardPlans[token];
        return (plan.periodFinish, plan.rewardRate);
    }

    /**
     * @notice  Set reward distribution rate. If there is unfinished distribution, the end time will be changed
     *          according to change of newRewardRate.
     *
     * @param   newRewardRate   New reward distribution rate.
     */
    function setRewardRate(address token, uint256 newRewardRate)
        external
        virtual
        onlyAuthorized
        onlyOnExistPlan(token)
        updateReward(token, address(0))
    {
        RewardPlan storage plan = _rewardPlans[token];
        if (newRewardRate == 0) {
            plan.periodFinish = _getBlockNumber();
        } else if (plan.periodFinish != 0) {
            plan.periodFinish = plan
                .periodFinish
                .sub(plan.lastUpdateTime)
                .mul(plan.rewardRate)
                .div(newRewardRate)
                .add(_getBlockNumber());
        }
        emit RewardRateChanged(plan.rewardRate, newRewardRate, plan.periodFinish);
        plan.rewardRate = newRewardRate;
    }

    /**
     * @notice  Add new distributable reward to current pool, this will extend an exist distribution or
     *          start a new distribution if previous one is already ended.
     *
     * @param   reward  Amount of reward to add.
     */
    function notifyRewardAmount(address token, uint256 reward)
        external
        virtual
        onlyAuthorized
        onlyOnExistPlan(token)
        updateReward(token, address(0))
    {
        require(reward > 0, "reward is zero");
        RewardPlan storage plan = _rewardPlans[token];
        require(plan.rewardRate > 0, "rewardRate is zero");
        uint256 period = reward.div(plan.rewardRate);
        // already finished or not initialized
        if (_getBlockNumber() > plan.periodFinish) {
            plan.lastUpdateTime = _getBlockNumber();
            plan.periodFinish = _getBlockNumber().add(period);
        } else {
            // not finished or not initialized
            plan.periodFinish = plan.periodFinish.add(period);
        }
        emit RewardAdded(reward, plan.periodFinish);
    }

    /**
     * @notice  Return end time if last distribution is done or current timestamp.
     */
    function lastTimeRewardApplicable(address token) public view returns (uint256) {
        RewardPlan storage plan = _rewardPlans[token];
        return _getBlockNumber() <= plan.periodFinish ? _getBlockNumber() : plan.periodFinish;
    }

    /**
     * @notice  Return the per token amount of reward.
     *          The expected reward of user is: [amount of share] x rewardPerToken - claimedReward.
     */
    function rewardPerToken(address token) public view returns (uint256) {
        RewardPlan storage plan = _rewardPlans[token];
        uint256 totalSupply = xmcb.rawTotalSupply();
        if (totalSupply == 0) {
            return plan.rewardPerTokenStored;
        }
        return
            plan.rewardPerTokenStored.add(
                lastTimeRewardApplicable(token)
                    .sub(plan.lastUpdateTime)
                    .mul(plan.rewardRate)
                    .mul(1e18)
                    .div(totalSupply)
            );
    }

    /**
     * @notice  Return real time reward of account.
     */
    function earned(address token, address account) public view returns (uint256) {
        RewardPlan storage plan = _rewardPlans[token];
        uint256 balance = xmcb.rawBalanceOf(account);
        return
            balance
                .mul(rewardPerToken(token).sub(plan.userRewardPerTokenPaid[account]))
                .div(1e18)
                .add(plan.rewards[account]);
    }

    /**
     * @notice  Claim remaining reward of a token for caller.
     */
    function getReward(address token) public updateReward(token, msg.sender) {
        RewardPlan storage plan = _rewardPlans[token];
        address account = msg.sender;
        uint256 reward = earned(token, account);
        if (reward > 0) {
            plan.rewards[account] = 0;
            plan.rewardToken.safeTransfer(account, reward);
            emit RewardPaid(account, reward);
        }
    }

    /**
     * @notice  Claim remaining reward of all tokens for caller.
     */
    function getAllRewards() external {
        uint256 length = _activeReward.length();
        for (uint256 i = 0; i < length; i++) {
            getReward(_activeReward.at(i));
        }
    }

    function _updateReward(address token, address account) internal {
        RewardPlan storage plan = _rewardPlans[token];
        plan.rewardPerTokenStored = rewardPerToken(token);
        plan.lastUpdateTime = lastTimeRewardApplicable(token);
        if (account != address(0)) {
            plan.rewards[account] = earned(token, account);
            plan.userRewardPerTokenPaid[account] = plan.rewardPerTokenStored;
        }
    }

    function _getBlockNumber() internal view virtual returns (uint256) {
        return block.number;
    }

    bytes32[50] private __gap;
}

File 2 of 9 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

    /**
     * @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].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 3 of 9 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @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 SafeMathUpgradeable {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, 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 (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

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

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

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

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

    /**
     * @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) {
        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, reverting 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) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * 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);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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;
    }
}

File 4 of 9 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);
}

File 5 of 9 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20Upgradeable.sol";
import "../../math/SafeMathUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";

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

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

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

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

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

    function safeDecreaseAllowance(IERC20Upgradeable token, address spender, uint256 value) internal {
        uint256 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(IERC20Upgradeable token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        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");
        }
    }
}

File 6 of 9 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 7 of 9 : Initializable.sol
// SPDX-License-Identifier: MIT

// solhint-disable-next-line compiler-version
pragma solidity >=0.4.24 <0.8.0;

import "../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 8 of 9 : IAuthenticator.sol
// SPDX-License-Identifier: GPL
pragma solidity 0.7.4;

interface IAuthenticator {
    /**
     * @notice  Check if an account has the given role.
     * @param   role    A bytes32 value generated from keccak256("ROLE_NAME").
     * @param   account The account to be checked.
     * @return  True if the account has already granted permissions for the given role.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @notice  This should be called from external contract, to test if a account has specified role.

     * @param   role    A bytes32 value generated from keccak256("ROLE_NAME").
     * @param   account The account to be checked.
     * @return  True if the account has already granted permissions for the given role.
     */
    function hasRoleOrAdmin(bytes32 role, address account) external view returns (bool);
}

File 9 of 9 : IComponent.sol
// SPDX-License-Identifier: GPL
pragma solidity 0.7.4;

interface IComponent {
    /**
     * @notice  The address of base token.
     */
    function baseToken() external view returns (address);

    /**
     * @notice  A hook which is call when user deposits MCB into XMCB.
     */
    function beforeMintingToken(
        address account,
        uint256 amount,
        uint256 totalSupply
    ) external;

    /**
     * @notice  A hook which is call when user withdraws MCB from XMCB.
     */
    function beforeBurningToken(
        address account,
        uint256 amount,
        uint256 totalSupply
    ) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodFinish","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":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"RewardPlanCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previousRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"currentRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"periodFinish","type":"uint256"}],"name":"RewardRateChanged","type":"event"},{"inputs":[],"name":"REWARD_DISTRIBUTION_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"authenticator","outputs":[{"internalType":"contract IAuthenticator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"beforeBurningToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"beforeMintingToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"createRewardPlan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getRewardPlan","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"hasPlan","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"authenticator_","type":"address"},{"internalType":"address","name":"XMCB_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"notifyRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"newRewardRate","type":"uint256"}],"name":"setRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xmcb","outputs":[{"internalType":"contract IXMCB","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506117fa806100206000396000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c8063812a71d5116100a2578063be5c639611610071578063be5c63961461031c578063c00007b01461034e578063c4f59f9b14610374578063c55dae63146103cc578063f1229777146103d457610116565b8063812a71d51461027d57806390ebc8a4146102a957806395ac4f5d146102e8578063b66503cf146102f057610116565b806335cb0bb6116100e957806335cb0bb6146101ed57806337a1adac1461021957806345b35f5614610221578063485cc95514610229578063638634ee1461025757610116565b80630bb872331461011b5780630e57ffae1461014f578063211dc32d146101895780632335c76b146101c9575b600080fd5b61014d6004803603606081101561013157600080fd5b506001600160a01b0381351690602081013590604001356103fa565b005b6101756004803603602081101561016557600080fd5b50356001600160a01b0316610436565b604080519115158252519081900360200190f35b6101b76004803603604081101561019f57600080fd5b506001600160a01b0381358116916020013516610459565b60408051918252519081900360200190f35b6101d161055e565b604080516001600160a01b039092168252519081900360200190f35b61014d6004803603604081101561020357600080fd5b506001600160a01b03813516906020013561056d565b6101d16107c9565b61014d6107de565b61014d6004803603604081101561023f57600080fd5b506001600160a01b0381358116916020013516610816565b6101b76004803603602081101561026d57600080fd5b50356001600160a01b03166109c1565b61014d6004803603604081101561029357600080fd5b506001600160a01b038135169060200135610a05565b6102cf600480360360208110156102bf57600080fd5b50356001600160a01b0316610c04565b6040805192835260208301919091528051918290030190f35b6101b7610c2a565b61014d6004803603604081101561030657600080fd5b506001600160a01b038135169060200135610c3c565b61014d6004803603606081101561033257600080fd5b506001600160a01b038135169060208101359060400135610ec7565b61014d6004803603602081101561036457600080fd5b50356001600160a01b0316610ef6565b61037c610fa1565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b85781810151838201526020016103a0565b505050509050019250505060405180910390f35b6101d1611040565b6101b7600480360360208110156103ea57600080fd5b50356001600160a01b0316611055565b60006104066003611131565b905060005b8181101561042f5761042761042160038361113c565b86611148565b60010161040b565b5050505050565b6001600160a01b038181166000908152600260205260409020541615155b919050565b6001600160a01b03808316600090815260026020908152604080832083548251630481930d60e21b81528787166004820152925194959194869462010000909204909216926312064c349260248083019392829003018186803b1580156104bf57600080fd5b505afa1580156104d3573d6000803e3d6000fd5b505050506040513d60208110156104e957600080fd5b50516001600160a01b038516600090815260068401602090815260408083205460058701909252909120549192506105539161054d90670de0b6b3a764000090610547906105409061053a8c611055565b906111cb565b8690611228565b90611281565b906112e8565b925050505b92915050565b6001546001600160a01b031681565b60015460408051635db8200960e01b815260008051602061177b833981519152600482015233602482015290516001600160a01b0390921691635db8200991604480820192602092909190829003018186803b1580156105cc57600080fd5b505afa1580156105e0573d6000803e3d6000fd5b505050506040513d60208110156105f657600080fd5b5051610644576040805162461bcd60e51b815260206004820152601860248201527718d85b1b195c881a5cc81b9bdd08185d5d1a1bdc9a5e995960421b604482015290519081900360640190fd5b6001600160a01b038216610696576040805162461bcd60e51b815260206004820152601460248201527334b73b30b634b2103932bbb0b932103a37b5b2b760611b604482015290519081900360640190fd5b6106a8826001600160a01b0316611342565b6106f9576040805162461bcd60e51b815260206004820152601d60248201527f72657761726420746f6b656e206d75737420626520636f6e7472616374000000604482015290519081900360640190fd5b61070282610436565b1561074a576040805162461bcd60e51b8152602060048201526013602482015272706c616e20616c72656164792065786973747360681b604482015290519081900360640190fd5b6001600160a01b038216600081815260026020819052604090912080546001600160a01b031916909217825501819055610785600383611348565b506040805182815290516001600160a01b038416917f89389e361c4e4aaec5be02336e4c9d0ff15c7dc32e9078f697c162170f472213919081900360200190a25050565b6000546201000090046001600160a01b031681565b60006107ea6003611131565b905060005b818110156108125761080a61080560038361113c565b610ef6565b6001016107ef565b5050565b600054610100900460ff168061082f575061082f61135d565b8061083d575060005460ff16155b6108785760405162461bcd60e51b815260040180806020018281038252602e81526020018061172c602e913960400191505060405180910390fd5b600054610100900460ff161580156108a3576000805460ff1961ff0019909116610100171660011790555b6108b5836001600160a01b0316611342565b610906576040805162461bcd60e51b815260206004820181905260248201527f61757468656e74696361746f72206d757374206265206120636f6e7472616374604482015290519081900360640190fd5b610918826001600160a01b0316611342565b610969576040805162461bcd60e51b815260206004820181905260248201527f61757468656e74696361746f72206d757374206265206120636f6e7472616374604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b03858116919091179091556000805462010000600160b01b031916620100009285169290920291909117905580156109bc576000805461ff00191690555b505050565b6001600160a01b038116600090815260026020526040812060018101546109e661136e565b11156109f65780600101546109fe565b6109fe61136e565b9392505050565b60015460408051635db8200960e01b815260008051602061177b833981519152600482015233602482015290516001600160a01b0390921691635db8200991604480820192602092909190829003018186803b158015610a6457600080fd5b505afa158015610a78573d6000803e3d6000fd5b505050506040513d6020811015610a8e57600080fd5b5051610adc576040805162461bcd60e51b815260206004820152601860248201527718d85b1b195c881a5cc81b9bdd08185d5d1a1bdc9a5e995960421b604482015290519081900360640190fd5b81610ae681610436565b610b29576040805162461bcd60e51b815260206004820152600f60248201526e706c616e206e6f742065786973747360881b604482015290519081900360640190fd5b826000610b368282611148565b6001600160a01b038516600090815260026020526040902084610b6557610b5b61136e565b6001820155610bad565b600181015415610bad57610ba7610b7a61136e565b61054d876105478560020154610ba1876003015488600101546111cb90919063ffffffff16565b90611228565b60018201555b60028101546001820154604080519283526020830188905282810191909152517f3d209aed8ecb665e2e6cc55772bfc177e7aa7f6fa40ce4af171a43ed8fa2e2db9181900360600190a16002019390935550505050565b6001600160a01b0316600090815260026020819052604090912060018101549101549091565b60008051602061177b83398151915281565b60015460408051635db8200960e01b815260008051602061177b833981519152600482015233602482015290516001600160a01b0390921691635db8200991604480820192602092909190829003018186803b158015610c9b57600080fd5b505afa158015610caf573d6000803e3d6000fd5b505050506040513d6020811015610cc557600080fd5b5051610d13576040805162461bcd60e51b815260206004820152601860248201527718d85b1b195c881a5cc81b9bdd08185d5d1a1bdc9a5e995960421b604482015290519081900360640190fd5b81610d1d81610436565b610d60576040805162461bcd60e51b815260206004820152600f60248201526e706c616e206e6f742065786973747360881b604482015290519081900360640190fd5b826000610d6d8282611148565b60008411610db3576040805162461bcd60e51b815260206004820152600e60248201526d726577617264206973207a65726f60901b604482015290519081900360640190fd5b6001600160a01b038516600090815260026020819052604090912090810154610e18576040805162461bcd60e51b815260206004820152601260248201527172657761726452617465206973207a65726f60701b604482015290519081900360640190fd5b6000610e3182600201548761128190919063ffffffff16565b90508160010154610e4061136e565b1115610e6957610e4e61136e565b6003830155610e5f8161054d61136e565b6001830155610e7e565b6001820154610e7890826112e8565b60018301555b600182015460408051888152602081019290925280517f6c07ee05dcf262f13abf9d87b846ee789d2f90fe991d495acd7d7fc109ee1f559281900390910190a150505050505050565b6000610ed36003611131565b905060005b8181101561042f57610eee61042160038361113c565b600101610ed8565b8033610f028282611148565b6001600160a01b0383166000908152600260205260408120903390610f278683610459565b90508015610f99576001600160a01b0380831660009081526006850160205260408120558354610f5991168383611372565b6040805182815290516001600160a01b038416917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a25b505050505050565b60606000610faf6003611131565b905060608167ffffffffffffffff81118015610fca57600080fd5b50604051908082528060200260200182016040528015610ff4578160200160208202803683370190505b50905060005b828110156110395761100d60038261113c565b82828151811061101957fe5b6001600160a01b0390921660209283029190910190910152600101610ffa565b5091505090565b6000546201000090046001600160a01b031690565b6001600160a01b03808216600090815260026020908152604080832083548251632964b67b60e21b81529251949591948694620100009092049092169263a592d9ec9260048083019392829003018186803b1580156110b357600080fd5b505afa1580156110c7573d6000803e3d6000fd5b505050506040513d60208110156110dd57600080fd5b50519050806110f25750600401549050610454565b61112961111e82610547670de0b6b3a7640000610ba18760020154610ba1896003015461053a8d6109c1565b6004840154906112e8565b949350505050565b6000610558826113c4565b60006109fe83836113c8565b6001600160a01b038216600090815260026020526040902061116983611055565b6004820155611177836109c1565b60038201556001600160a01b038216156109bc576111958383610459565b6001600160a01b038316600090815260068301602090815260408083209390935560048401546005850190915291902055505050565b600082821115611222576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008261123757506000610558565b8282028284828161124457fe5b04146109fe5760405162461bcd60e51b815260040180806020018281038252602181526020018061175a6021913960400191505060405180910390fd5b60008082116112d7576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816112e057fe5b049392505050565b6000828201838110156109fe576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3b151590565b60006109fe836001600160a01b03841661142c565b600061136830611342565b15905090565b4390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109bc908490611476565b5490565b8154600090821061140a5760405162461bcd60e51b815260040180806020018281038252602281526020018061170a6022913960400191505060405180910390fd5b82600001828154811061141957fe5b9060005260206000200154905092915050565b60006114388383611527565b61146e57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610558565b506000610558565b60606114cb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661153f9092919063ffffffff16565b8051909150156109bc578080602001905160208110156114ea57600080fd5b50516109bc5760405162461bcd60e51b815260040180806020018281038252602a81526020018061179b602a913960400191505060405180910390fd5b60009081526001919091016020526040902054151590565b606061112984846000858561155385611342565b6115a4576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106115e35780518252601f1990920191602091820191016115c4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611645576040519150601f19603f3d011682016040523d82523d6000602084013e61164a565b606091505b509150915061165a828286611665565b979650505050505050565b606083156116745750816109fe565b8251156116845782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156116ce5781810151838201526020016116b6565b50505050905090810190601f1680156116fb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77afe0ca75a69453cb0b466b61dc18822df3c2b64c7a98c661249feb32726a2f795361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220805568b02aebf4daf8da510916083785189f5257d4daaa413cbd929e14b597e664736f6c63430007040033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.