GLMR Price: $0.51 (-3.86%)
Gas: 152 GWei

Contract

0xbACEB8eC6b9355Dfc0269C18bac9d6E2Bdc29C4F

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x608060406300042022-03-18 13:32:54741 days ago1647610374IN
 Create: MISOMasterChef
0 GLMR0.2235502100

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MISOMasterChef

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 13 : MISOMasterChef.sol
pragma solidity 0.6.12;


//----------------------------------------------------------------------------------
//    I n s t a n t
//
//        .:mmm.         .:mmm:.       .ii.  .:SSSSSSSSSSSSS.     .oOOOOOOOOOOOo.  
//      .mMM'':Mm.     .:MM'':Mm:.     .II:  :SSs..........     .oOO'''''''''''OOo.
//    .:Mm'   ':Mm.   .:Mm'   'MM:.    .II:  'sSSSSSSSSSSSSS:.  :OO.           .OO:
//  .'mMm'     ':MM:.:MMm'     ':MM:.  .II:  .:...........:SS.  'OOo:.........:oOO'
//  'mMm'        ':MMmm'         'mMm:  II:  'sSSSSSSSSSSSSS'     'oOOOOOOOOOOOO'  
//
//----------------------------------------------------------------------------------


import "../interfaces/IERC20.sol";
import "../OpenZeppelin/token/ERC20/SafeERC20.sol";
import "../OpenZeppelin/utils/EnumerableSet.sol";
import "../OpenZeppelin/math/SafeMath.sol";
import "../OpenZeppelin/access/Ownable.sol";

import "../Access/MISOAccessControls.sol";
import "../interfaces/IMisoFarm.sol";
import "../Utils/SafeTransfer.sol";


// MasterChef is the master of Rewards. He can make Rewards and he is a fair guy.
//
// Note that its ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once tokens are sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully its bug-free. God bless.
//
// MISO Update - Removed LP migrator
// MISO Update - Removed minter - Contract holds token
// MISO Update - Dev tips parameterised
// MISO Update - Replaced owner with access controls
// MISO Update - Added SafeTransfer

contract MISOMasterChef is IMisoFarm, MISOAccessControls, SafeTransfer {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;


    // Info of each user.
    struct UserInfo {
        uint256 amount;     // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
        //
        // We do some fancy math here. Basically, any point in time, the amount of tokens
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accRewardsPerShare) - user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Heres what happens:
        //   1. The pools `accRewardsPerShare` (and `lastRewardBlock`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. Users `amount` gets updated.
        //   4. Users `rewardDebt` gets updated.
    }

    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken;             // Address of LP token contract.
        uint256 allocPoint;         // How many allocation points assigned to this pool. tokens to distribute per block.
        uint256 lastRewardBlock;    // Last block number that tokens distribution occurs.
        uint256 accRewardsPerShare; // Accumulated tokens per share, times 1e12. See below.
    }

    // The rewards token
    IERC20 public rewards;
    // Dev address.
    address public devaddr;
    // Percentage amount to be tipped to devs.
    uint256 public devPercentage;
    // Tips owed to develpers.
    uint256 public tips;
    // uint256 public devPaid;
    
    // Block number when bonus tokens period ends.
    uint256 public bonusEndBlock;
    // Reward tokens created per block.
    uint256 public rewardsPerBlock;
    // Bonus muliplier for early rewards makers.
    uint256 public bonusMultiplier;
    // Total rewards debt.
    uint256 public totalRewardDebt;

    // MISOFarmFactory template id
    uint256 public constant override farmTemplate = 1;
    // For initial setup
    bool private initialised;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping (uint256 => mapping (address => UserInfo)) public userInfo;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint;
    // The block number when rewards mining starts.
    uint256 public startBlock;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);

    function initFarm(
        address _rewards,
        uint256 _rewardsPerBlock,
        uint256 _startBlock,
        address _devaddr,
        address _admin
    ) public {
        require(!initialised);
        rewards = IERC20(_rewards);
        totalAllocPoint = 0;
        rewardsPerBlock = _rewardsPerBlock;
        startBlock = _startBlock;
        devaddr = _devaddr;
        initAccessControls(_admin);
        initialised = true;
    }

    function initFarm(
        bytes calldata _data
    ) public override {
        (address _rewards,
        uint256 _rewardsPerBlock,
        uint256 _startBlock,
        address _devaddr,
        address _admin) = abi.decode(_data, (address, uint256, uint256, address, address));
        initFarm(_rewards,_rewardsPerBlock,_startBlock,_devaddr,_admin );
    }


    /** 
     * @dev Generates init data for Farm Factory
     * @param _rewards Rewards token address
     * @param _rewardsPerBlock - Rewards per block for the whole farm
     * @param _startBlock - Starting block
     * @param _divaddr Any donations if set are sent here
     * @param _accessControls Gives right to access
     */
    function getInitData(
            address _rewards,
            uint256 _rewardsPerBlock,
            uint256 _startBlock,
            address _divaddr,
            address _accessControls
    )
        external
        pure
        returns (bytes memory _data)
    {
        return abi.encode(_rewards, _rewardsPerBlock, _startBlock, _divaddr, _accessControls);
    }


    function setBonus(
        uint256 _bonusEndBlock,
        uint256 _bonusMultiplier
    ) public {
        require(
            hasAdminRole(msg.sender),
            "MasterChef.setBonus: Sender must be admin"
        );

        bonusEndBlock = _bonusEndBlock;
        bonusMultiplier = _bonusMultiplier;
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    function addToken(uint256 _allocPoint, IERC20 _lpToken, bool _withUpdate) public  {
        require(
            hasAdminRole(msg.sender),
            "MasterChef.addToken: Sender must be admin"
        );
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock ? block.number : startBlock;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);
        poolInfo.push(PoolInfo({
            lpToken: _lpToken,
            allocPoint: _allocPoint,
            lastRewardBlock: lastRewardBlock,
            accRewardsPerShare: 0
        }));
    }

    // Update the given pools token allocation point. Can only be called by the operator.
    function set(uint256 _pid, uint256 _allocPoint, bool _withUpdate) public  {
        require(
            hasOperatorRole(msg.sender) ,
            "MasterChef.set: Sender must be admin"
        );
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(_allocPoint);
        poolInfo[_pid].allocPoint = _allocPoint;
    }


    // Return reward multiplier over the given _from to _to block.
    function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
        uint256 remaining = blocksRemaining();
        uint multiplier = 0;
        if (remaining == 0) {
            return 0;
        } 
        if (_to <= bonusEndBlock) {
            multiplier = _to.sub(_from).mul(bonusMultiplier);
        } else if (_from >= bonusEndBlock) {
            multiplier = _to.sub(_from);
        } else {
            multiplier = bonusEndBlock.sub(_from).mul(bonusMultiplier).add(
                _to.sub(bonusEndBlock)
            );
        }

        if (multiplier > remaining ) {
            multiplier = remaining;
        }
        return multiplier;
    }

    // View function to see pending tokens on frontend.
    function pendingRewards(uint256 _pid, address _user) external view returns (uint256) {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accRewardsPerShare = pool.accRewardsPerShare;
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
            uint256 rewardsAccum = multiplier.mul(rewardsPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
            accRewardsPerShare = accRewardsPerShare.add(rewardsAccum.mul(1e12).div(lpSupply));
        }
        return user.amount.mul(accRewardsPerShare).div(1e12).sub(user.rewardDebt);
    }

    // Update reward vairables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (lpSupply == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 rewardsAccum = multiplier.mul(rewardsPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
        if (devPercentage > 0) {
            tips = tips.add(rewardsAccum.mul(devPercentage).div(1000));
        }
        totalRewardDebt = totalRewardDebt.add(rewardsAccum);
        pool.accRewardsPerShare = pool.accRewardsPerShare.add(rewardsAccum.mul(1e12).div(lpSupply));
        pool.lastRewardBlock = block.number;
    }

    // Deposit LP tokens to MasterChef for rewards allocation.
    function deposit(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user.amount.mul(pool.accRewardsPerShare).div(1e12).sub(user.rewardDebt);
            if(pending > 0) {
                totalRewardDebt = totalRewardDebt.sub(pending);
                safeRewardsTransfer(msg.sender, pending);
            }
        }
        if(_amount > 0) {
            pool.lpToken.safeTransferFrom(address(msg.sender), address(this), _amount);
            user.amount = user.amount.add(_amount);
        }
        user.rewardDebt = user.amount.mul(pool.accRewardsPerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accRewardsPerShare).div(1e12).sub(user.rewardDebt);
        if(pending > 0) {
            totalRewardDebt = totalRewardDebt.sub(pending);
            safeRewardsTransfer(msg.sender, pending);
        }
        if(_amount > 0) {
            user.amount = user.amount.sub(_amount);
            pool.lpToken.safeTransfer(address(msg.sender), _amount);
        }
        user.rewardDebt = user.amount.mul(pool.accRewardsPerShare).div(1e12);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;
        pool.lpToken.safeTransfer(address(msg.sender), amount);
        emit EmergencyWithdraw(msg.sender, _pid, amount);
    }

    // Safe rewards transfer function, just in case if rounding error causes pool to not have enough tokens.
    function safeRewardsTransfer(address _to, uint256 _amount) internal {
        uint256 rewardsBal = rewards.balanceOf(address(this));
        if (_amount > rewardsBal) {
            _safeTransfer(address(rewards), _to, rewardsBal);
        } else {
            _safeTransfer(address(rewards), _to, _amount);
        }
    }

    function tokensRemaining() public view returns(uint256) {
        return rewards.balanceOf(address(this));
    }

    function tokenDebt() public view returns(uint256) {
        return  totalRewardDebt.add(tips);
    }


    // Returns the number of blocks remaining with the current rewards balance
    function blocksRemaining() public view returns (uint256){
        if (tokensRemaining() <= tokenDebt()) {
            return 0;
        }
        uint256 rewardsBal = tokensRemaining().sub(tokenDebt()) ;
        if (rewardsPerBlock > 0) {
            if (devPercentage > 0) {
                rewardsBal = rewardsBal.mul(1000).div(devPercentage.add(1000));
            }
            return rewardsBal / rewardsPerBlock;
        } else {
            return 0;
        }
    }

    // Claims any rewards for the developers, if set
    function claimTips() public {
        require(msg.sender == devaddr, "dev: wut?");
        require(tips > 0, "dev: broke");
        uint256 claimable = tips;
        // devPaid = devPaid.add(claimable);
        tips = 0;
        safeRewardsTransfer(devaddr, claimable);
    }

    // Update dev address by the previous dev.
    function dev(address _devaddr) public {
        require(msg.sender == devaddr, "dev: wut?");
        devaddr = _devaddr;
    }

    // Update dev percentage.
    function setDevPercentage(uint256 _devPercentage) public {
        require(msg.sender == devaddr, "dev: wut?");
        devPercentage = _devPercentage;
    }

    
}

File 2 of 13 : IERC20.sol
pragma solidity 0.6.12;

interface IERC20 {
  function totalSupply() external view returns (uint256);

  function balanceOf(address account) external view returns (uint256);

  function allowance(address owner, address spender) external view returns (uint256);

  function approve(address spender, uint256 amount) external returns (bool);

  function name() external view returns (string memory);

  function symbol() external view returns (string memory);

  function decimals() external view returns (uint8);

  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);

  function transferFrom(
    address from,
    address to,
    uint256 amount
  ) external returns (bool);

  function permit(
    address owner,
    address spender,
    uint256 value,
    uint256 deadline,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external;
}

File 3 of 13 : SafeERC20.sol
pragma solidity 0.6.12;

import "../../../interfaces/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 {
        // 0xa9059cbb = bytes4(keccak256("transfer(address,uint256)"))
        _callOptionalReturn(token, abi.encodeWithSelector(0xa9059cbb, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        // 0x23b872dd = bytes4(keccak256("transferFrom(address,address,uint256)"))
        _callOptionalReturn(token, abi.encodeWithSelector(0x23b872dd, 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 13 : EnumerableSet.sol
pragma solidity 0.6.12;

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

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

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

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

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

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

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

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

            bytes32 lastvalue = set._values[lastIndex];

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

File 5 of 13 : SafeMath.sol
pragma solidity 0.6.12;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, 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 13 : Ownable.sol
pragma solidity 0.6.12;

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 13 : MISOAccessControls.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.6.12;

import "./MISOAdminAccess.sol";

/**
 * @notice Access Controls
 * @author Attr: BlockRocket.tech
 */
contract MISOAccessControls is MISOAdminAccess {
    /// @notice Role definitions
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant SMART_CONTRACT_ROLE = keccak256("SMART_CONTRACT_ROLE");
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");

    /**
     * @notice The deployer is automatically given the admin role which will allow them to then grant roles to other addresses
     */
    constructor() public {
    }


    /////////////
    // Lookups //
    /////////////

    /**
     * @notice Used to check whether an address has the minter role
     * @param _address EOA or contract being checked
     * @return bool True if the account has the role or false if it does not
     */
    function hasMinterRole(address _address) public view returns (bool) {
        return hasRole(MINTER_ROLE, _address);
    }

    /**
     * @notice Used to check whether an address has the smart contract role
     * @param _address EOA or contract being checked
     * @return bool True if the account has the role or false if it does not
     */
    function hasSmartContractRole(address _address) public view returns (bool) {
        return hasRole(SMART_CONTRACT_ROLE, _address);
    }

    /**
     * @notice Used to check whether an address has the operator role
     * @param _address EOA or contract being checked
     * @return bool True if the account has the role or false if it does not
     */
    function hasOperatorRole(address _address) public view returns (bool) {
        return hasRole(OPERATOR_ROLE, _address);
    }

    ///////////////
    // Modifiers //
    ///////////////

    /**
     * @notice Grants the minter role to an address
     * @dev The sender must have the admin role
     * @param _address EOA or contract receiving the new role
     */
    function addMinterRole(address _address) external {
        grantRole(MINTER_ROLE, _address);
    }

    /**
     * @notice Removes the minter role from an address
     * @dev The sender must have the admin role
     * @param _address EOA or contract affected
     */
    function removeMinterRole(address _address) external {
        revokeRole(MINTER_ROLE, _address);
    }

    /**
     * @notice Grants the smart contract role to an address
     * @dev The sender must have the admin role
     * @param _address EOA or contract receiving the new role
     */
    function addSmartContractRole(address _address) external {
        grantRole(SMART_CONTRACT_ROLE, _address);
    }

    /**
     * @notice Removes the smart contract role from an address
     * @dev The sender must have the admin role
     * @param _address EOA or contract affected
     */
    function removeSmartContractRole(address _address) external {
        revokeRole(SMART_CONTRACT_ROLE, _address);
    }

    /**
     * @notice Grants the operator role to an address
     * @dev The sender must have the admin role
     * @param _address EOA or contract receiving the new role
     */
    function addOperatorRole(address _address) external {
        grantRole(OPERATOR_ROLE, _address);
    }

    /**
     * @notice Removes the operator role from an address
     * @dev The sender must have the admin role
     * @param _address EOA or contract affected
     */
    function removeOperatorRole(address _address) external {
        revokeRole(OPERATOR_ROLE, _address);
    }

}

File 8 of 13 : IMisoFarm.sol
pragma solidity 0.6.12;

interface IMisoFarm {

    function initFarm(
        bytes calldata data
    ) external;
    function farmTemplate() external view returns (uint256);

}

File 9 of 13 : SafeTransfer.sol
pragma solidity 0.6.12;

contract SafeTransfer {

    address private constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    /// @notice Event for token withdrawals.
    event TokensWithdrawn(address token, address to, uint256 amount);

    /// @dev Helper function to handle both ETH and ERC20 payments
    function _safeTokenPayment(
        address _token,
        address payable _to,
        uint256 _amount
    ) internal {
        if (address(_token) == ETH_ADDRESS) {
            _safeTransferETH(_to,_amount );
        } else {
            _safeTransfer(_token, _to, _amount);
        }

        emit TokensWithdrawn(_token, _to, _amount);
    }


    /// @dev Helper function to handle both ETH and ERC20 payments
    function _tokenPayment(
        address _token,
        address payable _to,
        uint256 _amount
    ) internal {
        if (address(_token) == ETH_ADDRESS) {
            _to.transfer(_amount);
        } else {
            _safeTransfer(_token, _to, _amount);
        }

        emit TokensWithdrawn(_token, _to, _amount);
    }


    /// @dev Transfer helper from UniswapV2 Router
    function _safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }


    /**
     * There are many non-compliant ERC20 tokens... this can handle most, adapted from UniSwap V2
     * Im trying to make it a habit to put external calls last (reentrancy)
     * You can put this in an internal function if you like.
     */
    function _safeTransfer(
        address token,
        address to,
        uint256 amount
    ) internal virtual {
        // solium-disable-next-line security/no-low-level-calls
        (bool success, bytes memory data) =
            token.call(
                // 0xa9059cbb = bytes4(keccak256("transfer(address,uint256)"))
                abi.encodeWithSelector(0xa9059cbb, to, amount)
            );
        require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 Transfer failed
    }

    function _safeTransferFrom(
        address token,
        address from,
        uint256 amount
    ) internal virtual {
        // solium-disable-next-line security/no-low-level-calls
        (bool success, bytes memory data) =
            token.call(
                // 0x23b872dd = bytes4(keccak256("transferFrom(address,address,uint256)"))
                abi.encodeWithSelector(0x23b872dd, from, address(this), amount)
            );
        require(success && (data.length == 0 || abi.decode(data, (bool)))); // ERC20 TransferFrom failed
    }

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

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


}

File 10 of 13 : Address.sol
pragma solidity 0.6.12;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 11 of 13 : Context.sol
pragma solidity 0.6.12;

/*
 * @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 13 : MISOAdminAccess.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.6.12;

import "../OpenZeppelin/access/AccessControl.sol";


contract MISOAdminAccess is AccessControl {

    /// @dev Whether access is initialised.
    bool private initAccess;

    /// @notice The deployer is automatically given the admin role which will allow them to then grant roles to other addresses.
    constructor() public {
    }

    /**
     * @notice Initializes access controls.
     * @param _admin Admins address.
     */
    function initAccessControls(address _admin) public {
        require(!initAccess, "Already initialised");
        require(_admin != address(0), "Incorrect input");
        _setupRole(DEFAULT_ADMIN_ROLE, _admin);
        initAccess = true;
    }

    /////////////
    // Lookups //
    /////////////

    /**
     * @notice Used to check whether an address has the admin role.
     * @param _address EOA or contract being checked.
     * @return bool True if the account has the role or false if it does not.
     */
    function hasAdminRole(address _address) public  view returns (bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, _address);
    }

    ///////////////
    // Modifiers //
    ///////////////

    /**
     * @notice Grants the admin role to an address.
     * @dev The sender must have the admin role.
     * @param _address EOA or contract receiving the new role.
     */
    function addAdminRole(address _address) external {
        grantRole(DEFAULT_ADMIN_ROLE, _address);
    }

    /**
     * @notice Removes the admin role from an address.
     * @dev The sender must have the admin role.
     * @param _address EOA or contract affected.
     */
    function removeAdminRole(address _address) external {
        revokeRole(DEFAULT_ADMIN_ROLE, _address);
    }
}

File 13 of 13 : AccessControl.sol
pragma solidity 0.6.12;

import "../utils/EnumerableSet.sol";
import "../utils/Context.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SMART_CONTRACT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addAdminRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addMinterRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addOperatorRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addSmartContractRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blocksRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimTips","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":"address","name":"_devaddr","type":"address"}],"name":"dev","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"devaddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"farmTemplate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_rewards","type":"address"},{"internalType":"uint256","name":"_rewardsPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"address","name":"_divaddr","type":"address"},{"internalType":"address","name":"_accessControls","type":"address"}],"name":"getInitData","outputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"hasAdminRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"hasMinterRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"hasOperatorRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"hasSmartContractRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"initAccessControls","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewards","type":"address"},{"internalType":"uint256","name":"_rewardsPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"address","name":"_admin","type":"address"}],"name":"initFarm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"initFarm","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accRewardsPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeAdminRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeMinterRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeOperatorRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeSmartContractRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewards","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusMultiplier","type":"uint256"}],"name":"setBonus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_devPercentage","type":"uint256"}],"name":"setDevPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tips","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensRemaining","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardDebt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","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"}]

608060405234801561001057600080fd5b50612779806100206000396000f3fe608060405234801561001057600080fd5b50600436106103835760003560e01c8063857d2608116101de578063c395fcb31161010f578063d5391393116100ad578063e2bbb1581161007c578063e2bbb15814610a8b578063e6594abd14610aae578063f5b541a614610ad4578063fc4e3e0a14610adc57610383565b8063d5391393146109fd578063d547741f14610a05578063d69de7e714610a31578063dccfe31014610a6557610383565b8063ca15c873116100e9578063ca15c873146109a4578063d0863580146109c1578063d18df53c146109c9578063d49e77cd146109f557610383565b8063c395fcb31461096e578063c3a4382414610994578063c8b081251461099c57610383565b80639478941c1161017c578063a8b973a111610156578063a8b973a114610861578063adbf377614610869578063b7928b1d1461088f578063bd7aef24146108b557610383565b80639478941c1461082b5780639ec5a89414610851578063a217fddf1461085957610383565b80638dbb1e3a116101b85780638dbb1e3a146107585780639010d07c1461077b57806391d14854146107ba57806393f1a40b146107e657610383565b8063857d2608146107045780638a845fc01461070c5780638d88a90e1461073257610383565b806336568abe116102b85780635befdbca1161025657806364482f791161023057806364482f791461063b5780636595171c14610666578063824fa8211461068c57806383bb3877146106fc57610383565b80635befdbca146105e75780635eeb67101461062b578063630b5ba11461063357610383565b806348cd4cb11161029257806348cd4cb11461057f57806351eb05a6146105875780635312ea8e146105a457806354f1e126146105c157610383565b806336568abe1461050a5780633f16431a14610536578063441a3e701461055c57610383565b806317caf6f111610325578063248a9ca3116102ff578063248a9ca31461049c5780632c77f656146104b95780632f2ff15d146104c15780632f4a7e51146104ed57610383565b806317caf6f1146104845780631a4e1e781461048c5780631aed65531461049457610383565b8063099db01711610361578063099db017146103cf578063113b0ab2146104095780631526fe271461042f578063158cb2741461047c57610383565b8063037c99b01461038857806306af3dfd146103ad578063081e3eda146103b5575b600080fd5b6103ab6004803603604081101561039e57600080fd5b5080359060200135610b02565b005b6103ab610b51565b6103bd610c02565b60408051918252519081900360200190f35b6103f5600480360360208110156103e557600080fd5b50356001600160a01b0316610c09565b604080519115158252519081900360200190f35b6103f56004803603602081101561041f57600080fd5b50356001600160a01b0316610c29565b61044c6004803603602081101561044557600080fd5b5035610c43565b604080516001600160a01b0390951685526020850193909352838301919091526060830152519081900360800190f35b6103bd610c84565b6103bd610ca2565b6103bd610ca8565b6103bd610cae565b6103bd600480360360208110156104b257600080fd5b5035610cb4565b6103bd610cc9565b6103ab600480360360408110156104d757600080fd5b50803590602001356001600160a01b0316610cce565b6103ab6004803603602081101561050357600080fd5b5035610d3a565b6103ab6004803603604081101561052057600080fd5b50803590602001356001600160a01b0316610d8a565b6103ab6004803603602081101561054c57600080fd5b50356001600160a01b0316610deb565b6103ab6004803603604081101561057257600080fd5b5080359060200135610e03565b6103bd610f72565b6103ab6004803603602081101561059d57600080fd5b5035610f78565b6103ab600480360360208110156105ba57600080fd5b50356110eb565b6103ab600480360360208110156105d757600080fd5b50356001600160a01b0316611187565b6103ab600480360360a08110156105fd57600080fd5b506001600160a01b03813581169160208101359160408201359160608101358216916080909101351661119f565b6103bd61121a565b6103ab611220565b6103ab6004803603606081101561065157600080fd5b5080359060208101359060400135151561123f565b6103ab6004803603602081101561067c57600080fd5b50356001600160a01b03166112fc565b6103ab600480360360208110156106a257600080fd5b8101906020810181356401000000008111156106bd57600080fd5b8201836020820111156106cf57600080fd5b803590602001918460018302840111640100000000831117156106f157600080fd5b509092509050611307565b6103bd611364565b6103bd61136a565b6103ab6004803603602081101561072257600080fd5b50356001600160a01b031661137c565b6103ab6004803603602081101561074857600080fd5b50356001600160a01b0316611394565b6103bd6004803603604081101561076e57600080fd5b5080359060200135611401565b61079e6004803603604081101561079157600080fd5b508035906020013561149d565b604080516001600160a01b039092168252519081900360200190f35b6103f5600480360360408110156107d057600080fd5b50803590602001356001600160a01b03166114bc565b610812600480360360408110156107fc57600080fd5b50803590602001356001600160a01b03166114d4565b6040805192835260208301919091528051918290030190f35b6103ab6004803603602081101561084157600080fd5b50356001600160a01b03166114f8565b61079e611510565b6103bd611524565b6103bd611529565b6103ab6004803603602081101561087f57600080fd5b50356001600160a01b031661152f565b6103ab600480360360208110156108a557600080fd5b50356001600160a01b0316611547565b6108f9600480360360a08110156108cb57600080fd5b506001600160a01b03813581169160208101359160408201359160608101358216916080909101351661155f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561093357818101518382015260200161091b565b50505050905090810190601f1680156109605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f56004803603602081101561098457600080fd5b50356001600160a01b03166115ab565b6103bd6115b7565b6103bd6115bd565b6103bd600480360360208110156109ba57600080fd5b503561163e565b6103bd611655565b6103bd600480360360408110156109df57600080fd5b50803590602001356001600160a01b03166116dc565b61079e61183e565b6103bd61184d565b6103ab60048036036040811015610a1b57600080fd5b50803590602001356001600160a01b031661185f565b6103ab60048036036060811015610a4757600080fd5b508035906001600160a01b03602082013516906040013515156118b8565b6103ab60048036036020811015610a7b57600080fd5b50356001600160a01b0316611a1f565b6103ab60048036036040811015610aa157600080fd5b5080359060200135611a2a565b6103ab60048036036020811015610ac457600080fd5b50356001600160a01b0316611b4c565b6103bd611c01565b6103f560048036036020811015610af257600080fd5b50356001600160a01b0316611c13565b610b0b336115ab565b610b465760405162461bcd60e51b81526004018080602001828103825260298152602001806126c26029913960400191505060405180910390fd5b600591909155600755565b6002546001600160a01b03163314610b9c576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600060045411610be0576040805162461bcd60e51b815260206004820152600a6024820152696465763a2062726f6b6560b01b604482015290519081900360640190fd5b600480546000909155600254610bff906001600160a01b031682611c2d565b50565b600a545b90565b6000610c2360008051602061267e833981519152836114bc565b92915050565b6000610c236000805160206125c4833981519152836114bc565b600a8181548110610c5057fe5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6000610c9d600454600854611cf590919063ffffffff16565b905090565b600c5481565b60045481565b60055481565b60009081526020819052604090206002015490565b600181565b600082815260208190526040902060020154610cf190610cec611d4f565b6114bc565b610d2c5760405162461bcd60e51b815260040180806020018281038252602f815260200180612595602f913960400191505060405180910390fd5b610d368282611d53565b5050565b6002546001600160a01b03163314610d85576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600355565b610d92611d4f565b6001600160a01b0316816001600160a01b031614610de15760405162461bcd60e51b815260040180806020018281038252602f815260200180612715602f913960400191505060405180910390fd5b610d368282611dbc565b610bff6000805160206125c483398151915282610cce565b6000600a8381548110610e1257fe5b60009182526020808320868452600b825260408085203386529092529220805460049092029092019250831115610e85576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b610e8e84610f78565b6000610ec88260010154610ec264e8d4a51000610ebc87600301548760000154611e2590919063ffffffff16565b90611e7e565b90611ee5565b90508015610eea57600854610edd9082611ee5565b600855610eea3382611c2d565b8315610f14578154610efc9085611ee5565b82558254610f14906001600160a01b03163386611f42565b60038301548254610f2f9164e8d4a5100091610ebc91611e25565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050505050565b600d5481565b6000600a8281548110610f8757fe5b9060005260206000209060040201905080600201544311610fa85750610bff565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610ff257600080fd5b505afa158015611006573d6000803e3d6000fd5b505050506040513d602081101561101c57600080fd5b5051905080611032575043600290910155610bff565b6000611042836002015443611401565b9050600061106f600c54610ebc866001015461106960065487611e2590919063ffffffff16565b90611e25565b600354909150156110a5576110a16110986103e8610ebc60035485611e2590919063ffffffff16565b60045490611cf5565b6004555b6008546110b29082611cf5565b6008556110d66110cb84610ebc8464e8d4a51000611e25565b600386015490611cf5565b60038501555050436002909201919091555050565b6000600a82815481106110fa57fe5b60009182526020808320858452600b82526040808520338087529352842080548582556001820195909555600490930201805490945091929161114a916001600160a01b03919091169083611f42565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a350505050565b610bff60008051602061267e8339815191528261185f565b60095460ff16156111af57600080fd5b60018054610100600160a81b0319166101006001600160a01b0388811691909102919091179091556000600c556006859055600d849055600280546001600160a01b03191691841691909117905561120681611b4c565b50506009805460ff19166001179055505050565b60065481565b600a5460005b81811015610d365761123781610f78565b600101611226565b61124833611c13565b6112835760405162461bcd60e51b815260040180806020018281038252602481526020018061269e6024913960400191505060405180910390fd5b801561129157611291611220565b6112ce826112c8600a86815481106112a557fe5b906000526020600020906004020160010154600c54611ee590919063ffffffff16565b90611cf5565b600c8190555081600a84815481106112e257fe5b906000526020600020906004020160010181905550505050565b610bff600082610cce565b6000806000806000868660a081101561131f57600080fd5b506001600160a01b03813581169650602082013595506040820135945060608201358116935060809091013516905061135b858585858561119f565b50505050505050565b60085481565b6000805160206125c483398151915281565b610bff6000805160206125c48339815191528261185f565b6002546001600160a01b031633146113df576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008061140c611655565b905060008161142057600092505050610c23565b60055484116114415760075461143a906110698688611ee5565b905061148a565b60055485106114545761143a8486611ee5565b61148761146c60055486611ee590919063ffffffff16565b6112c860075461106989600554611ee590919063ffffffff16565b90505b818111156114955750805b949350505050565b60008281526020819052604081206114b59083611f94565b9392505050565b60008281526020819052604081206114b59083611fa0565b600b6020908152600092835260408084209091529082529020805460019091015482565b610bff60008051602061265e8339815191528261185f565b60015461010090046001600160a01b031681565b600081565b60075481565b610bff60008051602061267e83398151915282610cce565b610bff60008051602061265e83398151915282610cce565b604080516001600160a01b039687166020820152808201959095526060850193909352908416608084015290921660a0808301919091528251808303909101815260c090910190915290565b6000610c2381836114bc565b60035481565b600154604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561160d57600080fd5b505afa158015611621573d6000803e3d6000fd5b505050506040513d602081101561163757600080fd5b5051905090565b6000818152602081905260408120610c2390611fb5565b600061165f610c84565b6116676115bd565b1161167457506000610c06565b6000611689611681610c84565b610ec26115bd565b600654909150156116d257600354156116be576003546116bb906116af906103e8611cf5565b610ebc836103e8611e25565b90505b60065481816116c957fe5b04915050610c06565b6000915050610c06565b600080600a84815481106116ec57fe5b60009182526020808320878452600b825260408085206001600160a01b03898116875290845281862060049586029093016003810154815484516370a0823160e01b81523098810198909852935191985093969395939492909116926370a08231926024808301939192829003018186803b15801561176a57600080fd5b505afa15801561177e573d6000803e3d6000fd5b505050506040513d602081101561179457600080fd5b50516002850154909150431180156117ab57508015155b1561180b5760006117c0856002015443611401565b905060006117e7600c54610ebc886001015461106960065487611e2590919063ffffffff16565b90506118066117ff84610ebc8464e8d4a51000611e25565b8590611cf5565b935050505b6118338360010154610ec264e8d4a51000610ebc868860000154611e2590919063ffffffff16565b979650505050505050565b6002546001600160a01b031681565b60008051602061267e83398151915281565b60008281526020819052604090206002015461187d90610cec611d4f565b610de15760405162461bcd60e51b815260040180806020018281038252603081526020018061260d6030913960400191505060405180910390fd5b6118c1336115ab565b6118fc5760405162461bcd60e51b81526004018080602001828103825260298152602001806125e46029913960400191505060405180910390fd5b801561190a5761190a611220565b6000600d54431161191d57600d5461191f565b435b600c5490915061192f9085611cf5565b600c55604080516080810182526001600160a01b03948516815260208101958652908101918252600060608201818152600a8054600181018255925291517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8600490920291820180546001600160a01b031916919096161790945593517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a9840155517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa8301555090517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2ab90910155565b610bff60008261185f565b6000600a8381548110611a3957fe5b60009182526020808320868452600b82526040808520338652909252922060049091029091019150611a6a84610f78565b805415611ac3576000611a9f8260010154610ec264e8d4a51000610ebc87600301548760000154611e2590919063ffffffff16565b90508015611ac157600854611ab49082611ee5565b600855611ac13382611c2d565b505b8215611aef578154611ae0906001600160a01b0316333086611fc0565b8054611aec9084611cf5565b81555b60038201548154611b0a9164e8d4a5100091610ebc91611e25565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350505050565b60015460ff1615611b9a576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5cd959606a1b604482015290519081900360640190fd5b6001600160a01b038116611be7576040805162461bcd60e51b815260206004820152600f60248201526e125b98dbdc9c9958dd081a5b9c1d5d608a1b604482015290519081900360640190fd5b611bf2600082610d2c565b506001805460ff191681179055565b60008051602061265e83398151915281565b6000610c2360008051602061265e833981519152836114bc565b600154604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611c7d57600080fd5b505afa158015611c91573d6000803e3d6000fd5b505050506040513d6020811015611ca757600080fd5b5051905080821115611cd457600154611ccf9061010090046001600160a01b03168483612020565b611cf0565b600154611cf09061010090046001600160a01b03168484612020565b505050565b6000828201838110156114b5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6000828152602081905260409020611d6b9082612142565b15610d3657611d78611d4f565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081905260409020611dd49082612157565b15610d3657611de1611d4f565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600082611e3457506000610c23565b82820282848281611e4157fe5b04146114b55760405162461bcd60e51b815260040180806020018281038252602181526020018061263d6021913960400191505060405180910390fd5b6000808211611ed4576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611edd57fe5b049392505050565b600082821115611f3c576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611cf090849061216c565b60006114b5838361221d565b60006114b5836001600160a01b038416612281565b6000610c2382612299565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261201a90859061216c565b50505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b6020831061209d5780518252601f19909201916020918201910161207e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146120ff576040519150601f19603f3d011682016040523d82523d6000602084013e612104565b606091505b5091509150818015612132575080511580612132575080806020019051602081101561212f57600080fd5b50515b61213b57600080fd5b5050505050565b60006114b5836001600160a01b03841661229d565b60006114b5836001600160a01b0384166122e7565b60606121c1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123ad9092919063ffffffff16565b805190915015611cf0578080602001905160208110156121e057600080fd5b5051611cf05760405162461bcd60e51b815260040180806020018281038252602a8152602001806126eb602a913960400191505060405180910390fd5b8154600090821061225f5760405162461bcd60e51b81526004018080602001828103825260228152602001806125736022913960400191505060405180910390fd5b82600001828154811061226e57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b60006122a98383612281565b6122df57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c23565b506000610c23565b600081815260018301602052604081205480156123a3578354600019808301919081019060009087908390811061231a57fe5b906000526020600020015490508087600001848154811061233757fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061236757fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610c23565b6000915050610c23565b60606114958484600085856123c1856124c8565b612412576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106124515780518252601f199092019160209182019101612432565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146124b3576040519150601f19603f3d011682016040523d82523d6000602084013e6124b8565b606091505b50915091506118338282866124ce565b3b151590565b606083156124dd5750816114b5565b8251156124ed5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561253757818101518382015260200161251f565b50505050905090810190601f1680156125645780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e749d49f397ae9ef1a834b569acb967799a367061e305932181a44f5773da873bfd4d6173746572436865662e616464546f6b656e3a2053656e646572206d7573742062652061646d696e416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7797667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a64d6173746572436865662e7365743a2053656e646572206d7573742062652061646d696e4d6173746572436865662e736574426f6e75733a2053656e646572206d7573742062652061646d696e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212200b445c5e65fa022e37000f5cebdc2330e63561a95de7d5b710ac82b6e44d97b364736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103835760003560e01c8063857d2608116101de578063c395fcb31161010f578063d5391393116100ad578063e2bbb1581161007c578063e2bbb15814610a8b578063e6594abd14610aae578063f5b541a614610ad4578063fc4e3e0a14610adc57610383565b8063d5391393146109fd578063d547741f14610a05578063d69de7e714610a31578063dccfe31014610a6557610383565b8063ca15c873116100e9578063ca15c873146109a4578063d0863580146109c1578063d18df53c146109c9578063d49e77cd146109f557610383565b8063c395fcb31461096e578063c3a4382414610994578063c8b081251461099c57610383565b80639478941c1161017c578063a8b973a111610156578063a8b973a114610861578063adbf377614610869578063b7928b1d1461088f578063bd7aef24146108b557610383565b80639478941c1461082b5780639ec5a89414610851578063a217fddf1461085957610383565b80638dbb1e3a116101b85780638dbb1e3a146107585780639010d07c1461077b57806391d14854146107ba57806393f1a40b146107e657610383565b8063857d2608146107045780638a845fc01461070c5780638d88a90e1461073257610383565b806336568abe116102b85780635befdbca1161025657806364482f791161023057806364482f791461063b5780636595171c14610666578063824fa8211461068c57806383bb3877146106fc57610383565b80635befdbca146105e75780635eeb67101461062b578063630b5ba11461063357610383565b806348cd4cb11161029257806348cd4cb11461057f57806351eb05a6146105875780635312ea8e146105a457806354f1e126146105c157610383565b806336568abe1461050a5780633f16431a14610536578063441a3e701461055c57610383565b806317caf6f111610325578063248a9ca3116102ff578063248a9ca31461049c5780632c77f656146104b95780632f2ff15d146104c15780632f4a7e51146104ed57610383565b806317caf6f1146104845780631a4e1e781461048c5780631aed65531461049457610383565b8063099db01711610361578063099db017146103cf578063113b0ab2146104095780631526fe271461042f578063158cb2741461047c57610383565b8063037c99b01461038857806306af3dfd146103ad578063081e3eda146103b5575b600080fd5b6103ab6004803603604081101561039e57600080fd5b5080359060200135610b02565b005b6103ab610b51565b6103bd610c02565b60408051918252519081900360200190f35b6103f5600480360360208110156103e557600080fd5b50356001600160a01b0316610c09565b604080519115158252519081900360200190f35b6103f56004803603602081101561041f57600080fd5b50356001600160a01b0316610c29565b61044c6004803603602081101561044557600080fd5b5035610c43565b604080516001600160a01b0390951685526020850193909352838301919091526060830152519081900360800190f35b6103bd610c84565b6103bd610ca2565b6103bd610ca8565b6103bd610cae565b6103bd600480360360208110156104b257600080fd5b5035610cb4565b6103bd610cc9565b6103ab600480360360408110156104d757600080fd5b50803590602001356001600160a01b0316610cce565b6103ab6004803603602081101561050357600080fd5b5035610d3a565b6103ab6004803603604081101561052057600080fd5b50803590602001356001600160a01b0316610d8a565b6103ab6004803603602081101561054c57600080fd5b50356001600160a01b0316610deb565b6103ab6004803603604081101561057257600080fd5b5080359060200135610e03565b6103bd610f72565b6103ab6004803603602081101561059d57600080fd5b5035610f78565b6103ab600480360360208110156105ba57600080fd5b50356110eb565b6103ab600480360360208110156105d757600080fd5b50356001600160a01b0316611187565b6103ab600480360360a08110156105fd57600080fd5b506001600160a01b03813581169160208101359160408201359160608101358216916080909101351661119f565b6103bd61121a565b6103ab611220565b6103ab6004803603606081101561065157600080fd5b5080359060208101359060400135151561123f565b6103ab6004803603602081101561067c57600080fd5b50356001600160a01b03166112fc565b6103ab600480360360208110156106a257600080fd5b8101906020810181356401000000008111156106bd57600080fd5b8201836020820111156106cf57600080fd5b803590602001918460018302840111640100000000831117156106f157600080fd5b509092509050611307565b6103bd611364565b6103bd61136a565b6103ab6004803603602081101561072257600080fd5b50356001600160a01b031661137c565b6103ab6004803603602081101561074857600080fd5b50356001600160a01b0316611394565b6103bd6004803603604081101561076e57600080fd5b5080359060200135611401565b61079e6004803603604081101561079157600080fd5b508035906020013561149d565b604080516001600160a01b039092168252519081900360200190f35b6103f5600480360360408110156107d057600080fd5b50803590602001356001600160a01b03166114bc565b610812600480360360408110156107fc57600080fd5b50803590602001356001600160a01b03166114d4565b6040805192835260208301919091528051918290030190f35b6103ab6004803603602081101561084157600080fd5b50356001600160a01b03166114f8565b61079e611510565b6103bd611524565b6103bd611529565b6103ab6004803603602081101561087f57600080fd5b50356001600160a01b031661152f565b6103ab600480360360208110156108a557600080fd5b50356001600160a01b0316611547565b6108f9600480360360a08110156108cb57600080fd5b506001600160a01b03813581169160208101359160408201359160608101358216916080909101351661155f565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561093357818101518382015260200161091b565b50505050905090810190601f1680156109605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f56004803603602081101561098457600080fd5b50356001600160a01b03166115ab565b6103bd6115b7565b6103bd6115bd565b6103bd600480360360208110156109ba57600080fd5b503561163e565b6103bd611655565b6103bd600480360360408110156109df57600080fd5b50803590602001356001600160a01b03166116dc565b61079e61183e565b6103bd61184d565b6103ab60048036036040811015610a1b57600080fd5b50803590602001356001600160a01b031661185f565b6103ab60048036036060811015610a4757600080fd5b508035906001600160a01b03602082013516906040013515156118b8565b6103ab60048036036020811015610a7b57600080fd5b50356001600160a01b0316611a1f565b6103ab60048036036040811015610aa157600080fd5b5080359060200135611a2a565b6103ab60048036036020811015610ac457600080fd5b50356001600160a01b0316611b4c565b6103bd611c01565b6103f560048036036020811015610af257600080fd5b50356001600160a01b0316611c13565b610b0b336115ab565b610b465760405162461bcd60e51b81526004018080602001828103825260298152602001806126c26029913960400191505060405180910390fd5b600591909155600755565b6002546001600160a01b03163314610b9c576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600060045411610be0576040805162461bcd60e51b815260206004820152600a6024820152696465763a2062726f6b6560b01b604482015290519081900360640190fd5b600480546000909155600254610bff906001600160a01b031682611c2d565b50565b600a545b90565b6000610c2360008051602061267e833981519152836114bc565b92915050565b6000610c236000805160206125c4833981519152836114bc565b600a8181548110610c5057fe5b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169350919084565b6000610c9d600454600854611cf590919063ffffffff16565b905090565b600c5481565b60045481565b60055481565b60009081526020819052604090206002015490565b600181565b600082815260208190526040902060020154610cf190610cec611d4f565b6114bc565b610d2c5760405162461bcd60e51b815260040180806020018281038252602f815260200180612595602f913960400191505060405180910390fd5b610d368282611d53565b5050565b6002546001600160a01b03163314610d85576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600355565b610d92611d4f565b6001600160a01b0316816001600160a01b031614610de15760405162461bcd60e51b815260040180806020018281038252602f815260200180612715602f913960400191505060405180910390fd5b610d368282611dbc565b610bff6000805160206125c483398151915282610cce565b6000600a8381548110610e1257fe5b60009182526020808320868452600b825260408085203386529092529220805460049092029092019250831115610e85576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b610e8e84610f78565b6000610ec88260010154610ec264e8d4a51000610ebc87600301548760000154611e2590919063ffffffff16565b90611e7e565b90611ee5565b90508015610eea57600854610edd9082611ee5565b600855610eea3382611c2d565b8315610f14578154610efc9085611ee5565b82558254610f14906001600160a01b03163386611f42565b60038301548254610f2f9164e8d4a5100091610ebc91611e25565b6001830155604080518581529051869133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a35050505050565b600d5481565b6000600a8281548110610f8757fe5b9060005260206000209060040201905080600201544311610fa85750610bff565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610ff257600080fd5b505afa158015611006573d6000803e3d6000fd5b505050506040513d602081101561101c57600080fd5b5051905080611032575043600290910155610bff565b6000611042836002015443611401565b9050600061106f600c54610ebc866001015461106960065487611e2590919063ffffffff16565b90611e25565b600354909150156110a5576110a16110986103e8610ebc60035485611e2590919063ffffffff16565b60045490611cf5565b6004555b6008546110b29082611cf5565b6008556110d66110cb84610ebc8464e8d4a51000611e25565b600386015490611cf5565b60038501555050436002909201919091555050565b6000600a82815481106110fa57fe5b60009182526020808320858452600b82526040808520338087529352842080548582556001820195909555600490930201805490945091929161114a916001600160a01b03919091169083611f42565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a350505050565b610bff60008051602061267e8339815191528261185f565b60095460ff16156111af57600080fd5b60018054610100600160a81b0319166101006001600160a01b0388811691909102919091179091556000600c556006859055600d849055600280546001600160a01b03191691841691909117905561120681611b4c565b50506009805460ff19166001179055505050565b60065481565b600a5460005b81811015610d365761123781610f78565b600101611226565b61124833611c13565b6112835760405162461bcd60e51b815260040180806020018281038252602481526020018061269e6024913960400191505060405180910390fd5b801561129157611291611220565b6112ce826112c8600a86815481106112a557fe5b906000526020600020906004020160010154600c54611ee590919063ffffffff16565b90611cf5565b600c8190555081600a84815481106112e257fe5b906000526020600020906004020160010181905550505050565b610bff600082610cce565b6000806000806000868660a081101561131f57600080fd5b506001600160a01b03813581169650602082013595506040820135945060608201358116935060809091013516905061135b858585858561119f565b50505050505050565b60085481565b6000805160206125c483398151915281565b610bff6000805160206125c48339815191528261185f565b6002546001600160a01b031633146113df576040805162461bcd60e51b81526020600482015260096024820152686465763a207775743f60b81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008061140c611655565b905060008161142057600092505050610c23565b60055484116114415760075461143a906110698688611ee5565b905061148a565b60055485106114545761143a8486611ee5565b61148761146c60055486611ee590919063ffffffff16565b6112c860075461106989600554611ee590919063ffffffff16565b90505b818111156114955750805b949350505050565b60008281526020819052604081206114b59083611f94565b9392505050565b60008281526020819052604081206114b59083611fa0565b600b6020908152600092835260408084209091529082529020805460019091015482565b610bff60008051602061265e8339815191528261185f565b60015461010090046001600160a01b031681565b600081565b60075481565b610bff60008051602061267e83398151915282610cce565b610bff60008051602061265e83398151915282610cce565b604080516001600160a01b039687166020820152808201959095526060850193909352908416608084015290921660a0808301919091528251808303909101815260c090910190915290565b6000610c2381836114bc565b60035481565b600154604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561160d57600080fd5b505afa158015611621573d6000803e3d6000fd5b505050506040513d602081101561163757600080fd5b5051905090565b6000818152602081905260408120610c2390611fb5565b600061165f610c84565b6116676115bd565b1161167457506000610c06565b6000611689611681610c84565b610ec26115bd565b600654909150156116d257600354156116be576003546116bb906116af906103e8611cf5565b610ebc836103e8611e25565b90505b60065481816116c957fe5b04915050610c06565b6000915050610c06565b600080600a84815481106116ec57fe5b60009182526020808320878452600b825260408085206001600160a01b03898116875290845281862060049586029093016003810154815484516370a0823160e01b81523098810198909852935191985093969395939492909116926370a08231926024808301939192829003018186803b15801561176a57600080fd5b505afa15801561177e573d6000803e3d6000fd5b505050506040513d602081101561179457600080fd5b50516002850154909150431180156117ab57508015155b1561180b5760006117c0856002015443611401565b905060006117e7600c54610ebc886001015461106960065487611e2590919063ffffffff16565b90506118066117ff84610ebc8464e8d4a51000611e25565b8590611cf5565b935050505b6118338360010154610ec264e8d4a51000610ebc868860000154611e2590919063ffffffff16565b979650505050505050565b6002546001600160a01b031681565b60008051602061267e83398151915281565b60008281526020819052604090206002015461187d90610cec611d4f565b610de15760405162461bcd60e51b815260040180806020018281038252603081526020018061260d6030913960400191505060405180910390fd5b6118c1336115ab565b6118fc5760405162461bcd60e51b81526004018080602001828103825260298152602001806125e46029913960400191505060405180910390fd5b801561190a5761190a611220565b6000600d54431161191d57600d5461191f565b435b600c5490915061192f9085611cf5565b600c55604080516080810182526001600160a01b03948516815260208101958652908101918252600060608201818152600a8054600181018255925291517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8600490920291820180546001600160a01b031916919096161790945593517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a9840155517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa8301555090517fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2ab90910155565b610bff60008261185f565b6000600a8381548110611a3957fe5b60009182526020808320868452600b82526040808520338652909252922060049091029091019150611a6a84610f78565b805415611ac3576000611a9f8260010154610ec264e8d4a51000610ebc87600301548760000154611e2590919063ffffffff16565b90508015611ac157600854611ab49082611ee5565b600855611ac13382611c2d565b505b8215611aef578154611ae0906001600160a01b0316333086611fc0565b8054611aec9084611cf5565b81555b60038201548154611b0a9164e8d4a5100091610ebc91611e25565b6001820155604080518481529051859133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a350505050565b60015460ff1615611b9a576040805162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5cd959606a1b604482015290519081900360640190fd5b6001600160a01b038116611be7576040805162461bcd60e51b815260206004820152600f60248201526e125b98dbdc9c9958dd081a5b9c1d5d608a1b604482015290519081900360640190fd5b611bf2600082610d2c565b506001805460ff191681179055565b60008051602061265e83398151915281565b6000610c2360008051602061265e833981519152836114bc565b600154604080516370a0823160e01b8152306004820152905160009261010090046001600160a01b0316916370a08231916024808301926020929190829003018186803b158015611c7d57600080fd5b505afa158015611c91573d6000803e3d6000fd5b505050506040513d6020811015611ca757600080fd5b5051905080821115611cd457600154611ccf9061010090046001600160a01b03168483612020565b611cf0565b600154611cf09061010090046001600160a01b03168484612020565b505050565b6000828201838110156114b5576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b6000828152602081905260409020611d6b9082612142565b15610d3657611d78611d4f565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081905260409020611dd49082612157565b15610d3657611de1611d4f565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600082611e3457506000610c23565b82820282848281611e4157fe5b04146114b55760405162461bcd60e51b815260040180806020018281038252602181526020018061263d6021913960400191505060405180910390fd5b6000808211611ed4576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611edd57fe5b049392505050565b600082821115611f3c576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611cf090849061216c565b60006114b5838361221d565b60006114b5836001600160a01b038416612281565b6000610c2382612299565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261201a90859061216c565b50505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b6020831061209d5780518252601f19909201916020918201910161207e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146120ff576040519150601f19603f3d011682016040523d82523d6000602084013e612104565b606091505b5091509150818015612132575080511580612132575080806020019051602081101561212f57600080fd5b50515b61213b57600080fd5b5050505050565b60006114b5836001600160a01b03841661229d565b60006114b5836001600160a01b0384166122e7565b60606121c1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166123ad9092919063ffffffff16565b805190915015611cf0578080602001905160208110156121e057600080fd5b5051611cf05760405162461bcd60e51b815260040180806020018281038252602a8152602001806126eb602a913960400191505060405180910390fd5b8154600090821061225f5760405162461bcd60e51b81526004018080602001828103825260228152602001806125736022913960400191505060405180910390fd5b82600001828154811061226e57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b60006122a98383612281565b6122df57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c23565b506000610c23565b600081815260018301602052604081205480156123a3578354600019808301919081019060009087908390811061231a57fe5b906000526020600020015490508087600001848154811061233757fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061236757fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610c23565b6000915050610c23565b60606114958484600085856123c1856124c8565b612412576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106124515780518252601f199092019160209182019101612432565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146124b3576040519150601f19603f3d011682016040523d82523d6000602084013e6124b8565b606091505b50915091506118338282866124ce565b3b151590565b606083156124dd5750816114b5565b8251156124ed5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561253757818101518382015260200161251f565b50505050905090810190601f1680156125645780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e749d49f397ae9ef1a834b569acb967799a367061e305932181a44f5773da873bfd4d6173746572436865662e616464546f6b656e3a2053656e646572206d7573742062652061646d696e416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7797667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a64d6173746572436865662e7365743a2053656e646572206d7573742062652061646d696e4d6173746572436865662e736574426f6e75733a2053656e646572206d7573742062652061646d696e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212200b445c5e65fa022e37000f5cebdc2330e63561a95de7d5b710ac82b6e44d97b364736f6c634300060c0033

Block Transaction 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

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