ETH Price: $3,453.13 (-1.13%)
Gas: 9 Gwei

Contract

0x818F83333244bA4BB72Dab0b60b1901158402f2E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x9357799cdc9cda98e3f1e5baaacddd99f5039b9ae66e3e8afdf2f1e8f690dd5e Deposit(pending)2024-07-14 1:47:514 days ago1720921671IN
0x818F8333...158402f2E
0 ETH(Pending)(Pending)
Claim Reward125999612021-06-09 11:02:051134 days ago1623236525IN
0x818F8333...158402f2E
0 ETH0.0013127911
Claim Reward125404552021-05-31 6:15:351144 days ago1622441735IN
0x818F8333...158402f2E
0 ETH0.0020288617.00000134
Claim Reward125404552021-05-31 6:15:351144 days ago1622441735IN
0x818F8333...158402f2E
0 ETH0.0017901715
Claim Reward125390772021-05-31 0:59:041144 days ago1622422744IN
0x818F8333...158402f2E
0 ETH0.0022513416.5
Mass Update125389262021-05-31 0:28:541144 days ago1622420934IN
0x818F8333...158402f2E
0 ETH0.004385919
Mass Update125389142021-05-31 0:26:131144 days ago1622420773IN
0x818F8333...158402f2E
0 ETH0.0051542419
Mass Update125386412021-05-30 23:23:461144 days ago1622417026IN
0x818F8333...158402f2E
0 ETH0.0051542419
Claim Reward125380442021-05-30 21:10:581144 days ago1622409058IN
0x818F8333...158402f2E
0 ETH0.0025468519
Claim Reward125357042021-05-30 12:19:061144 days ago1622377146IN
0x818F8333...158402f2E
0 ETH0.001989319
Withdraw125356842021-05-30 12:15:371144 days ago1622376937IN
0x818F8333...158402f2E
0 ETH0.0028033420
Claim Reward125351302021-05-30 10:18:511144 days ago1622369931IN
0x818F8333...158402f2E
0 ETH0.0022790317.002
Exit125326532021-05-30 1:01:551145 days ago1622336515IN
0x818F8333...158402f2E
0 ETH0.0035666118.00000134
Deposit125288932021-05-29 11:11:431145 days ago1622286703IN
0x818F8333...158402f2E
0 ETH0.0028786518.00000145
Claim Reward125285762021-05-29 10:03:341145 days ago1622282614IN
0x818F8333...158402f2E
0 ETH0.0022221819
Claim Reward125230232021-05-28 13:12:471146 days ago1622207567IN
0x818F8333...158402f2E
0 ETH0.0042894432
Exit125208212021-05-28 5:01:401147 days ago1622178100IN
0x818F8333...158402f2E
0 ETH0.0044268327
Withdraw125180082021-05-27 18:40:411147 days ago1622140841IN
0x818F8333...158402f2E
0 ETH0.0042465327
Exit125163182021-05-27 12:16:101147 days ago1622117770IN
0x818F8333...158402f2E
0 ETH0.0045573323.00000145
Claim Reward125160802021-05-27 11:20:551147 days ago1622114455IN
0x818F8333...158402f2E
0 ETH0.002679928
Claim Reward125160712021-05-27 11:17:581147 days ago1622114278IN
0x818F8333...158402f2E
0 ETH0.0030467729.1
Withdraw125160672021-05-27 11:17:171147 days ago1622114237IN
0x818F8333...158402f2E
0 ETH0.0040795529.1
Claim Reward125160672021-05-27 11:17:171147 days ago1622114237IN
0x818F8333...158402f2E
0 ETH0.0030471129.1
Withdraw125160602021-05-27 11:15:451147 days ago1622114145IN
0x818F8333...158402f2E
0 ETH0.0044861132
Claim Reward125155892021-05-27 9:24:591147 days ago1622107499IN
0x818F8333...158402f2E
0 ETH0.0031427130
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Distribution

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : Distribution.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;

import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {Math} from '@openzeppelin/contracts/math/Math.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';

import {Operator} from '../access/Operator.sol';
import {IPool, IPoolGov} from './IPool.sol';
import {IPoolStore, PoolStoreWrapper} from './PoolStoreWrapper.sol';

contract Distribution is IPool, IPoolGov, PoolStoreWrapper, Operator {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    /* ================= DATA STRUCTURE ================= */

    struct User {
        uint256 amount;
        uint256 reward;
        uint256 rewardPerTokenPaid;
    }
    struct Pool {
        bool initialized;
        uint256 rewardRate;
        uint256 lastUpdateTime;
        uint256 rewardPerTokenStored;
    }

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

    // share
    address public share;
    mapping(address => bool) public approvals;
    // poolId => Pool
    mapping(uint256 => Pool) public pools;
    // poolId => sender => User
    mapping(uint256 => mapping(address => User)) public users;

    bool public stopped = false;
    uint256 public rewardRate = 0;
    uint256 public rewardRateExtra = 0;

    // halving
    uint256 public rewardRateBeforeHalve = 0;

    // control
    uint256 public period = 0;
    uint256 public periodFinish = 0;
    uint256 public startTime = 0;

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

    constructor(address _share, address _poolStore) Ownable() {
        share = _share;
        store = IPoolStore(_poolStore);
    }

    /* ================= GOV - OWNER ONLY ================= */

    /**
     * @param _startTime starting time to distribute
     * @param _period distribution period
     */
    function setPeriod(uint256 _startTime, uint256 _period)
        public
        override
        onlyOperator
    {
        // re-calc
        if (startTime <= block.timestamp && block.timestamp < periodFinish) {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = leftover.div(_period);
        }

        period = _period;
        startTime = _startTime;
        periodFinish = _startTime.add(_period);
    }

    /**
     * @param _amount token amount to distribute
     */
    function setReward(uint256 _amount) public override onlyOperator {
        require(block.timestamp < periodFinish, 'BACPool: already finished');

        if (startTime <= block.timestamp) {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            rewardRate = _amount.add(leftover).div(
                periodFinish.sub(block.timestamp)
            );
        } else {
            rewardRate = rewardRate.add(
                _amount.div(periodFinish.sub(startTime))
            );
        }
    }

    function setExtraRewardRate(uint256 _extra) public override onlyOwner {
        rewardRateExtra = _extra;
    }

    /**
     * @dev STOP DISTRIBUTION
     */
    function stop() public override onlyOwner {
        periodFinish = block.timestamp;
        stopped = true;
    }

    /**
     * @dev MUST UPDATE ALL POOL REWARD BEFORE MIGRATION!!!!!
     * @param _newPool new pool address to migrate
     */
    function migrate(address _newPool, uint256 _amount)
        public
        override
        onlyOwner
    {
        require(stopped, 'BACPool: not stopped');
        IERC20(share).safeTransfer(_newPool, _amount);

        uint256 remaining = startTime.add(period).sub(periodFinish);
        uint256 leftover = remaining.mul(rewardRate);
        IPoolGov(_newPool).setPeriod(block.timestamp.add(1), remaining);
        IPoolGov(_newPool).setReward(leftover);
    }

    /* ================= MODIFIER ================= */

    /**
     * @param _pid pool id
     * @param _target update target. if is empty, skip individual update.
     */
    modifier updateReward(uint256 _pid, address _target) {
        if (!approvals[store.tokenOf(_pid)]) {
            IERC20(store.tokenOf(_pid)).safeApprove(
                address(store),
                type(uint256).max
            );
            approvals[store.tokenOf(_pid)] = true;
        }

        if (block.timestamp >= startTime) {
            if (!pools[_pid].initialized) {
                pools[_pid] = Pool({
                    initialized: true,
                    rewardRate: rewardRate,
                    lastUpdateTime: startTime,
                    rewardPerTokenStored: 0
                });
            }

            // halve
            if (!stopped && block.timestamp >= periodFinish) {
                // decrease reward rate
                rewardRateBeforeHalve = rewardRate;
                rewardRate = rewardRate.mul(75).div(100);

                // set period
                startTime = block.timestamp;
                periodFinish = block.timestamp.add(period);
            }

            Pool memory pool = pools[_pid];
            pool.rewardPerTokenStored = rewardPerToken(_pid);
            if (pool.rewardRate == rewardRateBeforeHalve) {
                pool.rewardRate = rewardRate;
            }
            pool.lastUpdateTime = applicableRewardTime();
            pools[_pid] = pool;

            if (_target != address(0x0)) {
                User memory user = users[_pid][_target];
                user.reward = rewardEarned(_pid, _target);
                user.rewardPerTokenPaid = pool.rewardPerTokenStored;
                users[_pid][_target] = user;
            }
        }

        _;
    }

    /* ================= CALLS - ANYONE ================= */

    /**
     * @param _pid pool id
     * @return pool token address
     */
    function tokenOf(uint256 _pid) external view override returns (address) {
        return store.tokenOf(_pid);
    }

    /**
     * @param _token pool token address
     * @return pool id
     */
    function poolIdsOf(address _token)
        external
        view
        override
        returns (uint256[] memory)
    {
        return store.poolIdsOf(_token);
    }

    /**
     * @param _pid pool id
     * @return pool's total staked amount
     */
    function totalSupply(uint256 _pid)
        external
        view
        override
        returns (uint256)
    {
        return store.totalSupply(_pid);
    }

    /**
     * @param _owner staker address
     * @return staker balance
     */
    function balanceOf(uint256 _pid, address _owner)
        external
        view
        override
        returns (uint256)
    {
        return store.balanceOf(_pid, _owner);
    }

    /**
     * @return applicable reward time
     */
    function applicableRewardTime() public view returns (uint256) {
        return Math.min(block.timestamp, periodFinish);
    }

    /**
     * @param _pid pool id
     * @param _crit reward rate
     */
    function _rewardRatePerPool(uint256 _pid, uint256 _crit)
        internal
        view
        returns (uint256)
    {
        return _crit.mul(store.weightOf(_pid)).div(store.totalWeight());
    }

    /**
     * @param _pid pool id
     * @return calculated reward rate per pool
     */
    function rewardRatePerPool(uint256 _pid)
        public
        view
        override
        returns (uint256)
    {
        return _rewardRatePerPool(_pid, rewardRate.add(rewardRateExtra));
    }

    /**
     * @param _pid pool id
     * @return RPT per pool
     */
    function rewardPerToken(uint256 _pid)
        public
        view
        override
        returns (uint256)
    {
        Pool memory pool = pools[_pid];
        if (store.totalSupply(_pid) == 0 || block.timestamp < startTime) {
            return pool.rewardPerTokenStored;
        }

        if (pool.rewardRate != 0 && pool.rewardRate == rewardRateBeforeHalve) {
            uint256 beforeHalve =
                startTime
                    .sub(pool.lastUpdateTime)
                    .mul(_rewardRatePerPool(_pid, rewardRateBeforeHalve))
                    .mul(1e18)
                    .div(store.totalSupply(_pid));
            uint256 afterHalve =
                applicableRewardTime()
                    .sub(startTime)
                    .mul(rewardRatePerPool(_pid))
                    .mul(1e18)
                    .div(store.totalSupply(_pid));
            return pool.rewardPerTokenStored.add(beforeHalve).add(afterHalve);
        } else {
            return
                pool.rewardPerTokenStored.add(
                    applicableRewardTime()
                        .sub(pool.lastUpdateTime)
                        .mul(rewardRatePerPool(_pid))
                        .mul(1e18)
                        .div(store.totalSupply(_pid))
                );
        }
    }

    /**
     * @param _pid pool id
     * @param _target target address
     * @return reward amount per pool
     */
    function rewardEarned(uint256 _pid, address _target)
        public
        view
        override
        returns (uint256)
    {
        User memory user = users[_pid][_target];
        return
            store
                .balanceOf(_pid, _target)
                .mul(rewardPerToken(_pid).sub(user.rewardPerTokenPaid))
                .div(1e18)
                .add(user.reward);
    }

    /* ================= TXNS - ANYONE ================= */

    /**
     * @param _pids array of pool ids
     */
    function massUpdate(uint256[] memory _pids) public override {
        for (uint256 i = 0; i < _pids.length; i++) {
            update(_pids[i]);
        }
    }

    /**
     * @param _pid pool id
     */
    function update(uint256 _pid)
        public
        override
        updateReward(_pid, address(0x0))
    {}

    /**
     * @param _pid pool id
     * @param _amount deposit amount
     */
    function deposit(uint256 _pid, uint256 _amount)
        public
        override(IPool, PoolStoreWrapper)
        updateReward(_pid, _msgSender())
    {
        require(!stopped, 'BASPool: stopped');
        super.deposit(_pid, _amount);
        emit DepositToken(_msgSender(), _pid, _amount);
    }

    /**
     * @param _pid pool id
     * @param _amount withdraw amount
     */
    function withdraw(uint256 _pid, uint256 _amount)
        public
        override(IPool, PoolStoreWrapper)
        updateReward(_pid, _msgSender())
    {
        require(!stopped, 'BASPool: stopped');
        super.withdraw(_pid, _amount);
        emit WithdrawToken(_msgSender(), _pid, _amount);
    }

    /**
     * @param _pid pool id
     */
    function claimReward(uint256 _pid)
        public
        override
        updateReward(_pid, _msgSender())
    {
        uint256 reward = users[_pid][_msgSender()].reward;
        if (reward > 0) {
            users[_pid][_msgSender()].reward = 0;
            IERC20(share).safeTransfer(_msgSender(), reward);
            emit RewardClaimed(_msgSender(), _pid, reward);
        }
    }

    /**
     * @dev withdraw + claim
     * @param _pid pool id
     */
    function exit(uint256 _pid) external override {
        withdraw(_pid, store.balanceOf(_pid, _msgSender()));
        claimReward(_pid);
    }
}

File 2 of 12 : IERC20.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 IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

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

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

File 3 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.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 SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

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

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

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

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

File 5 of 12 : SafeMath.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 SafeMath {
    /**
     * @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 6 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.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 Ownable is Context {
    address private _owner;

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

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

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

    /**
     * @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 transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 7 of 12 : Operator.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;

import {Context, Ownable} from '@openzeppelin/contracts/access/Ownable.sol';

abstract contract Operator is Context, Ownable {
    address private _operator;

    event OperatorTransferred(
        address indexed previousOperator,
        address indexed newOperator
    );

    constructor() {
        _operator = _msgSender();
        emit OperatorTransferred(address(0), _operator);
    }

    function operator() public view returns (address) {
        return _operator;
    }

    modifier onlyOperator() {
        require(
            _operator == _msgSender(),
            'operator: caller is not the operator'
        );
        _;
    }

    function isOperator() public view returns (bool) {
        return _msgSender() == _operator;
    }

    function transferOperator(address newOperator_) public onlyOwner {
        _transferOperator(newOperator_);
    }

    function _transferOperator(address newOperator_) internal {
        require(
            newOperator_ != address(0),
            'operator: zero address given for new operator'
        );
        emit OperatorTransferred(address(0), newOperator_);
        _operator = newOperator_;
    }
}

File 8 of 12 : IPool.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;

interface IPool {
    /* ================= EVENTS ================= */

    event DepositToken(
        address indexed owner,
        uint256 indexed pid,
        uint256 amount
    );
    event WithdrawToken(
        address indexed owner,
        uint256 indexed pid,
        uint256 amount
    );
    event RewardClaimed(
        address indexed owner,
        uint256 indexed pid,
        uint256 amount
    );

    /* ================= CALLS ================= */

    function tokenOf(uint256 _pid) external view returns (address);

    function poolIdsOf(address _token) external view returns (uint256[] memory);

    function totalSupply(uint256 _pid) external view returns (uint256);

    function balanceOf(uint256 _pid, address _owner)
        external
        view
        returns (uint256);

    function rewardRatePerPool(uint256 _pid) external view returns (uint256);

    function rewardPerToken(uint256 _pid) external view returns (uint256);

    function rewardEarned(uint256 _pid, address _target)
        external
        view
        returns (uint256);

    /* ================= TXNS ================= */

    function massUpdate(uint256[] memory _pids) external;

    function update(uint256 _pid) external;

    function deposit(uint256 _pid, uint256 _amount) external;

    function withdraw(uint256 _pid, uint256 _amount) external;

    function claimReward(uint256 _pid) external;

    function exit(uint256 _pid) external;
}

interface IPoolGov {
    /* ================= EVENTS ================= */

    event RewardNotified(
        address indexed operator,
        uint256 amount,
        uint256 period
    );

    /* ================= TXNS ================= */

    function setPeriod(uint256 _startTime, uint256 _period) external;

    function setReward(uint256 _amount) external;

    function setExtraRewardRate(uint256 _extra) external;

    function stop() external;

    function migrate(address _newPool, uint256 _amount) external;
}

File 9 of 12 : PoolStoreWrapper.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;

import {Context} from '@openzeppelin/contracts/utils/Context.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';

import {IPoolStore} from './PoolStore.sol';

abstract contract PoolStoreWrapper is Context {
    using SafeERC20 for IERC20;

    IPoolStore public store;

    function deposit(uint256 _pid, uint256 _amount) public virtual {
        IERC20(store.tokenOf(_pid)).safeTransferFrom(
            _msgSender(),
            address(this),
            _amount
        );
        store.deposit(_pid, _msgSender(), _amount);
    }

    function withdraw(uint256 _pid, uint256 _amount) public virtual {
        store.withdraw(_pid, _msgSender(), _amount);
        IERC20(store.tokenOf(_pid)).safeTransfer(_msgSender(), _amount);
    }
}

File 10 of 12 : 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 12 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/*
 * @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 Context {
    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;
    }
}

File 12 of 12 : PoolStore.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;

import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';

import {Operator} from '../access/Operator.sol';

interface IPoolStore {
    /* ================= EVENTS ================= */
    event Deposit(
        address indexed operator,
        address indexed owner,
        uint256 indexed pid,
        uint256 amount
    );
    event Withdraw(
        address indexed operator,
        address indexed owner,
        uint256 indexed pid,
        uint256 amount
    );

    /* ================= CALLS ================= */

    // common
    function totalWeight() external view returns (uint256);

    function poolLength() external view returns (uint256);

    // index
    function poolIdsOf(address _token) external view returns (uint256[] memory);

    // pool info
    function nameOf(uint256 _pid) external view returns (string memory);

    function tokenOf(uint256 _pid) external view returns (address);

    function weightOf(uint256 _pid) external view returns (uint256);

    function totalSupply(uint256 _pid) external view returns (uint256);

    function balanceOf(uint256 _pid, address _owner)
        external
        view
        returns (uint256);

    /* ================= TXNS ================= */

    function deposit(
        uint256 _pid,
        address _owner,
        uint256 _amount
    ) external;

    function withdraw(
        uint256 _pid,
        address _owner,
        uint256 _amount
    ) external;

    function emergencyWithdraw(uint256 _pid) external;
}

interface IPoolStoreGov {
    /* ================= EVENTS ================= */

    event EmergencyReported(address indexed reporter);
    event EmergencyResolved(address indexed resolver);

    event WeightFeederChanged(
        address indexed operator,
        address indexed oldFeeder,
        address indexed newFeeder
    );

    event PoolAdded(
        address indexed operator,
        uint256 indexed pid,
        string name,
        address token,
        uint256 weight
    );
    event PoolWeightChanged(
        address indexed operator,
        uint256 indexed pid,
        uint256 from,
        uint256 to
    );
    event PoolNameChanged(
        address indexed operator,
        uint256 indexed pid,
        string from,
        string to
    );

    /* ================= TXNS ================= */

    // emergency
    function reportEmergency() external;

    function resolveEmergency() external;

    // feeder
    function setWeightFeeder(address _newFeeder) external;

    // pool setting
    function addPool(
        string memory _name,
        IERC20 _token,
        uint256 _weight
    ) external;

    function setPool(uint256 _pid, uint256 _weight) external;

    function setPool(uint256 _pid, string memory _name) external;
}

contract PoolStore is IPoolStore, IPoolStoreGov, Operator {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    /* ================= DATA STRUCTURE ================= */

    struct Pool {
        string name;
        IERC20 token;
        uint256 weight;
        uint256 totalSupply;
    }

    /* ================= STATES ================= */

    uint256 public override totalWeight = 0;

    Pool[] public pools;
    mapping(uint256 => mapping(address => uint256)) balances;
    mapping(address => uint256[]) public indexByToken;

    bool public emergency = false;
    address public weightFeeder;

    constructor() Operator() {
        weightFeeder = _msgSender();
    }

    /* ================= GOV - OWNER ONLY ================= */

    /**
     * @dev CAUTION: DO NOT USE IN NORMAL SITUATION
     * @notice Enable emergency withdraw
     */
    function reportEmergency() public override onlyOwner {
        emergency = true;
        emit EmergencyReported(_msgSender());
    }

    /**
     * @dev CAUTION: DO NOT USE IN NORMAL SITUATION
     * @notice Disable emergency withdraw
     */
    function resolveEmergency() public override onlyOwner {
        emergency = false;
        emit EmergencyResolved(_msgSender());
    }

    /*
     * @param _newFeeder weight feeder address to change
     */
    function setWeightFeeder(address _newFeeder) public override onlyOwner {
        address oldFeeder = weightFeeder;
        weightFeeder = _newFeeder;
        emit WeightFeederChanged(_msgSender(), oldFeeder, _newFeeder);
    }

    /**
     * @param _token pool token
     * @param _weight pool weight
     */
    function addPool(
        string memory _name,
        IERC20 _token,
        uint256 _weight
    ) public override onlyOwner {
        totalWeight = totalWeight.add(_weight);

        uint256 index = pools.length;
        indexByToken[address(_token)].push(index);

        pools.push(
            Pool({name: _name, token: _token, weight: _weight, totalSupply: 0})
        );
        emit PoolAdded(_msgSender(), index, _name, address(_token), _weight);
    }

    /**
     * @param _pid pool id
     * @param _weight target pool weight
     */
    function setPool(uint256 _pid, uint256 _weight)
        public
        override
        onlyWeightFeeder
        checkPoolId(_pid)
    {
        Pool memory pool = pools[_pid];

        uint256 oldWeight = pool.weight;
        totalWeight = totalWeight.add(_weight).sub(pool.weight);
        pool.weight = _weight;

        pools[_pid] = pool;

        emit PoolWeightChanged(_msgSender(), _pid, oldWeight, _weight);
    }

    /**
     * @param _pid pool id
     * @param _name name of pool
     */
    function setPool(uint256 _pid, string memory _name)
        public
        override
        checkPoolId(_pid)
        onlyOwner
    {
        string memory oldName = pools[_pid].name;
        pools[_pid].name = _name;

        emit PoolNameChanged(_msgSender(), _pid, oldName, _name);
    }

    /* ================= MODIFIER ================= */

    modifier onlyWeightFeeder {
        require(_msgSender() == weightFeeder, 'PoolStore: unauthorized');

        _;
    }

    modifier checkPoolId(uint256 _pid) {
        require(_pid <= pools.length, 'PoolStore: invalid pid');

        _;
    }

    /* ================= CALLS - ANYONE ================= */
    /**
     * @return total pool length
     */
    function poolLength() public view override returns (uint256) {
        return pools.length;
    }

    /**
     * @param _token pool token address
     * @return pool id
     */
    function poolIdsOf(address _token)
        public
        view
        override
        returns (uint256[] memory)
    {
        return indexByToken[_token];
    }

    /**
     * @param _pid pool id
     * @return name of pool
     */
    function nameOf(uint256 _pid)
        public
        view
        override
        checkPoolId(_pid)
        returns (string memory)
    {
        return pools[_pid].name;
    }

    /**
     * @param _pid pool id
     * @return pool token
     */
    function tokenOf(uint256 _pid)
        public
        view
        override
        checkPoolId(_pid)
        returns (address)
    {
        return address(pools[_pid].token);
    }

    /**
     * @param _pid pool id
     * @return pool weight
     */
    function weightOf(uint256 _pid)
        public
        view
        override
        checkPoolId(_pid)
        returns (uint256)
    {
        return pools[_pid].weight;
    }

    /**
     * @param _pid pool id
     * @return total staked token amount
     */
    function totalSupply(uint256 _pid)
        public
        view
        override
        checkPoolId(_pid)
        returns (uint256)
    {
        return pools[_pid].totalSupply;
    }

    /**
     * @param _pid pool id
     * @param _sender staker address
     * @return staked amount of user
     */
    function balanceOf(uint256 _pid, address _sender)
        public
        view
        override
        checkPoolId(_pid)
        returns (uint256)
    {
        return balances[_pid][_sender];
    }

    /* ================= TXNS - OPERATOR ONLY ================= */

    /**
     * @param _pid pool id
     * @param _owner stake address
     * @param _amount stake amount
     */
    function deposit(
        uint256 _pid,
        address _owner,
        uint256 _amount
    ) public override checkPoolId(_pid) onlyOperator {
        pools[_pid].totalSupply = pools[_pid].totalSupply.add(_amount);
        balances[_pid][_owner] = balances[_pid][_owner].add(_amount);
        IERC20(tokenOf(_pid)).safeTransferFrom(
            _msgSender(),
            address(this),
            _amount
        );

        emit Deposit(_msgSender(), _owner, _pid, _amount);
    }

    function _withdraw(
        uint256 _pid,
        address _owner,
        uint256 _amount
    ) internal {
        pools[_pid].totalSupply = pools[_pid].totalSupply.sub(_amount);
        balances[_pid][_owner] = balances[_pid][_owner].sub(_amount);
        IERC20(tokenOf(_pid)).safeTransfer(_msgSender(), _amount);

        emit Withdraw(_msgSender(), _owner, _pid, _amount);
    }

    /**
     * @param _pid pool id
     * @param _owner stake address
     * @param _amount stake amount
     */
    function withdraw(
        uint256 _pid,
        address _owner,
        uint256 _amount
    ) public override checkPoolId(_pid) onlyOperator {
        _withdraw(_pid, _owner, _amount);
    }

    /**
     * @notice Anyone can withdraw its balance even if is not the operator
     * @param _pid pool id
     */
    function emergencyWithdraw(uint256 _pid) public override checkPoolId(_pid) {
        require(emergency, 'PoolStore: not in emergency');
        _withdraw(_pid, msg.sender, balanceOf(_pid, _msgSender()));
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_share","type":"address"},{"internalType":"address","name":"_poolStore","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DepositToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"}],"name":"OperatorTransferred","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":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"period","type":"uint256"}],"name":"RewardNotified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawToken","type":"event"},{"inputs":[],"name":"applicableRewardTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvals","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOperator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pids","type":"uint256[]"}],"name":"massUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newPool","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"period","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"poolIdsOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pools","outputs":[{"internalType":"bool","name":"initialized","type":"bool"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_target","type":"address"}],"name":"rewardEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRateBeforeHalve","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRateExtra","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"rewardRatePerPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_extra","type":"uint256"}],"name":"setExtraRewardRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_period","type":"uint256"}],"name":"setPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"share","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stopped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"store","outputs":[{"internalType":"contract IPoolStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"tokenOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator_","type":"address"}],"name":"transferOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenPaid","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526007805460ff19169055600060088190556009819055600a819055600b819055600c819055600d553480156200003957600080fd5b506040516200341c3803806200341c833981810160405260408110156200005f57600080fd5b5080516020909101516000620000746200014a565b600180546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350620000cc6200014a565b600280546001600160a01b0319166001600160a01b0392831617908190556040519116906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a3600380546001600160a01b039384166001600160a01b031991821617909155600080549290931691161790556200014e565b3390565b6132be806200015e6000396000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c806382ab890a11610130578063ae169a50116100b8578063ea78803f1161007c578063ea78803f14610699578063ebe2b12b146106b6578063ef78d4fd146106be578063f2fde38b146106c6578063f3609f2c146106ec57610227565b8063ae169a50146105c6578063b9d02df4146105e3578063bd85b0391461062d578063cdfa2c361461064a578063e2bbb1581461067657610227565b8063975057e7116100ff578063975057e7146104a2578063a8d5fd65146104aa578063ac4afa38146104b2578063ad68ebf7146104f7578063ad73f8c71461052357610227565b806382ab890a14610443578063874c120b146104605780638da5cb5b1461047d578063961342471461048557610227565b8063570ca735116101b357806375f12b211161018257806375f12b211461040657806378e979251461040e5780637b0a47ee146104165780637bebb7821461041e5780637f8661a11461042657610227565b8063570ca735146103975780635d0341ba146103bb5780636054a626146103e1578063715018a6146103fe57610227565b806329605e77116101fa57806329605e77146102ec5780633656eec214610312578063441a3e70146103505780634456eda214610373578063559a171c1461038f57610227565b806303c5b1dc1461022c57806307da68f51461025157806310602ef914610259578063293be456146102cf575b600080fd5b61024f6004803603604081101561024257600080fd5b50803590602001356106f4565b005b61024f6107b6565b61027f6004803603602081101561026f57600080fd5b50356001600160a01b031661082b565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102bb5781810151838201526020016102a3565b505050509050019250505060405180910390f35b61024f600480360360208110156102e557600080fd5b503561094b565b61024f6004803603602081101561030257600080fd5b50356001600160a01b0316610a90565b61033e6004803603604081101561032857600080fd5b50803590602001356001600160a01b0316610afb565b60408051918252519081900360200190f35b61024f6004803603604081101561036657600080fd5b5080359060200135610b85565b61037b611028565b604080519115158252519081900360200190f35b61033e61104e565b61039f611054565b604080516001600160a01b039092168252519081900360200190f35b61037b600480360360208110156103d157600080fd5b50356001600160a01b0316611063565b61024f600480360360208110156103f757600080fd5b5035611078565b61024f6110df565b61037b61118b565b61033e611194565b61033e61119a565b61033e6111a0565b61024f6004803603602081101561043c57600080fd5b50356111b3565b61024f6004803603602081101561045957600080fd5b5035611251565b61033e6004803603602081101561047657600080fd5b5035611614565b61039f61194e565b61033e6004803603602081101561049b57600080fd5b503561195d565b61039f61197f565b61039f61198e565b6104cf600480360360208110156104c857600080fd5b503561199d565b6040805194151585526020850193909352838301919091526060830152519081900360800190f35b61024f6004803603604081101561050d57600080fd5b506001600160a01b0381351690602001356119c8565b61024f6004803603602081101561053957600080fd5b81019060208101813564010000000081111561055457600080fd5b82018360208201111561056657600080fd5b8035906020019184602083028401116401000000008311171561058857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611b9d945050505050565b61024f600480360360208110156105dc57600080fd5b5035611bd1565b61060f600480360360408110156105f957600080fd5b50803590602001356001600160a01b0316612071565b60408051938452602084019290925282820152519081900360600190f35b61033e6004803603602081101561064357600080fd5b503561209d565b61033e6004803603604081101561066057600080fd5b50803590602001356001600160a01b031661211c565b61024f6004803603604081101561068c57600080fd5b5080359060200135612213565b61039f600480360360208110156106af57600080fd5b503561267a565b61033e6126c7565b61033e6126cd565b61024f600480360360208110156106dc57600080fd5b50356001600160a01b03166126d3565b61033e6127d6565b6106fc6127dc565b6002546001600160a01b039081169116146107485760405162461bcd60e51b81526004018080602001828103825260248152602001806132056024913960400191505060405180910390fd5b42600d541115801561075b5750600c5442105b1561079b57600c5460009061077090426127e0565b905060006107896008548361283d90919063ffffffff16565b9050610795818461289d565b60085550505b600b819055600d8290556107af8282612904565b600c555050565b6107be6127dc565b6001600160a01b03166107cf61194e565b6001600160a01b031614610818576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b42600c556007805460ff19166001179055565b60008054604080516310602ef960e01b81526001600160a01b038581166004830152915160609492909316926310602ef992602480840193919291829003018186803b15801561087a57600080fd5b505afa15801561088e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156108b757600080fd5b81019080805160405193929190846401000000008211156108d757600080fd5b9083019060208201858111156108ec57600080fd5b825186602082028301116401000000008211171561090957600080fd5b82525081516020918201928201910280838360005b8381101561093657818101518382015260200161091e565b5050505090500160405250505090505b919050565b6109536127dc565b6002546001600160a01b0390811691161461099f5760405162461bcd60e51b81526004018080602001828103825260248152602001806132056024913960400191505060405180910390fd5b600c5442106109f5576040805162461bcd60e51b815260206004820152601960248201527f424143506f6f6c3a20616c72656164792066696e697368656400000000000000604482015290519081900360640190fd5b42600d5411610a5c57600c54600090610a0e90426127e0565b90506000610a276008548361283d90919063ffffffff16565b9050610a51610a4142600c546127e090919063ffffffff16565b610a4b8584612904565b9061289d565b60085550610a8d9050565b610a89610a80610a79600d54600c546127e090919063ffffffff16565b839061289d565b60085490612904565b6008555b50565b610a986127dc565b6001600160a01b0316610aa961194e565b6001600160a01b031614610af2576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b610a8d8161295e565b6000805460408051631b2b776160e11b8152600481018690526001600160a01b03858116602483015291519190921691633656eec2916044808301926020929190829003018186803b158015610b5057600080fd5b505afa158015610b64573d6000803e3d6000fd5b505050506040513d6020811015610b7a57600080fd5b505190505b92915050565b81610b8e6127dc565b600080546040805163ea78803f60e01b8152600481810187905291519193926001600160a01b03169163ea78803f91602480820192602092909190829003018186803b158015610bdd57600080fd5b505afa158015610bf1573d6000803e3d6000fd5b505050506040513d6020811015610c0757600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff16610d5e576000546040805163ea78803f60e01b8152600481018590529051610cb9926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b505afa158015610c91573d6000803e3d6000fd5b505050506040513d6020811015610ca757600080fd5b50516001600160a01b031691906129fb565b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b158015610d0957600080fd5b505afa158015610d1d573d6000803e3d6000fd5b505050506040513d6020811015610d3357600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d544210610f845760008281526005602052604090205460ff16610ddc576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff16158015610df15750600c544210155b15610e2a57600854600a819055610e1090606490610a4b90604b61283d565b60085542600d819055600b54610e269190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff16151581526001820154928101929092526002810154928201929092526003909101546060820152610e7983611614565b6060820152600a5460208201511415610e955760085460208201525b610e9d6111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b03821615610f825760008381526006602090815260408083206001600160a01b03861684528252918290208251606081018452815481526001820154928101929092526002015491810191909152610f3c848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b60075460ff1615610fcf576040805162461bcd60e51b815260206004820152601060248201526f109054d41bdbdb0e881cdd1bdc1c195960821b604482015290519081900360640190fd5b610fd98484612b0e565b83610fe26127dc565b6001600160a01b03167f7575c9e41ba6d91ef21e39bd62b5b9df62fc9b0401379fdf9fe1fa372f41e7c1856040518082815260200191505060405180910390a350505050565b6002546000906001600160a01b031661103f6127dc565b6001600160a01b031614905090565b60095481565b6002546001600160a01b031690565b60046020526000908152604090205460ff1681565b6110806127dc565b6001600160a01b031661109161194e565b6001600160a01b0316146110da576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b600955565b6110e76127dc565b6001600160a01b03166110f861194e565b6001600160a01b031614611141576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b60075460ff1681565b600d5481565b60085481565b60006111ae42600c54612c20565b905090565b6000546112489082906001600160a01b0316633656eec2826111d36127dc565b6040518363ffffffff1660e01b815260040180838152602001826001600160a01b031681526020019250505060206040518083038186803b15801561121757600080fd5b505afa15801561122b573d6000803e3d6000fd5b505050506040513d602081101561124157600080fd5b5051610b85565b610a8d81611bd1565b600080546040805163ea78803f60e01b81526004818101869052915185949384926001600160a01b039091169163ea78803f91602480820192602092909190829003018186803b1580156112a457600080fd5b505afa1580156112b8573d6000803e3d6000fd5b505050506040513d60208110156112ce57600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff166113e9576000546040805163ea78803f60e01b8152600481018590529051611344926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b15801561139457600080fd5b505afa1580156113a8573d6000803e3d6000fd5b505050506040513d60208110156113be57600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d54421061160f5760008281526005602052604090205460ff16611467576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff1615801561147c5750600c544210155b156114b557600854600a81905561149b90606490610a4b90604b61283d565b60085542600d819055600b546114b19190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff1615158152600182015492810192909252600281015492820192909252600390910154606082015261150483611614565b6060820152600a54602082015114156115205760085460208201525b6115286111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b0382161561160d5760008381526006602090815260408083206001600160a01b038616845282529182902082516060810184528154815260018201549281019290925260020154918101919091526115c7848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b505050565b60008181526005602090815260408083208151608081018352815460ff161515815260018201548185015260028201548184015260039091015460608201528354825163bd85b03960e01b815260048101879052925191936001600160a01b039091169263bd85b0399260248083019392829003018186803b15801561169957600080fd5b505afa1580156116ad573d6000803e3d6000fd5b505050506040513d60208110156116c357600080fd5b505115806116d25750600d5442105b156116e257606001519050610946565b6020810151158015906116fa5750600a548160200151145b1561189357600080546040805163bd85b03960e01b81526004810187905290516117b0926001600160a01b03169163bd85b039916024808301926020929190829003018186803b15801561174d57600080fd5b505afa158015611761573d6000803e3d6000fd5b505050506040513d602081101561177757600080fd5b5051600a54610a4b90670de0b6b3a7640000906117aa90611799908a90612c36565b6040880151600d546117aa916127e0565b9061283d565b9050600061186660008054906101000a90046001600160a01b03166001600160a01b031663bd85b039876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561180e57600080fd5b505afa158015611822573d6000803e3d6000fd5b505050506040513d602081101561183857600080fd5b5051610a4b670de0b6b3a76400006117aa6118528a61195d565b6117aa600d546118606111a0565b906127e0565b90506118898161188384866060015161290490919063ffffffff16565b90612904565b9350505050610946565b6000546040805163bd85b03960e01b81526004810186905290516119469261193b926001600160a01b039091169163bd85b03991602480820192602092909190829003018186803b1580156118e757600080fd5b505afa1580156118fb573d6000803e3d6000fd5b505050506040513d602081101561191157600080fd5b5051610a4b670de0b6b3a76400006117aa61192b8961195d565b6117aa88604001516118606111a0565b606083015190612904565b915050610946565b6001546001600160a01b031690565b6000610b7f8261197a60095460085461290490919063ffffffff16565b612c36565b6000546001600160a01b031681565b6003546001600160a01b031681565b600560205260009081526040902080546001820154600283015460039093015460ff90921692909184565b6119d06127dc565b6001600160a01b03166119e161194e565b6001600160a01b031614611a2a576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b60075460ff16611a78576040805162461bcd60e51b8152602060048201526014602482015273109050d41bdbdb0e881b9bdd081cdd1bdc1c195960621b604482015290519081900360640190fd5b600354611a8f906001600160a01b03168383612d28565b6000611aae600c54611860600b54600d5461290490919063ffffffff16565b90506000611ac76008548361283d90919063ffffffff16565b90506001600160a01b0384166303c5b1dc611ae3426001612904565b846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611b2157600080fd5b505af1158015611b35573d6000803e3d6000fd5b50505050836001600160a01b031663293be456826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611b7f57600080fd5b505af1158015611b93573d6000803e3d6000fd5b5050505050505050565b60005b8151811015611bcd57611bc5828281518110611bb857fe5b6020026020010151611251565b600101611ba0565b5050565b80611bda6127dc565b600080546040805163ea78803f60e01b8152600481810187905291519193926001600160a01b03169163ea78803f91602480820192602092909190829003018186803b158015611c2957600080fd5b505afa158015611c3d573d6000803e3d6000fd5b505050506040513d6020811015611c5357600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff16611d6e576000546040805163ea78803f60e01b8152600481018590529051611cc9926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b158015611d1957600080fd5b505afa158015611d2d573d6000803e3d6000fd5b505050506040513d6020811015611d4357600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d544210611f945760008281526005602052604090205460ff16611dec576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff16158015611e015750600c544210155b15611e3a57600854600a819055611e2090606490610a4b90604b61283d565b60085542600d819055600b54611e369190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff16151581526001820154928101929092526002810154928201929092526003909101546060820152611e8983611614565b6060820152600a5460208201511415611ea55760085460208201525b611ead6111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b03821615611f925760008381526006602090815260408083206001600160a01b03861684528252918290208251606081018452815481526001820154928101929092526002015491810191909152611f4c848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b600083815260066020526040812081611fab6127dc565b6001600160a01b031681526020810191909152604001600020600101549050801561160d57600084815260066020526040812081611fe76127dc565b6001600160a01b0316815260208101919091526040016000206001015561202261200f6127dc565b6003546001600160a01b03169083612d28565b8361202b6127dc565b6001600160a01b03167ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e2731743836040518082815260200191505060405180910390a350505050565b600660209081526000928352604080842090915290825290208054600182015460029092015490919083565b600080546040805163bd85b03960e01b81526004810185905290516001600160a01b039092169163bd85b03991602480820192602092909190829003018186803b1580156120ea57600080fd5b505afa1580156120fe573d6000803e3d6000fd5b505050506040513d602081101561211457600080fd5b505192915050565b60008281526006602090815260408083206001600160a01b0385168452825280832081516060810183528154815260018201549381018490526002909101549181018290529161220b9161188390670de0b6b3a764000090610a4b90612185906118608b611614565b60005460408051631b2b776160e11b8152600481018d90526001600160a01b038c8116602483015291519190921691633656eec2916044808301926020929190829003018186803b1580156121d957600080fd5b505afa1580156121ed573d6000803e3d6000fd5b505050506040513d602081101561220357600080fd5b50519061283d565b949350505050565b8161221c6127dc565b600080546040805163ea78803f60e01b8152600481810187905291519193926001600160a01b03169163ea78803f91602480820192602092909190829003018186803b15801561226b57600080fd5b505afa15801561227f573d6000803e3d6000fd5b505050506040513d602081101561229557600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff166123b0576000546040805163ea78803f60e01b815260048101859052905161230b926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b15801561235b57600080fd5b505afa15801561236f573d6000803e3d6000fd5b505050506040513d602081101561238557600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d5442106125d65760008281526005602052604090205460ff1661242e576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff161580156124435750600c544210155b1561247c57600854600a81905561246290606490610a4b90604b61283d565b60085542600d819055600b546124789190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff161515815260018201549281019290925260028101549282019290925260039091015460608201526124cb83611614565b6060820152600a54602082015114156124e75760085460208201525b6124ef6111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b038216156125d45760008381526006602090815260408083206001600160a01b0386168452825291829020825160608101845281548152600182015492810192909252600201549181019190915261258e848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b60075460ff1615612621576040805162461bcd60e51b815260206004820152601060248201526f109054d41bdbdb0e881cdd1bdc1c195960821b604482015290519081900360640190fd5b61262b8484612d7a565b836126346127dc565b6001600160a01b03167f22aa98d9903d55438afe5107467c2619fbe070089c4ff9657ab08ae20d21a65e856040518082815260200191505060405180910390a350505050565b600080546040805163ea78803f60e01b81526004810185905290516001600160a01b039092169163ea78803f91602480820192602092909190829003018186803b1580156120ea57600080fd5b600c5481565b600b5481565b6126db6127dc565b6001600160a01b03166126ec61194e565b6001600160a01b031614612735576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b6001600160a01b03811661277a5760405162461bcd60e51b81526004018080602001828103825260268152602001806131716026913960400191505060405180910390fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b600a5481565b3390565b600082821115612837576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008261284c57506000610b7f565b8282028284828161285957fe5b04146128965760405162461bcd60e51b81526004018080602001828103825260218152602001806131c46021913960400191505060405180910390fd5b9392505050565b60008082116128f3576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816128fc57fe5b049392505050565b600082820183811015612896576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0381166129a35760405162461bcd60e51b815260040180806020018281038252602d815260200180613197602d913960400191505060405180910390fd5b6040516001600160a01b038216906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a3600280546001600160a01b0319166001600160a01b0392909216919091179055565b801580612a81575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612a5357600080fd5b505afa158015612a67573d6000803e3d6000fd5b505050506040513d6020811015612a7d57600080fd5b5051155b612abc5760405162461bcd60e51b81526004018080602001828103825260368152602001806132536036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261160f908490612e96565b6000546001600160a01b031663e63697c883612b286127dc565b846040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015612b7657600080fd5b505af1158015612b8a573d6000803e3d6000fd5b50505050611bcd612b996127dc565b6000546040805163ea78803f60e01b815260048101879052905185926001600160a01b03169163ea78803f916024808301926020929190829003018186803b158015612be457600080fd5b505afa158015612bf8573d6000803e3d6000fd5b505050506040513d6020811015612c0e57600080fd5b50516001600160a01b03169190612d28565b6000818310612c2f5781612896565b5090919050565b60008054604080516396c82e5760e01b81529051612896926001600160a01b0316916396c82e57916004808301926020929190829003018186803b158015612c7d57600080fd5b505afa158015612c91573d6000803e3d6000fd5b505050506040513d6020811015612ca757600080fd5b50516000546040805162ecfa2f60e31b8152600481018890529051610a4b926001600160a01b031691630767d178916024808301926020929190829003018186803b158015612cf557600080fd5b505afa158015612d09573d6000803e3d6000fd5b505050506040513d6020811015612d1f57600080fd5b5051859061283d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261160f908490612e96565b612e12612d856127dc565b6000546040805163ea78803f60e01b8152600481018790529051309286926001600160a01b039091169163ea78803f91602480820192602092909190829003018186803b158015612dd557600080fd5b505afa158015612de9573d6000803e3d6000fd5b505050506040513d6020811015612dff57600080fd5b50516001600160a01b0316929190612f47565b6000546001600160a01b031663bc157ac183612e2c6127dc565b846040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015612e7a57600080fd5b505af1158015612e8e573d6000803e3d6000fd5b505050505050565b6000612eeb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612fa19092919063ffffffff16565b80519091501561160f57808060200190516020811015612f0a57600080fd5b505161160f5760405162461bcd60e51b815260040180806020018281038252602a815260200180613229602a913960400191505060405180910390fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261160d908590612e96565b606061220b848460008585612fb5856130c6565b613006576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106130445780518252601f199092019160209182019101613025565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146130a6576040519150601f19603f3d011682016040523d82523d6000602084013e6130ab565b606091505b50915091506130bb8282866130cc565b979650505050505050565b3b151590565b606083156130db575081612896565b8251156130eb5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561313557818101518382015260200161311d565b50505050905090810190601f1680156131625780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573736f70657261746f723a207a65726f206164647265737320676976656e20666f72206e6577206f70657261746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657261746f725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212204b603514bc72996ce273609b23a3b7333afadd19489897f8809767890ada275464736f6c63430007060033000000000000000000000000106538cc16f938776c7c180186975bca238752870000000000000000000000004bd3a0f66758f2f4ebe575f9dfd7874e80689f10

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102275760003560e01c806382ab890a11610130578063ae169a50116100b8578063ea78803f1161007c578063ea78803f14610699578063ebe2b12b146106b6578063ef78d4fd146106be578063f2fde38b146106c6578063f3609f2c146106ec57610227565b8063ae169a50146105c6578063b9d02df4146105e3578063bd85b0391461062d578063cdfa2c361461064a578063e2bbb1581461067657610227565b8063975057e7116100ff578063975057e7146104a2578063a8d5fd65146104aa578063ac4afa38146104b2578063ad68ebf7146104f7578063ad73f8c71461052357610227565b806382ab890a14610443578063874c120b146104605780638da5cb5b1461047d578063961342471461048557610227565b8063570ca735116101b357806375f12b211161018257806375f12b211461040657806378e979251461040e5780637b0a47ee146104165780637bebb7821461041e5780637f8661a11461042657610227565b8063570ca735146103975780635d0341ba146103bb5780636054a626146103e1578063715018a6146103fe57610227565b806329605e77116101fa57806329605e77146102ec5780633656eec214610312578063441a3e70146103505780634456eda214610373578063559a171c1461038f57610227565b806303c5b1dc1461022c57806307da68f51461025157806310602ef914610259578063293be456146102cf575b600080fd5b61024f6004803603604081101561024257600080fd5b50803590602001356106f4565b005b61024f6107b6565b61027f6004803603602081101561026f57600080fd5b50356001600160a01b031661082b565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156102bb5781810151838201526020016102a3565b505050509050019250505060405180910390f35b61024f600480360360208110156102e557600080fd5b503561094b565b61024f6004803603602081101561030257600080fd5b50356001600160a01b0316610a90565b61033e6004803603604081101561032857600080fd5b50803590602001356001600160a01b0316610afb565b60408051918252519081900360200190f35b61024f6004803603604081101561036657600080fd5b5080359060200135610b85565b61037b611028565b604080519115158252519081900360200190f35b61033e61104e565b61039f611054565b604080516001600160a01b039092168252519081900360200190f35b61037b600480360360208110156103d157600080fd5b50356001600160a01b0316611063565b61024f600480360360208110156103f757600080fd5b5035611078565b61024f6110df565b61037b61118b565b61033e611194565b61033e61119a565b61033e6111a0565b61024f6004803603602081101561043c57600080fd5b50356111b3565b61024f6004803603602081101561045957600080fd5b5035611251565b61033e6004803603602081101561047657600080fd5b5035611614565b61039f61194e565b61033e6004803603602081101561049b57600080fd5b503561195d565b61039f61197f565b61039f61198e565b6104cf600480360360208110156104c857600080fd5b503561199d565b6040805194151585526020850193909352838301919091526060830152519081900360800190f35b61024f6004803603604081101561050d57600080fd5b506001600160a01b0381351690602001356119c8565b61024f6004803603602081101561053957600080fd5b81019060208101813564010000000081111561055457600080fd5b82018360208201111561056657600080fd5b8035906020019184602083028401116401000000008311171561058857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611b9d945050505050565b61024f600480360360208110156105dc57600080fd5b5035611bd1565b61060f600480360360408110156105f957600080fd5b50803590602001356001600160a01b0316612071565b60408051938452602084019290925282820152519081900360600190f35b61033e6004803603602081101561064357600080fd5b503561209d565b61033e6004803603604081101561066057600080fd5b50803590602001356001600160a01b031661211c565b61024f6004803603604081101561068c57600080fd5b5080359060200135612213565b61039f600480360360208110156106af57600080fd5b503561267a565b61033e6126c7565b61033e6126cd565b61024f600480360360208110156106dc57600080fd5b50356001600160a01b03166126d3565b61033e6127d6565b6106fc6127dc565b6002546001600160a01b039081169116146107485760405162461bcd60e51b81526004018080602001828103825260248152602001806132056024913960400191505060405180910390fd5b42600d541115801561075b5750600c5442105b1561079b57600c5460009061077090426127e0565b905060006107896008548361283d90919063ffffffff16565b9050610795818461289d565b60085550505b600b819055600d8290556107af8282612904565b600c555050565b6107be6127dc565b6001600160a01b03166107cf61194e565b6001600160a01b031614610818576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b42600c556007805460ff19166001179055565b60008054604080516310602ef960e01b81526001600160a01b038581166004830152915160609492909316926310602ef992602480840193919291829003018186803b15801561087a57600080fd5b505afa15801561088e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156108b757600080fd5b81019080805160405193929190846401000000008211156108d757600080fd5b9083019060208201858111156108ec57600080fd5b825186602082028301116401000000008211171561090957600080fd5b82525081516020918201928201910280838360005b8381101561093657818101518382015260200161091e565b5050505090500160405250505090505b919050565b6109536127dc565b6002546001600160a01b0390811691161461099f5760405162461bcd60e51b81526004018080602001828103825260248152602001806132056024913960400191505060405180910390fd5b600c5442106109f5576040805162461bcd60e51b815260206004820152601960248201527f424143506f6f6c3a20616c72656164792066696e697368656400000000000000604482015290519081900360640190fd5b42600d5411610a5c57600c54600090610a0e90426127e0565b90506000610a276008548361283d90919063ffffffff16565b9050610a51610a4142600c546127e090919063ffffffff16565b610a4b8584612904565b9061289d565b60085550610a8d9050565b610a89610a80610a79600d54600c546127e090919063ffffffff16565b839061289d565b60085490612904565b6008555b50565b610a986127dc565b6001600160a01b0316610aa961194e565b6001600160a01b031614610af2576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b610a8d8161295e565b6000805460408051631b2b776160e11b8152600481018690526001600160a01b03858116602483015291519190921691633656eec2916044808301926020929190829003018186803b158015610b5057600080fd5b505afa158015610b64573d6000803e3d6000fd5b505050506040513d6020811015610b7a57600080fd5b505190505b92915050565b81610b8e6127dc565b600080546040805163ea78803f60e01b8152600481810187905291519193926001600160a01b03169163ea78803f91602480820192602092909190829003018186803b158015610bdd57600080fd5b505afa158015610bf1573d6000803e3d6000fd5b505050506040513d6020811015610c0757600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff16610d5e576000546040805163ea78803f60e01b8152600481018590529051610cb9926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b505afa158015610c91573d6000803e3d6000fd5b505050506040513d6020811015610ca757600080fd5b50516001600160a01b031691906129fb565b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b158015610d0957600080fd5b505afa158015610d1d573d6000803e3d6000fd5b505050506040513d6020811015610d3357600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d544210610f845760008281526005602052604090205460ff16610ddc576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff16158015610df15750600c544210155b15610e2a57600854600a819055610e1090606490610a4b90604b61283d565b60085542600d819055600b54610e269190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff16151581526001820154928101929092526002810154928201929092526003909101546060820152610e7983611614565b6060820152600a5460208201511415610e955760085460208201525b610e9d6111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b03821615610f825760008381526006602090815260408083206001600160a01b03861684528252918290208251606081018452815481526001820154928101929092526002015491810191909152610f3c848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b60075460ff1615610fcf576040805162461bcd60e51b815260206004820152601060248201526f109054d41bdbdb0e881cdd1bdc1c195960821b604482015290519081900360640190fd5b610fd98484612b0e565b83610fe26127dc565b6001600160a01b03167f7575c9e41ba6d91ef21e39bd62b5b9df62fc9b0401379fdf9fe1fa372f41e7c1856040518082815260200191505060405180910390a350505050565b6002546000906001600160a01b031661103f6127dc565b6001600160a01b031614905090565b60095481565b6002546001600160a01b031690565b60046020526000908152604090205460ff1681565b6110806127dc565b6001600160a01b031661109161194e565b6001600160a01b0316146110da576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b600955565b6110e76127dc565b6001600160a01b03166110f861194e565b6001600160a01b031614611141576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b60075460ff1681565b600d5481565b60085481565b60006111ae42600c54612c20565b905090565b6000546112489082906001600160a01b0316633656eec2826111d36127dc565b6040518363ffffffff1660e01b815260040180838152602001826001600160a01b031681526020019250505060206040518083038186803b15801561121757600080fd5b505afa15801561122b573d6000803e3d6000fd5b505050506040513d602081101561124157600080fd5b5051610b85565b610a8d81611bd1565b600080546040805163ea78803f60e01b81526004818101869052915185949384926001600160a01b039091169163ea78803f91602480820192602092909190829003018186803b1580156112a457600080fd5b505afa1580156112b8573d6000803e3d6000fd5b505050506040513d60208110156112ce57600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff166113e9576000546040805163ea78803f60e01b8152600481018590529051611344926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b15801561139457600080fd5b505afa1580156113a8573d6000803e3d6000fd5b505050506040513d60208110156113be57600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d54421061160f5760008281526005602052604090205460ff16611467576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff1615801561147c5750600c544210155b156114b557600854600a81905561149b90606490610a4b90604b61283d565b60085542600d819055600b546114b19190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff1615158152600182015492810192909252600281015492820192909252600390910154606082015261150483611614565b6060820152600a54602082015114156115205760085460208201525b6115286111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b0382161561160d5760008381526006602090815260408083206001600160a01b038616845282529182902082516060810184528154815260018201549281019290925260020154918101919091526115c7848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b505050565b60008181526005602090815260408083208151608081018352815460ff161515815260018201548185015260028201548184015260039091015460608201528354825163bd85b03960e01b815260048101879052925191936001600160a01b039091169263bd85b0399260248083019392829003018186803b15801561169957600080fd5b505afa1580156116ad573d6000803e3d6000fd5b505050506040513d60208110156116c357600080fd5b505115806116d25750600d5442105b156116e257606001519050610946565b6020810151158015906116fa5750600a548160200151145b1561189357600080546040805163bd85b03960e01b81526004810187905290516117b0926001600160a01b03169163bd85b039916024808301926020929190829003018186803b15801561174d57600080fd5b505afa158015611761573d6000803e3d6000fd5b505050506040513d602081101561177757600080fd5b5051600a54610a4b90670de0b6b3a7640000906117aa90611799908a90612c36565b6040880151600d546117aa916127e0565b9061283d565b9050600061186660008054906101000a90046001600160a01b03166001600160a01b031663bd85b039876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561180e57600080fd5b505afa158015611822573d6000803e3d6000fd5b505050506040513d602081101561183857600080fd5b5051610a4b670de0b6b3a76400006117aa6118528a61195d565b6117aa600d546118606111a0565b906127e0565b90506118898161188384866060015161290490919063ffffffff16565b90612904565b9350505050610946565b6000546040805163bd85b03960e01b81526004810186905290516119469261193b926001600160a01b039091169163bd85b03991602480820192602092909190829003018186803b1580156118e757600080fd5b505afa1580156118fb573d6000803e3d6000fd5b505050506040513d602081101561191157600080fd5b5051610a4b670de0b6b3a76400006117aa61192b8961195d565b6117aa88604001516118606111a0565b606083015190612904565b915050610946565b6001546001600160a01b031690565b6000610b7f8261197a60095460085461290490919063ffffffff16565b612c36565b6000546001600160a01b031681565b6003546001600160a01b031681565b600560205260009081526040902080546001820154600283015460039093015460ff90921692909184565b6119d06127dc565b6001600160a01b03166119e161194e565b6001600160a01b031614611a2a576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b60075460ff16611a78576040805162461bcd60e51b8152602060048201526014602482015273109050d41bdbdb0e881b9bdd081cdd1bdc1c195960621b604482015290519081900360640190fd5b600354611a8f906001600160a01b03168383612d28565b6000611aae600c54611860600b54600d5461290490919063ffffffff16565b90506000611ac76008548361283d90919063ffffffff16565b90506001600160a01b0384166303c5b1dc611ae3426001612904565b846040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b158015611b2157600080fd5b505af1158015611b35573d6000803e3d6000fd5b50505050836001600160a01b031663293be456826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015611b7f57600080fd5b505af1158015611b93573d6000803e3d6000fd5b5050505050505050565b60005b8151811015611bcd57611bc5828281518110611bb857fe5b6020026020010151611251565b600101611ba0565b5050565b80611bda6127dc565b600080546040805163ea78803f60e01b8152600481810187905291519193926001600160a01b03169163ea78803f91602480820192602092909190829003018186803b158015611c2957600080fd5b505afa158015611c3d573d6000803e3d6000fd5b505050506040513d6020811015611c5357600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff16611d6e576000546040805163ea78803f60e01b8152600481018590529051611cc9926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b158015611d1957600080fd5b505afa158015611d2d573d6000803e3d6000fd5b505050506040513d6020811015611d4357600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d544210611f945760008281526005602052604090205460ff16611dec576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff16158015611e015750600c544210155b15611e3a57600854600a819055611e2090606490610a4b90604b61283d565b60085542600d819055600b54611e369190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff16151581526001820154928101929092526002810154928201929092526003909101546060820152611e8983611614565b6060820152600a5460208201511415611ea55760085460208201525b611ead6111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b03821615611f925760008381526006602090815260408083206001600160a01b03861684528252918290208251606081018452815481526001820154928101929092526002015491810191909152611f4c848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b600083815260066020526040812081611fab6127dc565b6001600160a01b031681526020810191909152604001600020600101549050801561160d57600084815260066020526040812081611fe76127dc565b6001600160a01b0316815260208101919091526040016000206001015561202261200f6127dc565b6003546001600160a01b03169083612d28565b8361202b6127dc565b6001600160a01b03167ff01da32686223933d8a18a391060918c7f11a3648639edd87ae013e2e2731743836040518082815260200191505060405180910390a350505050565b600660209081526000928352604080842090915290825290208054600182015460029092015490919083565b600080546040805163bd85b03960e01b81526004810185905290516001600160a01b039092169163bd85b03991602480820192602092909190829003018186803b1580156120ea57600080fd5b505afa1580156120fe573d6000803e3d6000fd5b505050506040513d602081101561211457600080fd5b505192915050565b60008281526006602090815260408083206001600160a01b0385168452825280832081516060810183528154815260018201549381018490526002909101549181018290529161220b9161188390670de0b6b3a764000090610a4b90612185906118608b611614565b60005460408051631b2b776160e11b8152600481018d90526001600160a01b038c8116602483015291519190921691633656eec2916044808301926020929190829003018186803b1580156121d957600080fd5b505afa1580156121ed573d6000803e3d6000fd5b505050506040513d602081101561220357600080fd5b50519061283d565b949350505050565b8161221c6127dc565b600080546040805163ea78803f60e01b8152600481810187905291519193926001600160a01b03169163ea78803f91602480820192602092909190829003018186803b15801561226b57600080fd5b505afa15801561227f573d6000803e3d6000fd5b505050506040513d602081101561229557600080fd5b50516001600160a01b0316815260208101919091526040016000205460ff166123b0576000546040805163ea78803f60e01b815260048101859052905161230b926001600160a01b03169160001991839163ea78803f916024808301926020929190829003018186803b158015610c7d57600080fd5b600080546040805163ea78803f60e01b81526004818101879052915160019492936001600160a01b03169163ea78803f916024808301926020929190829003018186803b15801561235b57600080fd5b505afa15801561236f573d6000803e3d6000fd5b505050506040513d602081101561238557600080fd5b50516001600160a01b031681526020810191909152604001600020805460ff19169115159190911790555b600d5442106125d65760008281526005602052604090205460ff1661242e576040805160808101825260018082526008546020808401918252600d548486019081526000606086018181528982526005909352959095209351845460ff19169015151784559051918301919091559151600282015590516003909101555b60075460ff161580156124435750600c544210155b1561247c57600854600a81905561246290606490610a4b90604b61283d565b60085542600d819055600b546124789190612904565b600c555b6000828152600560209081526040918290208251608081018452815460ff161515815260018201549281019290925260028101549282019290925260039091015460608201526124cb83611614565b6060820152600a54602082015114156124e75760085460208201525b6124ef6111a0565b60408281019182526000858152600560209081529190208351815460ff19169015151781559083015160018201559051600282015560608201516003909101556001600160a01b038216156125d45760008381526006602090815260408083206001600160a01b0386168452825291829020825160608101845281548152600182015492810192909252600201549181019190915261258e848461211c565b6020808301918252606084015160408085019182526000888152600684528181206001600160a01b03891682529093529091209251835590516001830155516002909101555b505b60075460ff1615612621576040805162461bcd60e51b815260206004820152601060248201526f109054d41bdbdb0e881cdd1bdc1c195960821b604482015290519081900360640190fd5b61262b8484612d7a565b836126346127dc565b6001600160a01b03167f22aa98d9903d55438afe5107467c2619fbe070089c4ff9657ab08ae20d21a65e856040518082815260200191505060405180910390a350505050565b600080546040805163ea78803f60e01b81526004810185905290516001600160a01b039092169163ea78803f91602480820192602092909190829003018186803b1580156120ea57600080fd5b600c5481565b600b5481565b6126db6127dc565b6001600160a01b03166126ec61194e565b6001600160a01b031614612735576040805162461bcd60e51b815260206004820181905260248201526000805160206131e5833981519152604482015290519081900360640190fd5b6001600160a01b03811661277a5760405162461bcd60e51b81526004018080602001828103825260268152602001806131716026913960400191505060405180910390fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b600a5481565b3390565b600082821115612837576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008261284c57506000610b7f565b8282028284828161285957fe5b04146128965760405162461bcd60e51b81526004018080602001828103825260218152602001806131c46021913960400191505060405180910390fd5b9392505050565b60008082116128f3576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816128fc57fe5b049392505050565b600082820183811015612896576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b0381166129a35760405162461bcd60e51b815260040180806020018281038252602d815260200180613197602d913960400191505060405180910390fd5b6040516001600160a01b038216906000907f74da04524d50c64947f5dd5381ef1a4dca5cba8ed1d816243f9e48aa0b5617ed908290a3600280546001600160a01b0319166001600160a01b0392909216919091179055565b801580612a81575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612a5357600080fd5b505afa158015612a67573d6000803e3d6000fd5b505050506040513d6020811015612a7d57600080fd5b5051155b612abc5760405162461bcd60e51b81526004018080602001828103825260368152602001806132536036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261160f908490612e96565b6000546001600160a01b031663e63697c883612b286127dc565b846040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015612b7657600080fd5b505af1158015612b8a573d6000803e3d6000fd5b50505050611bcd612b996127dc565b6000546040805163ea78803f60e01b815260048101879052905185926001600160a01b03169163ea78803f916024808301926020929190829003018186803b158015612be457600080fd5b505afa158015612bf8573d6000803e3d6000fd5b505050506040513d6020811015612c0e57600080fd5b50516001600160a01b03169190612d28565b6000818310612c2f5781612896565b5090919050565b60008054604080516396c82e5760e01b81529051612896926001600160a01b0316916396c82e57916004808301926020929190829003018186803b158015612c7d57600080fd5b505afa158015612c91573d6000803e3d6000fd5b505050506040513d6020811015612ca757600080fd5b50516000546040805162ecfa2f60e31b8152600481018890529051610a4b926001600160a01b031691630767d178916024808301926020929190829003018186803b158015612cf557600080fd5b505afa158015612d09573d6000803e3d6000fd5b505050506040513d6020811015612d1f57600080fd5b5051859061283d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261160f908490612e96565b612e12612d856127dc565b6000546040805163ea78803f60e01b8152600481018790529051309286926001600160a01b039091169163ea78803f91602480820192602092909190829003018186803b158015612dd557600080fd5b505afa158015612de9573d6000803e3d6000fd5b505050506040513d6020811015612dff57600080fd5b50516001600160a01b0316929190612f47565b6000546001600160a01b031663bc157ac183612e2c6127dc565b846040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015612e7a57600080fd5b505af1158015612e8e573d6000803e3d6000fd5b505050505050565b6000612eeb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612fa19092919063ffffffff16565b80519091501561160f57808060200190516020811015612f0a57600080fd5b505161160f5760405162461bcd60e51b815260040180806020018281038252602a815260200180613229602a913960400191505060405180910390fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261160d908590612e96565b606061220b848460008585612fb5856130c6565b613006576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106130445780518252601f199092019160209182019101613025565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146130a6576040519150601f19603f3d011682016040523d82523d6000602084013e6130ab565b606091505b50915091506130bb8282866130cc565b979650505050505050565b3b151590565b606083156130db575081612896565b8251156130eb5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561313557818101518382015260200161311d565b50505050905090810190601f1680156131625780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573736f70657261746f723a207a65726f206164647265737320676976656e20666f72206e6577206f70657261746f72536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657261746f725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212204b603514bc72996ce273609b23a3b7333afadd19489897f8809767890ada275464736f6c63430007060033

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

000000000000000000000000106538cc16f938776c7c180186975bca238752870000000000000000000000004bd3a0f66758f2f4ebe575f9dfd7874e80689f10

-----Decoded View---------------
Arg [0] : _share (address): 0x106538CC16F938776c7c180186975BCA23875287
Arg [1] : _poolStore (address): 0x4Bd3a0F66758f2F4EBE575F9Dfd7874e80689F10

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000106538cc16f938776c7c180186975bca23875287
Arg [1] : 0000000000000000000000004bd3a0f66758f2f4ebe575f9dfd7874e80689f10


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.