contract EmergencyProtectedMode is Owned {
  event EmergencyProtectedModeActivated();
  event EmergencyProtectedModeDeactivated();

  bool public emergencyProtectedMode = false;

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

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

  /**
   * @dev called by the owner to activate emergency protected mode, triggers stopped state, to use in case of last resort, and stop even last case operations (in case of a security compromise)
   */
  function activateEmergencyProtectedMode() onlyOwner whenNotInEmergencyProtectedMode public {
    emergencyProtectedMode = true;
    emit EmergencyProtectedModeActivated();
  }

  /**
   * @dev called by the owner to deactivate emergency protected mode, returns to normal state
   */
  function deactivateEmergencyProtectedMode() onlyOwner whenInEmergencyProtectedMode public {
    emergencyProtectedMode = false;
    emit EmergencyProtectedModeDeactivated();
  }
}
/**
 * @title EmergencyProtectedMode
 * @dev Base contract which allows children to implement an emergency stop mechanism different than pausable. Useful for when we want to 
 * stop the normal business of the contract (using the Pausable contract), but still allow some operations like withdrawls for users.
 */
function deactivateEmergencyProtectedMode() onlyOwner whenInEmergencyProtectedMode public {
    emergencyProtectedMode = false;
    emit EmergencyProtectedModeDeactivated();
  }
/**
 * @dev called by the owner to deactivate emergency protected mode, returns to normal state
 */