ETH Price: $3,400.88 (-0.93%)

Contract

0x8b8b61AbA6993E8A0Ff2Ef38A86440BB5030eFfc
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040145241602022-04-05 5:54:18966 days ago1649138058IN
 Create: ZoneStakingUpgradeable
0 ETH0.1854414170

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZoneStakingUpgradeable

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 13 : ZoneStakingUpgradeable.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.6;

import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.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/ReentrancyGuardUpgradeable.sol";

import "../lib/access/OwnableUpgradeable.sol";

contract ZoneStakingUpgradeable is OwnableUpgradeable, ReentrancyGuardUpgradeable {
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using SafeMathUpgradeable for uint256;

    struct Type {
        bool enabled;
        uint16 lockDay;
        uint256 rewardRate;
        uint256 stakedAmount;
    }

    struct Stake {
        bool exist;
        uint8 typeIndex;
        uint256 stakedTs;   // timestamp when staked
        uint256 unstakedTs; // timestamp when unstaked
        uint256 stakedAmount;   // token amount user staked
        uint256 rewardAmount;   // reward amount when user unstaked
    }

    uint256 private constant DENOMINATOR = 10000;

    Type[] public types;
    mapping(address => Stake) public stakes;
    uint256 public totalStakedAmount;
    uint256 public totalUnstakedAmount;

    uint256 public stakeLimit;
    uint256 public minStakeAmount;
    bool public earlyUnstakeAllowed;

    IERC20Upgradeable public zoneToken;

    address public governorTimelock;

    uint256 public totalUnstakedAmountWithReward;

    bool public allowBlack;

    event AddType(bool enable, uint16 lockDay, uint256 rewardRate);
    event ChangeType(uint8 typeIndex, bool enable, uint16 lockDay, uint256 rewardRate);
    event SetStakeLimit(uint256 newStakeLimit);
    event SetMinStakeAmount(uint256 newMinStakeAmount);
    event SetEarlyUnstakeAllowed(bool newAllowed);
    event SetVault(address indexed newVault);
    event Staked(address indexed staker, uint256 amount, uint8 typeIndex);
    event Unstaked(address indexed staker, uint256 stakedAmount, uint256 reward);

    modifier onlyOwnerOrCommunity() {
        address sender = _msgSender();
        require((owner() == sender) || (governorTimelock == sender), "The caller should be owner or governor");
        _;
    }

    /**
     * @notice Initializes the contract.
     * @param _ownerAddress Address of owner
     * @param _zoneToken ZONE token address
     * @param _governorTimelock Governor TimeLock address
     * @param _typeEnables enable status of types
     * @param _lockDays lock days
     * @param _rewardRates rewards per day
     */
    function initialize(
        address _ownerAddress,
        address _zoneToken,
        address _governorTimelock,
        bool[] memory _typeEnables,
        uint16[] memory _lockDays,
        uint256[] memory _rewardRates
    ) public initializer {
        require(_ownerAddress != address(0), "Owner address is invalid");

        stakeLimit = 2500000e18; // 2.5M ZONE
        minStakeAmount = 1e18; // 1 ZONE
        earlyUnstakeAllowed = true;

        __Ownable_init(_ownerAddress);
        __ReentrancyGuard_init();
        zoneToken = IERC20Upgradeable(_zoneToken);
        governorTimelock = _governorTimelock;

        _addTypes(_typeEnables, _lockDays, _rewardRates);
    }

    function setGovernorTimelock(address _governorTimelock) external onlyOwner()  {
        governorTimelock = _governorTimelock;
    }

    function getAllTypes() public view returns(bool[] memory enables, uint16[] memory lockDays, uint256[] memory rewardRates) {
        enables = new bool[](types.length);
        lockDays = new uint16[](types.length);
        rewardRates = new uint256[](types.length);

        for (uint i = 0; i < types.length; i ++) {
            enables[i] = types[i].enabled;
            lockDays[i] = types[i].lockDay;
            rewardRates[i] = types[i].rewardRate;
        }
    }

    function addTypes(
        bool[] memory _enables,
        uint16[] memory _lockDays,
        uint256[] memory _rewardRates
    ) external onlyOwner() {
        _addTypes(_enables, _lockDays, _rewardRates);
    }

    function _addTypes(
        bool[] memory _enables,
        uint16[] memory _lockDays,
        uint256[] memory _rewardRates
    ) internal {
        require(
            _lockDays.length == _rewardRates.length
            && _lockDays.length == _enables.length,
            "Mismatched data"
        );
        require((types.length + _lockDays.length) <= type(uint8).max, "Too much");

        for (uint256 i = 0; i < _lockDays.length; i ++) {
            require(_rewardRates[i] < DENOMINATOR/2, "Too large rewardRate");
            Type memory _type = Type({
                enabled: _enables[i],
                lockDay: _lockDays[i],
                rewardRate: _rewardRates[i],
                stakedAmount: 0
            });
            types.push(_type);
            emit AddType (_type.enabled, _type.lockDay, _type.rewardRate);
        }
    }

    function changeType(
        uint8 _typeIndex,
        bool _enable,
        uint16 _lockDay,
        uint256 _rewardRate
    ) external onlyOwnerOrCommunity() {
        require(_typeIndex < types.length, "Invalid typeIndex");
        require(_rewardRate < DENOMINATOR/2, "Too large rewardRate");

        Type storage _type = types[_typeIndex];
        _type.enabled = _enable;
        _type.lockDay = _lockDay;
        _type.rewardRate = _rewardRate;
        emit ChangeType (_typeIndex, _type.enabled, _type.lockDay, _type.rewardRate);
    }

    function leftCapacity() public view returns(uint256) {
        uint256 spent = totalUnstakedAmountWithReward.add(totalStakedAmount).sub(totalUnstakedAmount);
        return stakeLimit.sub(spent);
    }

    function isStaked(address account) public view returns (bool) {
        return (stakes[account].exist && stakes[account].unstakedTs == 0) ? true : false;
    }

    function setStakeLimit(uint256 _stakeLimit) external onlyOwnerOrCommunity() {
        uint256 spent = totalUnstakedAmountWithReward.add(totalStakedAmount).sub(totalUnstakedAmount);
        require(spent <= _stakeLimit, "The limit is too small");
        stakeLimit = _stakeLimit;
        emit SetStakeLimit(stakeLimit);
    }

    function setMinStakeAmount(uint256 _minStakeAmount) external onlyOwnerOrCommunity() {
        minStakeAmount = _minStakeAmount;
        emit SetMinStakeAmount(minStakeAmount);
    }

    function setEarlyUnstakeAllowed(bool allow) external onlyOwnerOrCommunity() {
        earlyUnstakeAllowed = allow;
        emit SetEarlyUnstakeAllowed(earlyUnstakeAllowed);
    }

    function startStake(uint256 amount, uint8 typeIndex) external nonReentrant() {
        address staker = _msgSender();
        uint256 capacity = leftCapacity();
        require(0 < capacity, "Already closed");
        require(isStaked(staker) == false, "Already staked");
        require(minStakeAmount <= amount, "The staking amount is too small");
        require(amount <= capacity, "Exceed the staking limit");
        require(typeIndex < types.length, "Invalid typeIndex");
        require(types[typeIndex].enabled, "The type disabled");

        zoneToken.safeTransferFrom(staker, address(this), amount);

        stakes[staker] = Stake({
            exist: true,
            typeIndex: typeIndex,
            stakedTs: block.timestamp,
            unstakedTs: 0,
            stakedAmount: amount,
            rewardAmount: 0
        });
        totalStakedAmount = totalStakedAmount.add(amount);
        types[typeIndex].stakedAmount = types[typeIndex].stakedAmount.add(amount);

        emit Staked(staker, amount, typeIndex);
    }

    function endStake() external nonReentrant() {
        address staker = _msgSender();
        require(isStaked(staker), "Not staked");
        require(allowBlack || staker != 0x83b4271b054818a93325c7299f006AEc2E90ef96, "Blacklisted");

        uint8 typeIndex = stakes[staker].typeIndex;
        uint256 stakedAmount = stakes[staker].stakedAmount;
        (uint256 claimIn, uint256 reward) = _calcReward(stakes[staker].stakedTs, stakedAmount, typeIndex);
        require(earlyUnstakeAllowed || claimIn == 0, "Locked still");
        stakes[staker].unstakedTs = block.timestamp;
        stakes[staker].rewardAmount = (claimIn == 0) ? reward : 0;

        totalUnstakedAmount = totalUnstakedAmount.add(stakedAmount);
        if (0 < stakes[staker].rewardAmount) {
            totalUnstakedAmountWithReward = totalUnstakedAmountWithReward.add(stakedAmount);
        }
        types[typeIndex].stakedAmount = types[typeIndex].stakedAmount.sub(stakedAmount);

        zoneToken.safeTransfer(staker, stakedAmount.add(stakes[staker].rewardAmount));

        emit Unstaked(staker, stakedAmount, stakes[staker].rewardAmount);
    }

    function _calcReward(
        uint256 stakedTs,
        uint256 stakedAmount,
        uint8 typeIndex
    ) internal view returns (uint256 claimIn, uint256 rewardAmount) {
        if (types[typeIndex].enabled == false) {
            return (0, 0);
        }

        uint256 unlockTs = stakedTs + (types[typeIndex].lockDay * 1 days);
        claimIn = (block.timestamp < unlockTs) ? unlockTs - block.timestamp : 0;
        rewardAmount = stakedAmount.mul(types[typeIndex].rewardRate).div(DENOMINATOR);
        return (claimIn, rewardAmount);
    }

    function getStakeInfo(
        address staker
    ) external view returns (uint256 stakedAmount, uint8 typeIndex, uint256 claimIn, uint256 rewardAmount, uint256 capacity) {
        Stake memory stake = stakes[staker];
        if (isStaked(staker)) {
            stakedAmount = stake.stakedAmount;
            typeIndex = stake.typeIndex;
            (claimIn, rewardAmount) = _calcReward(stake.stakedTs, stake.stakedAmount, stake.typeIndex);
            return (stakedAmount, typeIndex, claimIn, rewardAmount, 0);
        }
        return (0, 0, 0, 0, leftCapacity());
    }

    function fund(address _from, uint256 _amount) external {
        require(_from != address(0), '_from is invalid');
        require(0 < _amount, '_amount is invalid');
        require(_amount <= zoneToken.balanceOf(_from), 'Insufficient balance');
        zoneToken.safeTransferFrom(_from, address(this), _amount);
    }

    function finish() external onlyOwner() {
        for (uint i = 0; i < types.length; i ++) {
            if (types[i].enabled) {
                types[i].enabled = false;
            }
        }
        uint256 amount = zoneToken.balanceOf(address(this));
        amount = amount.add(totalUnstakedAmount).sub(totalStakedAmount);
        if (0 < amount) {
            zoneToken.safeTransfer(owner(), amount);
        }
    }

    function setAllowBlack(bool allow) external onlyOwner() {
        allowBlack = allow;
    }
}

contract ZoneStakingUpgradeableProxy is TransparentUpgradeableProxy {
    constructor(address logic, address admin, bytes memory data) TransparentUpgradeableProxy(logic, admin, data) public {
    }
}

File 2 of 13 : TransparentUpgradeableProxy.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./UpgradeableProxy.sol";

/**
 * @dev This contract implements a proxy that is upgradeable by an admin.
 *
 * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
 * clashing], which can potentially be used in an attack, this contract uses the
 * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
 * things that go hand in hand:
 *
 * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
 * that call matches one of the admin functions exposed by the proxy itself.
 * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
 * implementation. If the admin tries to call a function on the implementation it will fail with an error that says
 * "admin cannot fallback to proxy target".
 *
 * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
 * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
 * to sudden errors when trying to call a function from the proxy implementation.
 *
 * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
 * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.
 */
contract TransparentUpgradeableProxy is UpgradeableProxy {
    /**
     * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
     * optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
     */
    constructor(address _logic, address admin_, bytes memory _data) public payable UpgradeableProxy(_logic, _data) {
        assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
        _setAdmin(admin_);
    }

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
     */
    modifier ifAdmin() {
        if (msg.sender == _admin()) {
            _;
        } else {
            _fallback();
        }
    }

    /**
     * @dev Returns the current admin.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function admin() external ifAdmin returns (address admin_) {
        admin_ = _admin();
    }

    /**
     * @dev Returns the current implementation.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
     * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
     */
    function implementation() external ifAdmin returns (address implementation_) {
        implementation_ = _implementation();
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
     */
    function changeAdmin(address newAdmin) external virtual ifAdmin {
        require(newAdmin != address(0), "TransparentUpgradeableProxy: new admin is the zero address");
        emit AdminChanged(_admin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev Upgrade the implementation of the proxy.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
     */
    function upgradeTo(address newImplementation) external virtual ifAdmin {
        _upgradeTo(newImplementation);
    }

    /**
     * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
     * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
     * proxied contract.
     *
     * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
     */
    function upgradeToAndCall(address newImplementation, bytes calldata data) external payable virtual ifAdmin {
        _upgradeTo(newImplementation);
        Address.functionDelegateCall(newImplementation, data);
    }

    /**
     * @dev Returns the current admin.
     */
    function _admin() internal view virtual returns (address adm) {
        bytes32 slot = _ADMIN_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            adm := sload(slot)
        }
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        bytes32 slot = _ADMIN_SLOT;

        // solhint-disable-next-line no-inline-assembly
        assembly {
            sstore(slot, newAdmin)
        }
    }

    /**
     * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
     */
    function _beforeFallback() internal virtual override {
        require(msg.sender != _admin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target");
        super._beforeFallback();
    }
}

File 3 of 13 : 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 13 : 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 13 : 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 13 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal initializer {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal initializer {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 7 of 13 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;
    address private _pendingOwner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init(address _ownerAddress) internal initializer {
        __Context_init_unchained();
        __Ownable_init_unchained(_ownerAddress);
    }

    function __Ownable_init_unchained(address _ownerAddress) internal initializer {
        _owner = _ownerAddress;
        emit OwnershipTransferred(address(0), _ownerAddress);
    }

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

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function safeTransferOwnership(address newOwner, bool safely) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        if (safely) {
            _pendingOwner = newOwner;
        } else {
            emit OwnershipTransferred(_owner, newOwner);
            _owner = newOwner;
            _pendingOwner = address(0);
        }
    }

    function safeAcceptOwnership() public virtual {
        require(_msgSender() == _pendingOwner, "acceptOwnership: Call must come from pendingOwner.");
        emit OwnershipTransferred(_owner, _pendingOwner);
        _owner = _pendingOwner;
    }

    uint256[48] private __gap;
}

File 8 of 13 : UpgradeableProxy.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./Proxy.sol";
import "../utils/Address.sol";

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 *
 * Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
 * {TransparentUpgradeableProxy}.
 */
contract UpgradeableProxy is Proxy {
    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
     *
     * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
     * function call, and allows initializating the storage of the proxy like a Solidity constructor.
     */
    constructor(address _logic, bytes memory _data) public payable {
        assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
        _setImplementation(_logic);
        if(_data.length > 0) {
            Address.functionDelegateCall(_logic, _data);
        }
    }

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation address.
     */
    function _implementation() internal view virtual override returns (address impl) {
        bytes32 slot = _IMPLEMENTATION_SLOT;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            impl := sload(slot)
        }
    }

    /**
     * @dev Upgrades the proxy to a new implementation.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal virtual {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "UpgradeableProxy: new implementation is not a contract");

        bytes32 slot = _IMPLEMENTATION_SLOT;

        // solhint-disable-next-line no-inline-assembly
        assembly {
            sstore(slot, newImplementation)
        }
    }
}

File 9 of 13 : Proxy.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 { revert(0, returndatasize()) }
            default { return(0, returndatasize()) }
        }
    }

    /**
     * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
     * and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _beforeFallback();
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback () external payable virtual {
        _fallback();
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
     * is empty.
     */
    receive () external payable virtual {
        _fallback();
    }

    /**
     * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
     * call, or as part of the Solidity `fallback` or `receive` functions.
     *
     * If overriden should call `super._beforeFallback()`.
     */
    function _beforeFallback() internal virtual {
    }
}

File 10 of 13 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(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 11 of 13 : 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 12 of 13 : 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 13 of 13 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;
import "../proxy/Initializable.sol";

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal initializer {
        __Context_init_unchained();
    }

    function __Context_init_unchained() internal initializer {
    }
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
    uint256[50] private __gap;
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enable","type":"bool"},{"indexed":false,"internalType":"uint16","name":"lockDay","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"AddType","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"typeIndex","type":"uint8"},{"indexed":false,"internalType":"bool","name":"enable","type":"bool"},{"indexed":false,"internalType":"uint16","name":"lockDay","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"ChangeType","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"newAllowed","type":"bool"}],"name":"SetEarlyUnstakeAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMinStakeAmount","type":"uint256"}],"name":"SetMinStakeAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newStakeLimit","type":"uint256"}],"name":"SetStakeLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newVault","type":"address"}],"name":"SetVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint8","name":"typeIndex","type":"uint8"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[{"internalType":"bool[]","name":"_enables","type":"bool[]"},{"internalType":"uint16[]","name":"_lockDays","type":"uint16[]"},{"internalType":"uint256[]","name":"_rewardRates","type":"uint256[]"}],"name":"addTypes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowBlack","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_typeIndex","type":"uint8"},{"internalType":"bool","name":"_enable","type":"bool"},{"internalType":"uint16","name":"_lockDay","type":"uint16"},{"internalType":"uint256","name":"_rewardRate","type":"uint256"}],"name":"changeType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyUnstakeAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finish","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"fund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllTypes","outputs":[{"internalType":"bool[]","name":"enables","type":"bool[]"},{"internalType":"uint16[]","name":"lockDays","type":"uint16[]"},{"internalType":"uint256[]","name":"rewardRates","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"getStakeInfo","outputs":[{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint8","name":"typeIndex","type":"uint8"},{"internalType":"uint256","name":"claimIn","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"capacity","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governorTimelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ownerAddress","type":"address"},{"internalType":"address","name":"_zoneToken","type":"address"},{"internalType":"address","name":"_governorTimelock","type":"address"},{"internalType":"bool[]","name":"_typeEnables","type":"bool[]"},{"internalType":"uint16[]","name":"_lockDays","type":"uint16[]"},{"internalType":"uint256[]","name":"_rewardRates","type":"uint256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"leftCapacity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"safeAcceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"bool","name":"safely","type":"bool"}],"name":"safeTransferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"allow","type":"bool"}],"name":"setAllowBlack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"allow","type":"bool"}],"name":"setEarlyUnstakeAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governorTimelock","type":"address"}],"name":"setGovernorTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minStakeAmount","type":"uint256"}],"name":"setMinStakeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeLimit","type":"uint256"}],"name":"setStakeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"bool","name":"exist","type":"bool"},{"internalType":"uint8","name":"typeIndex","type":"uint8"},{"internalType":"uint256","name":"stakedTs","type":"uint256"},{"internalType":"uint256","name":"unstakedTs","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"typeIndex","type":"uint8"}],"name":"startStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalStakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnstakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnstakedAmountWithReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"types","outputs":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"uint16","name":"lockDay","type":"uint16"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"zoneToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50612ef5806100206000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c8063877d68a21161010f578063d56b2889116100a2578063ee30a4f011610071578063ee30a4f014610910578063ef70662214610918578063f188768414610950578063f339fc3114610958576101f0565b8063d56b2889146108db578063e1004c7e146108e3578063e30c3978146108eb578063eb4af045146108f3576101f0565b8063af012c74116100de578063af012c7414610830578063bcee761214610838578063c345315314610840578063cefbfa3614610893576101f0565b8063877d68a2146107fb5780638ac1bd0a146108035780638da5cb5b1461080b578063a1c9b21314610813576101f0565b8063567e98f911610187578063715018a611610156578063715018a61461045c57806377994b05146104645780637b1837de14610609578063861321bb14610635576101f0565b8063567e98f9146103ec5780635a7f7ff5146103f45780636177fd18146103fc5780636fd0d88814610436576101f0565b80633ad0e5e2116101c35780633ad0e5e21461037357806345ef79af146103975780634d03cb101461039f57806353424674146103be576101f0565b806309dddcf0146101f5578063166ad6ca146102db57806316934fc4146102f557806331cfc3e114610352575b600080fd5b6101fd61097e565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561024557818101518382015260200161022d565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561028457818101518382015260200161026c565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156102c35781810151838201526020016102ab565b50505050905001965050505050505060405180910390f35b6102e3610b3e565b60408051918252519081900360200190f35b61031b6004803603602081101561030b57600080fd5b50356001600160a01b0316610b44565b60408051961515875260ff9095166020870152858501939093526060850191909152608084015260a0830152519081900360c00190f35b6103716004803603602081101561036857600080fd5b50351515610b7b565b005b61037b610c43565b604080516001600160a01b039092168252519081900360200190f35b6102e3610c57565b610371600480360360208110156103b557600080fd5b50351515610c5d565b610371600480360360408110156103d457600080fd5b506001600160a01b0381351690602001351515610cd2565b6102e3610df3565b610371610df9565b6104226004803603602081101561041257600080fd5b50356001600160a01b0316610ea3565b604080519115158252519081900360200190f35b6103716004803603602081101561044c57600080fd5b50356001600160a01b0316610ef8565b610371610f7c565b6103716004803603606081101561047a57600080fd5b810190602081018135600160201b81111561049457600080fd5b8201836020820111156104a657600080fd5b803590602001918460208302840111600160201b831117156104c757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561051657600080fd5b82018360208201111561052857600080fd5b803590602001918460208302840111600160201b8311171561054957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561059857600080fd5b8201836020820111156105aa57600080fd5b803590602001918460208302840111600160201b831117156105cb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611016945050505050565b6103716004803603604081101561061f57600080fd5b506001600160a01b038135169060200135611088565b610371600480360360c081101561064b57600080fd5b6001600160a01b0382358116926020810135821692604082013590921691810190608081016060820135600160201b81111561068657600080fd5b82018360208201111561069857600080fd5b803590602001918460208302840111600160201b831117156106b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561070857600080fd5b82018360208201111561071a57600080fd5b803590602001918460208302840111600160201b8311171561073b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561078a57600080fd5b82018360208201111561079c57600080fd5b803590602001918460208302840111600160201b831117156107bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611216945050505050565b6102e361139c565b6104226113a2565b61037b6113ab565b6103716004803603602081101561082957600080fd5b50356113ba565b6102e36114e7565b61037161151d565b6108666004803603602081101561085657600080fd5b50356001600160a01b0316611869565b6040805195865260ff90941660208601528484019290925260608401526080830152519081900360a00190f35b6108b0600480360360208110156108a957600080fd5b5035611936565b60408051941515855261ffff9093166020850152838301919091526060830152519081900360800190f35b610371611978565b61037b611b07565b61037b611b16565b6103716004803603602081101561090957600080fd5b5035611b25565b610422611bdc565b6103716004803603608081101561092e57600080fd5b5060ff81351690602081013515159061ffff6040820135169060600135611be5565b6102e3611da5565b6103716004803603604081101561096e57600080fd5b508035906020013560ff16611dab565b606080606060978054905067ffffffffffffffff8111801561099f57600080fd5b506040519080825280602002602001820160405280156109c9578160200160208202803683370190505b5060975490935067ffffffffffffffff811180156109e657600080fd5b50604051908082528060200260200182016040528015610a10578160200160208202803683370190505b5060975490925067ffffffffffffffff81118015610a2d57600080fd5b50604051908082528060200260200182016040528015610a57578160200160208202803683370190505b50905060005b609754811015610b385760978181548110610a7457fe5b6000918252602090912060039091020154845160ff90911690859083908110610a9957fe5b60200260200101901515908115158152505060978181548110610ab857fe5b906000526020600020906003020160000160019054906101000a900461ffff16838281518110610ae457fe5b602002602001019061ffff16908161ffff168152505060978181548110610b0757fe5b906000526020600020906003020160010154828281518110610b2557fe5b6020908102919091010152600101610a5d565b50909192565b609a5481565b6098602052600090815260409020805460018201546002830154600384015460049094015460ff8085169561010090950416939086565b6000610b85612188565b9050806001600160a01b0316610b996113ab565b6001600160a01b03161480610bbb5750609e546001600160a01b038281169116145b610bf65760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b609d805460ff191683151517908190556040805160ff90921615158252517fa0de32eae3f0d0e64ac7dbaf4cb273b018d93f236e6f91d417dbeabb8acab3ab916020908290030190a15050565b609d5461010090046001600160a01b031681565b609b5481565b610c65612188565b6001600160a01b0316610c766113ab565b6001600160a01b031614610cbf576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b60a0805460ff1916911515919091179055565b610cda612188565b6001600160a01b0316610ceb6113ab565b6001600160a01b031614610d34576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b6001600160a01b038216610d795760405162461bcd60e51b8152600401808060200182810382526026815260200180612d636026913960400191505060405180910390fd5b8015610d9f57603480546001600160a01b0319166001600160a01b038416179055610def565b6033546040516001600160a01b03808516921690600080516020612e7683398151915290600090a3603380546001600160a01b0384166001600160a01b0319918216179091556034805490911690555b5050565b60995481565b6034546001600160a01b0316610e0d612188565b6001600160a01b031614610e525760405162461bcd60e51b8152600401808060200182810382526032815260200180612dd56032913960400191505060405180910390fd5b6034546033546040516001600160a01b039283169290911690600080516020612e7683398151915290600090a3603454603380546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b03811660009081526098602052604081205460ff168015610ee457506001600160a01b038216600090815260986020526040902060020154155b610eef576000610ef2565b60015b92915050565b610f00612188565b6001600160a01b0316610f116113ab565b6001600160a01b031614610f5a576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b609e80546001600160a01b0319166001600160a01b0392909216919091179055565b610f84612188565b6001600160a01b0316610f956113ab565b6001600160a01b031614610fde576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020612e76833981519152908390a3603380546001600160a01b0319169055565b61101e612188565b6001600160a01b031661102f6113ab565b6001600160a01b031614611078576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b61108383838361218c565b505050565b6001600160a01b0382166110d6576040805162461bcd60e51b815260206004820152601060248201526f17d99c9bdb481a5cc81a5b9d985b1a5960821b604482015290519081900360640190fd5b80600010611120576040805162461bcd60e51b815260206004820152601260248201527117d85b5bdd5b9d081a5cc81a5b9d985b1a5960721b604482015290519081900360640190fd5b609d60019054906101000a90046001600160a01b03166001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561118257600080fd5b505afa158015611196573d6000803e3d6000fd5b505050506040513d60208110156111ac57600080fd5b50518111156111f9576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b609d54610def9061010090046001600160a01b0316833084612409565b600054610100900460ff168061122f575061122f612463565b8061123d575060005460ff16155b6112785760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff161580156112a3576000805460ff1961ff0019909116610100171660011790555b6001600160a01b0387166112fe576040805162461bcd60e51b815260206004820152601860248201527f4f776e6572206164647265737320697320696e76616c69640000000000000000604482015290519081900360640190fd5b6a0211654585005212800000609b55670de0b6b3a7640000609c55609d805460ff1916600117905561132f87612474565b611337612527565b609d8054610100600160a81b0319166101006001600160a01b038981169190910291909117909155609e80546001600160a01b03191691871691909117905561138184848461218c565b8015611393576000805461ff00191690555b50505050505050565b609f5481565b609d5460ff1681565b6033546001600160a01b031690565b60006113c4612188565b9050806001600160a01b03166113d86113ab565b6001600160a01b031614806113fa5750609e546001600160a01b038281169116145b6114355760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b600061145a609a54611454609954609f546125d090919063ffffffff16565b90612631565b9050828111156114aa576040805162461bcd60e51b8152602060048201526016602482015275151a19481b1a5b5a5d081a5cc81d1bdbc81cdb585b1b60521b604482015290519081900360640190fd5b609b8390556040805184815290517fd9a9a09fc16faafb71aa791b06aaf1f32e3ae9078035dc57c6cac185142685cd9181900360200190a1505050565b600080611507609a54611454609954609f546125d090919063ffffffff16565b609b549091506115179082612631565b91505090565b60026065541415611575576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026065556000611584612188565b905061158f81610ea3565b6115cd576040805162461bcd60e51b815260206004820152600a602482015269139bdd081cdd185ad95960b21b604482015290519081900360640190fd5b60a05460ff16806115fb57507383b4271b054818a93325c7299f006aec2e90ef966001600160a01b03821614155b61163a576040805162461bcd60e51b815260206004820152600b60248201526a109b1858dadb1a5cdd195960aa1b604482015290519081900360640190fd5b6001600160a01b03811660009081526098602052604081208054600382015460019092015461010090910460ff169290819061167790848661268e565b609d54919350915060ff168061168b575081155b6116cb576040805162461bcd60e51b815260206004820152600c60248201526b131bd8dad959081cdd1a5b1b60a21b604482015290519081900360640190fd5b6001600160a01b03851660009081526098602052604090204260029091015581156116f75760006116f9565b805b6001600160a01b038616600090815260986020526040902060040155609a5461172290846125d0565b609a556001600160a01b0385166000908152609860205260409020600401541561175757609f5461175390846125d0565b609f555b61178b8360978660ff168154811061176b57fe5b90600052602060002090600302016002015461263190919063ffffffff16565b60978560ff168154811061179b57fe5b906000526020600020906003020160020181905550611807856117ef60986000896001600160a01b03166001600160a01b0316815260200190815260200160002060040154866125d090919063ffffffff16565b609d5461010090046001600160a01b03169190612768565b6001600160a01b0385166000818152609860209081526040918290206004015482518781529182015281517f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e929181900390910190a250506001606555505050565b6001600160a01b0381166000908152609860209081526040808320815160c081018352815460ff80821615158352610100909104169381019390935260018101549183019190915260028101546060830152600381015460808301526004015460a082015281908190819081906118df87610ea3565b1561191357608081015160208201516040830151919750955061190390878761268e565b90945092506000915061192d9050565b6000806000806119216114e7565b95509550955095509550505b91939590929450565b6097818154811061194657600080fd5b600091825260209091206003909102018054600182015460029092015460ff8216935061010090910461ffff16919084565b611980612188565b6001600160a01b03166119916113ab565b6001600160a01b0316146119da576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b60005b609754811015611a4457609781815481106119f457fe5b600091825260209091206003909102015460ff1615611a3c57600060978281548110611a1c57fe5b60009182526020909120600390910201805460ff19169115159190911790555b6001016119dd565b50609d54604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611a9557600080fd5b505afa158015611aa9573d6000803e3d6000fd5b505050506040513d6020811015611abf57600080fd5b5051609954609a54919250611ad9916114549084906125d0565b90508015611b0457611b04611aec6113ab565b609d5461010090046001600160a01b03169083612768565b50565b609e546001600160a01b031681565b6034546001600160a01b031690565b6000611b2f612188565b9050806001600160a01b0316611b436113ab565b6001600160a01b03161480611b655750609e546001600160a01b038281169116145b611ba05760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b609c8290556040805183815290517f6e4bcc82cb4b918df6b911c8092c49f027b7d409733e2c97bb0a4b5a367e19db9181900360200190a15050565b60a05460ff1681565b6000611bef612188565b9050806001600160a01b0316611c036113ab565b6001600160a01b03161480611c255750609e546001600160a01b038281169116145b611c605760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b60975460ff861610611cad576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b6113888210611cfa576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b600060978660ff1681548110611d0c57fe5b600091825260209182902060039190910201805460ff19168715151762ffff00191661010061ffff888116820292909217808455600184018890556040805160ff8d8116825283161515968101969096529190049091168382015260608301869052519092507f72a38eea1f38f2d28e765e3ec3da350219bbac1187a20efd23795391d910bfdf916080908290030190a1505050505050565b609c5481565b60026065541415611e03576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026065556000611e12612188565b90506000611e1e6114e7565b905080600010611e66576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e4818db1bdcd95960921b604482015290519081900360640190fd5b611e6f82610ea3565b15611eb2576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481cdd185ad95960921b604482015290519081900360640190fd5b83609c541115611f09576040805162461bcd60e51b815260206004820152601f60248201527f546865207374616b696e6720616d6f756e7420697320746f6f20736d616c6c00604482015290519081900360640190fd5b80841115611f5e576040805162461bcd60e51b815260206004820152601860248201527f45786365656420746865207374616b696e67206c696d69740000000000000000604482015290519081900360640190fd5b60975460ff841610611fab576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b60978360ff1681548110611fbb57fe5b600091825260209091206003909102015460ff16612014576040805162461bcd60e51b8152602060048201526011602482015270151a19481d1e5c1948191a5cd8589b1959607a1b604482015290519081900360640190fd5b609d546120319061010090046001600160a01b0316833087612409565b6040805160c081018252600180825260ff868116602080850191825242858701908152600060608701818152608088018d815260a089018381526001600160a01b038d16845260989095529890912096518754945160ff199095169015151761ff0019166101009490951693909302939093178555915192840192909255905160028301559151600382015590516004909101556099546120d290856125d0565b60998190555061210c8460978560ff16815481106120ec57fe5b9060005260206000209060030201600201546125d090919063ffffffff16565b60978460ff168154811061211c57fe5b906000526020600020906003020160020181905550816001600160a01b03167f8acf475137e0cd74ca7f611d16b1e6383ec9a9c71a8e5b85967781b9c7214d118585604051808381526020018260ff1681526020019250505060405180910390a2505060016065555050565b3390565b8051825114801561219e575082518251145b6121e1576040805162461bcd60e51b815260206004820152600f60248201526e4d69736d617463686564206461746160881b604482015290519081900360640190fd5b815160975460ff91011115612228576040805162461bcd60e51b81526020600482015260086024820152670a8dede40daeac6d60c31b604482015290519081900360640190fd5b60005b82518110156124035760026127100482828151811061224657fe5b602002602001015110612297576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b600060405180608001604052808684815181106122b057fe5b6020026020010151151581526020018584815181106122cb57fe5b602002602001015161ffff1681526020018484815181106122e857fe5b6020908102919091018101518252600091810182905260978054600181018255925282517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff9600390930292830180548584015160ff1990911692151592831762ffff00191661010061ffff909216918202179091556040808601517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffa86018190556060808801517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffb909701969096558151938452938301919091528181019290925290519293507f78d782a4d9e33a46c20a0def9e9253843ce1b0434604e52b451eaa17245c3685929081900390910190a15060010161222b565b50505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526124039085906127b6565b600061246e30612867565b15905090565b600054610100900460ff168061248d575061248d612463565b8061249b575060005460ff16155b6124d65760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff16158015612501576000805460ff1961ff0019909116610100171660011790555b61250961286d565b6125128261290d565b8015610def576000805461ff00191690555050565b600054610100900460ff16806125405750612540612463565b8061254e575060005460ff16155b6125895760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff161580156125b4576000805460ff1961ff0019909116610100171660011790555b6125bc6129e6565b8015611b04576000805461ff001916905550565b60008282018381101561262a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600082821115612688576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008060978360ff16815481106126a157fe5b600091825260209091206003909102015460ff166126c457506000905080612760565b600060978460ff16815481106126d657fe5b906000526020600020906003020160000160019054906101000a900461ffff1661ffff16620151800262ffffff168601905080421061271657600061271a565b4281035b925061275c61271061275660978760ff168154811061273557fe5b90600052602060002090600302016001015488612a8c90919063ffffffff16565b90612ae5565b9150505b935093915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110839084905b600061280b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b4c9092919063ffffffff16565b8051909150156110835780806020019051602081101561282a57600080fd5b50516110835760405162461bcd60e51b815260040180806020018281038252602a815260200180612e96602a913960400191505060405180910390fd5b3b151590565b600054610100900460ff16806128865750612886612463565b80612894575060005460ff16155b6128cf5760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff161580156125bc576000805460ff1961ff0019909116610100171660011790558015611b04576000805461ff001916905550565b600054610100900460ff16806129265750612926612463565b80612934575060005460ff16155b61296f5760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff1615801561299a576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b038416908117909155604051600090600080516020612e76833981519152908290a38015610def576000805461ff00191690555050565b600054610100900460ff16806129ff57506129ff612463565b80612a0d575060005460ff16155b612a485760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff16158015612a73576000805460ff1961ff0019909116610100171660011790555b60016065558015611b04576000805461ff001916905550565b600082612a9b57506000610ef2565b82820282848281612aa857fe5b041461262a5760405162461bcd60e51b8152600401808060200182810382526021815260200180612e356021913960400191505060405180910390fd5b6000808211612b3b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612b4457fe5b049392505050565b6060612b5b8484600085612b63565b949350505050565b606082471015612ba45760405162461bcd60e51b8152600401808060200182810382526026815260200180612d896026913960400191505060405180910390fd5b612bad85612867565b612bfe576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612c3c5780518252601f199092019160209182019101612c1d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612c9e576040519150601f19603f3d011682016040523d82523d6000602084013e612ca3565b606091505b5091509150612cb3828286612cbe565b979650505050505050565b60608315612ccd57508161262a565b825115612cdd5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d27578181015183820152602001612d0f565b50505050905090810190601f168015612d545780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5468652063616c6c65722073686f756c64206265206f776e6572206f7220676f7665726e6f726163636570744f776e6572736869703a2043616c6c206d75737420636f6d652066726f6d2070656e64696e674f776e65722e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220fe89e9eb6040d5af5b9100187da5bb4dc1c56c8274fe836b494c71cf365a9c7c64736f6c63430007060033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063877d68a21161010f578063d56b2889116100a2578063ee30a4f011610071578063ee30a4f014610910578063ef70662214610918578063f188768414610950578063f339fc3114610958576101f0565b8063d56b2889146108db578063e1004c7e146108e3578063e30c3978146108eb578063eb4af045146108f3576101f0565b8063af012c74116100de578063af012c7414610830578063bcee761214610838578063c345315314610840578063cefbfa3614610893576101f0565b8063877d68a2146107fb5780638ac1bd0a146108035780638da5cb5b1461080b578063a1c9b21314610813576101f0565b8063567e98f911610187578063715018a611610156578063715018a61461045c57806377994b05146104645780637b1837de14610609578063861321bb14610635576101f0565b8063567e98f9146103ec5780635a7f7ff5146103f45780636177fd18146103fc5780636fd0d88814610436576101f0565b80633ad0e5e2116101c35780633ad0e5e21461037357806345ef79af146103975780634d03cb101461039f57806353424674146103be576101f0565b806309dddcf0146101f5578063166ad6ca146102db57806316934fc4146102f557806331cfc3e114610352575b600080fd5b6101fd61097e565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561024557818101518382015260200161022d565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561028457818101518382015260200161026c565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156102c35781810151838201526020016102ab565b50505050905001965050505050505060405180910390f35b6102e3610b3e565b60408051918252519081900360200190f35b61031b6004803603602081101561030b57600080fd5b50356001600160a01b0316610b44565b60408051961515875260ff9095166020870152858501939093526060850191909152608084015260a0830152519081900360c00190f35b6103716004803603602081101561036857600080fd5b50351515610b7b565b005b61037b610c43565b604080516001600160a01b039092168252519081900360200190f35b6102e3610c57565b610371600480360360208110156103b557600080fd5b50351515610c5d565b610371600480360360408110156103d457600080fd5b506001600160a01b0381351690602001351515610cd2565b6102e3610df3565b610371610df9565b6104226004803603602081101561041257600080fd5b50356001600160a01b0316610ea3565b604080519115158252519081900360200190f35b6103716004803603602081101561044c57600080fd5b50356001600160a01b0316610ef8565b610371610f7c565b6103716004803603606081101561047a57600080fd5b810190602081018135600160201b81111561049457600080fd5b8201836020820111156104a657600080fd5b803590602001918460208302840111600160201b831117156104c757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561051657600080fd5b82018360208201111561052857600080fd5b803590602001918460208302840111600160201b8311171561054957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561059857600080fd5b8201836020820111156105aa57600080fd5b803590602001918460208302840111600160201b831117156105cb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611016945050505050565b6103716004803603604081101561061f57600080fd5b506001600160a01b038135169060200135611088565b610371600480360360c081101561064b57600080fd5b6001600160a01b0382358116926020810135821692604082013590921691810190608081016060820135600160201b81111561068657600080fd5b82018360208201111561069857600080fd5b803590602001918460208302840111600160201b831117156106b957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561070857600080fd5b82018360208201111561071a57600080fd5b803590602001918460208302840111600160201b8311171561073b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561078a57600080fd5b82018360208201111561079c57600080fd5b803590602001918460208302840111600160201b831117156107bd57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611216945050505050565b6102e361139c565b6104226113a2565b61037b6113ab565b6103716004803603602081101561082957600080fd5b50356113ba565b6102e36114e7565b61037161151d565b6108666004803603602081101561085657600080fd5b50356001600160a01b0316611869565b6040805195865260ff90941660208601528484019290925260608401526080830152519081900360a00190f35b6108b0600480360360208110156108a957600080fd5b5035611936565b60408051941515855261ffff9093166020850152838301919091526060830152519081900360800190f35b610371611978565b61037b611b07565b61037b611b16565b6103716004803603602081101561090957600080fd5b5035611b25565b610422611bdc565b6103716004803603608081101561092e57600080fd5b5060ff81351690602081013515159061ffff6040820135169060600135611be5565b6102e3611da5565b6103716004803603604081101561096e57600080fd5b508035906020013560ff16611dab565b606080606060978054905067ffffffffffffffff8111801561099f57600080fd5b506040519080825280602002602001820160405280156109c9578160200160208202803683370190505b5060975490935067ffffffffffffffff811180156109e657600080fd5b50604051908082528060200260200182016040528015610a10578160200160208202803683370190505b5060975490925067ffffffffffffffff81118015610a2d57600080fd5b50604051908082528060200260200182016040528015610a57578160200160208202803683370190505b50905060005b609754811015610b385760978181548110610a7457fe5b6000918252602090912060039091020154845160ff90911690859083908110610a9957fe5b60200260200101901515908115158152505060978181548110610ab857fe5b906000526020600020906003020160000160019054906101000a900461ffff16838281518110610ae457fe5b602002602001019061ffff16908161ffff168152505060978181548110610b0757fe5b906000526020600020906003020160010154828281518110610b2557fe5b6020908102919091010152600101610a5d565b50909192565b609a5481565b6098602052600090815260409020805460018201546002830154600384015460049094015460ff8085169561010090950416939086565b6000610b85612188565b9050806001600160a01b0316610b996113ab565b6001600160a01b03161480610bbb5750609e546001600160a01b038281169116145b610bf65760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b609d805460ff191683151517908190556040805160ff90921615158252517fa0de32eae3f0d0e64ac7dbaf4cb273b018d93f236e6f91d417dbeabb8acab3ab916020908290030190a15050565b609d5461010090046001600160a01b031681565b609b5481565b610c65612188565b6001600160a01b0316610c766113ab565b6001600160a01b031614610cbf576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b60a0805460ff1916911515919091179055565b610cda612188565b6001600160a01b0316610ceb6113ab565b6001600160a01b031614610d34576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b6001600160a01b038216610d795760405162461bcd60e51b8152600401808060200182810382526026815260200180612d636026913960400191505060405180910390fd5b8015610d9f57603480546001600160a01b0319166001600160a01b038416179055610def565b6033546040516001600160a01b03808516921690600080516020612e7683398151915290600090a3603380546001600160a01b0384166001600160a01b0319918216179091556034805490911690555b5050565b60995481565b6034546001600160a01b0316610e0d612188565b6001600160a01b031614610e525760405162461bcd60e51b8152600401808060200182810382526032815260200180612dd56032913960400191505060405180910390fd5b6034546033546040516001600160a01b039283169290911690600080516020612e7683398151915290600090a3603454603380546001600160a01b0319166001600160a01b03909216919091179055565b6001600160a01b03811660009081526098602052604081205460ff168015610ee457506001600160a01b038216600090815260986020526040902060020154155b610eef576000610ef2565b60015b92915050565b610f00612188565b6001600160a01b0316610f116113ab565b6001600160a01b031614610f5a576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b609e80546001600160a01b0319166001600160a01b0392909216919091179055565b610f84612188565b6001600160a01b0316610f956113ab565b6001600160a01b031614610fde576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b6033546040516000916001600160a01b031690600080516020612e76833981519152908390a3603380546001600160a01b0319169055565b61101e612188565b6001600160a01b031661102f6113ab565b6001600160a01b031614611078576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b61108383838361218c565b505050565b6001600160a01b0382166110d6576040805162461bcd60e51b815260206004820152601060248201526f17d99c9bdb481a5cc81a5b9d985b1a5960821b604482015290519081900360640190fd5b80600010611120576040805162461bcd60e51b815260206004820152601260248201527117d85b5bdd5b9d081a5cc81a5b9d985b1a5960721b604482015290519081900360640190fd5b609d60019054906101000a90046001600160a01b03166001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561118257600080fd5b505afa158015611196573d6000803e3d6000fd5b505050506040513d60208110156111ac57600080fd5b50518111156111f9576040805162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b604482015290519081900360640190fd5b609d54610def9061010090046001600160a01b0316833084612409565b600054610100900460ff168061122f575061122f612463565b8061123d575060005460ff16155b6112785760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff161580156112a3576000805460ff1961ff0019909116610100171660011790555b6001600160a01b0387166112fe576040805162461bcd60e51b815260206004820152601860248201527f4f776e6572206164647265737320697320696e76616c69640000000000000000604482015290519081900360640190fd5b6a0211654585005212800000609b55670de0b6b3a7640000609c55609d805460ff1916600117905561132f87612474565b611337612527565b609d8054610100600160a81b0319166101006001600160a01b038981169190910291909117909155609e80546001600160a01b03191691871691909117905561138184848461218c565b8015611393576000805461ff00191690555b50505050505050565b609f5481565b609d5460ff1681565b6033546001600160a01b031690565b60006113c4612188565b9050806001600160a01b03166113d86113ab565b6001600160a01b031614806113fa5750609e546001600160a01b038281169116145b6114355760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b600061145a609a54611454609954609f546125d090919063ffffffff16565b90612631565b9050828111156114aa576040805162461bcd60e51b8152602060048201526016602482015275151a19481b1a5b5a5d081a5cc81d1bdbc81cdb585b1b60521b604482015290519081900360640190fd5b609b8390556040805184815290517fd9a9a09fc16faafb71aa791b06aaf1f32e3ae9078035dc57c6cac185142685cd9181900360200190a1505050565b600080611507609a54611454609954609f546125d090919063ffffffff16565b609b549091506115179082612631565b91505090565b60026065541415611575576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026065556000611584612188565b905061158f81610ea3565b6115cd576040805162461bcd60e51b815260206004820152600a602482015269139bdd081cdd185ad95960b21b604482015290519081900360640190fd5b60a05460ff16806115fb57507383b4271b054818a93325c7299f006aec2e90ef966001600160a01b03821614155b61163a576040805162461bcd60e51b815260206004820152600b60248201526a109b1858dadb1a5cdd195960aa1b604482015290519081900360640190fd5b6001600160a01b03811660009081526098602052604081208054600382015460019092015461010090910460ff169290819061167790848661268e565b609d54919350915060ff168061168b575081155b6116cb576040805162461bcd60e51b815260206004820152600c60248201526b131bd8dad959081cdd1a5b1b60a21b604482015290519081900360640190fd5b6001600160a01b03851660009081526098602052604090204260029091015581156116f75760006116f9565b805b6001600160a01b038616600090815260986020526040902060040155609a5461172290846125d0565b609a556001600160a01b0385166000908152609860205260409020600401541561175757609f5461175390846125d0565b609f555b61178b8360978660ff168154811061176b57fe5b90600052602060002090600302016002015461263190919063ffffffff16565b60978560ff168154811061179b57fe5b906000526020600020906003020160020181905550611807856117ef60986000896001600160a01b03166001600160a01b0316815260200190815260200160002060040154866125d090919063ffffffff16565b609d5461010090046001600160a01b03169190612768565b6001600160a01b0385166000818152609860209081526040918290206004015482518781529182015281517f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e929181900390910190a250506001606555505050565b6001600160a01b0381166000908152609860209081526040808320815160c081018352815460ff80821615158352610100909104169381019390935260018101549183019190915260028101546060830152600381015460808301526004015460a082015281908190819081906118df87610ea3565b1561191357608081015160208201516040830151919750955061190390878761268e565b90945092506000915061192d9050565b6000806000806119216114e7565b95509550955095509550505b91939590929450565b6097818154811061194657600080fd5b600091825260209091206003909102018054600182015460029092015460ff8216935061010090910461ffff16919084565b611980612188565b6001600160a01b03166119916113ab565b6001600160a01b0316146119da576040805162461bcd60e51b81526020600482018190526024820152600080516020612e56833981519152604482015290519081900360640190fd5b60005b609754811015611a4457609781815481106119f457fe5b600091825260209091206003909102015460ff1615611a3c57600060978281548110611a1c57fe5b60009182526020909120600390910201805460ff19169115159190911790555b6001016119dd565b50609d54604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611a9557600080fd5b505afa158015611aa9573d6000803e3d6000fd5b505050506040513d6020811015611abf57600080fd5b5051609954609a54919250611ad9916114549084906125d0565b90508015611b0457611b04611aec6113ab565b609d5461010090046001600160a01b03169083612768565b50565b609e546001600160a01b031681565b6034546001600160a01b031690565b6000611b2f612188565b9050806001600160a01b0316611b436113ab565b6001600160a01b03161480611b655750609e546001600160a01b038281169116145b611ba05760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b609c8290556040805183815290517f6e4bcc82cb4b918df6b911c8092c49f027b7d409733e2c97bb0a4b5a367e19db9181900360200190a15050565b60a05460ff1681565b6000611bef612188565b9050806001600160a01b0316611c036113ab565b6001600160a01b03161480611c255750609e546001600160a01b038281169116145b611c605760405162461bcd60e51b8152600401808060200182810382526026815260200180612daf6026913960400191505060405180910390fd5b60975460ff861610611cad576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b6113888210611cfa576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b600060978660ff1681548110611d0c57fe5b600091825260209182902060039190910201805460ff19168715151762ffff00191661010061ffff888116820292909217808455600184018890556040805160ff8d8116825283161515968101969096529190049091168382015260608301869052519092507f72a38eea1f38f2d28e765e3ec3da350219bbac1187a20efd23795391d910bfdf916080908290030190a1505050505050565b609c5481565b60026065541415611e03576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026065556000611e12612188565b90506000611e1e6114e7565b905080600010611e66576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e4818db1bdcd95960921b604482015290519081900360640190fd5b611e6f82610ea3565b15611eb2576040805162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e481cdd185ad95960921b604482015290519081900360640190fd5b83609c541115611f09576040805162461bcd60e51b815260206004820152601f60248201527f546865207374616b696e6720616d6f756e7420697320746f6f20736d616c6c00604482015290519081900360640190fd5b80841115611f5e576040805162461bcd60e51b815260206004820152601860248201527f45786365656420746865207374616b696e67206c696d69740000000000000000604482015290519081900360640190fd5b60975460ff841610611fab576040805162461bcd60e51b8152602060048201526011602482015270092dcecc2d8d2c840e8f2e0ca92dcc8caf607b1b604482015290519081900360640190fd5b60978360ff1681548110611fbb57fe5b600091825260209091206003909102015460ff16612014576040805162461bcd60e51b8152602060048201526011602482015270151a19481d1e5c1948191a5cd8589b1959607a1b604482015290519081900360640190fd5b609d546120319061010090046001600160a01b0316833087612409565b6040805160c081018252600180825260ff868116602080850191825242858701908152600060608701818152608088018d815260a089018381526001600160a01b038d16845260989095529890912096518754945160ff199095169015151761ff0019166101009490951693909302939093178555915192840192909255905160028301559151600382015590516004909101556099546120d290856125d0565b60998190555061210c8460978560ff16815481106120ec57fe5b9060005260206000209060030201600201546125d090919063ffffffff16565b60978460ff168154811061211c57fe5b906000526020600020906003020160020181905550816001600160a01b03167f8acf475137e0cd74ca7f611d16b1e6383ec9a9c71a8e5b85967781b9c7214d118585604051808381526020018260ff1681526020019250505060405180910390a2505060016065555050565b3390565b8051825114801561219e575082518251145b6121e1576040805162461bcd60e51b815260206004820152600f60248201526e4d69736d617463686564206461746160881b604482015290519081900360640190fd5b815160975460ff91011115612228576040805162461bcd60e51b81526020600482015260086024820152670a8dede40daeac6d60c31b604482015290519081900360640190fd5b60005b82518110156124035760026127100482828151811061224657fe5b602002602001015110612297576040805162461bcd60e51b8152602060048201526014602482015273546f6f206c61726765207265776172645261746560601b604482015290519081900360640190fd5b600060405180608001604052808684815181106122b057fe5b6020026020010151151581526020018584815181106122cb57fe5b602002602001015161ffff1681526020018484815181106122e857fe5b6020908102919091018101518252600091810182905260978054600181018255925282517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ff9600390930292830180548584015160ff1990911692151592831762ffff00191661010061ffff909216918202179091556040808601517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffa86018190556060808801517f354a83ed9988f79f6038d4c7a7dadbad8af32f4ad6df893e0e5807a1b1944ffb909701969096558151938452938301919091528181019290925290519293507f78d782a4d9e33a46c20a0def9e9253843ce1b0434604e52b451eaa17245c3685929081900390910190a15060010161222b565b50505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526124039085906127b6565b600061246e30612867565b15905090565b600054610100900460ff168061248d575061248d612463565b8061249b575060005460ff16155b6124d65760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff16158015612501576000805460ff1961ff0019909116610100171660011790555b61250961286d565b6125128261290d565b8015610def576000805461ff00191690555050565b600054610100900460ff16806125405750612540612463565b8061254e575060005460ff16155b6125895760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff161580156125b4576000805460ff1961ff0019909116610100171660011790555b6125bc6129e6565b8015611b04576000805461ff001916905550565b60008282018381101561262a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600082821115612688576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008060978360ff16815481106126a157fe5b600091825260209091206003909102015460ff166126c457506000905080612760565b600060978460ff16815481106126d657fe5b906000526020600020906003020160000160019054906101000a900461ffff1661ffff16620151800262ffffff168601905080421061271657600061271a565b4281035b925061275c61271061275660978760ff168154811061273557fe5b90600052602060002090600302016001015488612a8c90919063ffffffff16565b90612ae5565b9150505b935093915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526110839084905b600061280b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612b4c9092919063ffffffff16565b8051909150156110835780806020019051602081101561282a57600080fd5b50516110835760405162461bcd60e51b815260040180806020018281038252602a815260200180612e96602a913960400191505060405180910390fd5b3b151590565b600054610100900460ff16806128865750612886612463565b80612894575060005460ff16155b6128cf5760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff161580156125bc576000805460ff1961ff0019909116610100171660011790558015611b04576000805461ff001916905550565b600054610100900460ff16806129265750612926612463565b80612934575060005460ff16155b61296f5760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff1615801561299a576000805460ff1961ff0019909116610100171660011790555b603380546001600160a01b0319166001600160a01b038416908117909155604051600090600080516020612e76833981519152908290a38015610def576000805461ff00191690555050565b600054610100900460ff16806129ff57506129ff612463565b80612a0d575060005460ff16155b612a485760405162461bcd60e51b815260040180806020018281038252602e815260200180612e07602e913960400191505060405180910390fd5b600054610100900460ff16158015612a73576000805460ff1961ff0019909116610100171660011790555b60016065558015611b04576000805461ff001916905550565b600082612a9b57506000610ef2565b82820282848281612aa857fe5b041461262a5760405162461bcd60e51b8152600401808060200182810382526021815260200180612e356021913960400191505060405180910390fd5b6000808211612b3b576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381612b4457fe5b049392505050565b6060612b5b8484600085612b63565b949350505050565b606082471015612ba45760405162461bcd60e51b8152600401808060200182810382526026815260200180612d896026913960400191505060405180910390fd5b612bad85612867565b612bfe576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310612c3c5780518252601f199092019160209182019101612c1d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612c9e576040519150601f19603f3d011682016040523d82523d6000602084013e612ca3565b606091505b5091509150612cb3828286612cbe565b979650505050505050565b60608315612ccd57508161262a565b825115612cdd5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d27578181015183820152602001612d0f565b50505050905090810190601f168015612d545780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5468652063616c6c65722073686f756c64206265206f776e6572206f7220676f7665726e6f726163636570744f776e6572736869703a2043616c6c206d75737420636f6d652066726f6d2070656e64696e674f776e65722e496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220fe89e9eb6040d5af5b9100187da5bb4dc1c56c8274fe836b494c71cf365a9c7c64736f6c63430007060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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