contract Spider is PausableToken{
    string public name;                   //fancy name: eg Simon Bucks
    uint8 public decimals;                //How many decimals to show.
    string public symbol;                 //An identifier: eg SBX
    uint256 public exchangeRate;         //0.1 eth 
    bool public sellPaused = false;

    constructor(
        uint256 _initialAmount
    ) public {
        balances[msg.sender] = _initialAmount;               // Give the creator all initial tokens
        totalSupply_ = _initialAmount;                        // Update total supply
        name = "Spider";                                   // Set the name for display purposes
        decimals = 18;                            // Amount of decimals for display purposes
        symbol = "SPB";                               // Set the symbol for display purposes
        exchangeRate = 1000;
    }
    
    function setExchangeRate(uint256 x) public onlyOwner {
        exchangeRate = x;
    }
    
    modifier whenSellNotPaused() {
        require(!sellPaused);
    _;
  }

  /**
   * @dev Modifier to make a function callable only when the contract is paused.
   */
  modifier whenSellPaused() {
    require(sellPaused);
    _;
  }

  /**
   * @dev called by the owner to pause, triggers stopped state
   */
  function sellpause() onlyOwner whenSellNotPaused public {
    sellPaused = true;
  }

  /**
   * @dev called by the owner to unpause, returns to normal state
   */
  function unsellpause() onlyOwner whenSellPaused public {
    sellPaused = false;
  }
  function () payable whenSellNotPaused whenNotPaused public {
      require(msg.value >= 0.1 ether);
      uint256 count = msg.value.div(0.1 ether).mul(exchangeRate);
      balances[msg.sender] = balances[msg.sender].add(count);
      balances[owner] = balances[owner].sub(count);

  }
  function withdrawAll () onlyOwner() public {
    msg.sender.transfer(this.balance);
  }

  function withdrawAmount (uint256 _amount) onlyOwner() public {
    msg.sender.transfer(_amount);
  }
  
    
    
}
function sellpause() onlyOwner whenSellNotPaused public {
  sellPaused = true;
}

/**
 * @dev called by the owner to pause, triggers stopped state
 */