contract CoreOperationState is
    Ownable,
    CoreState
{

    /* ============ Enum ============ */

    /**
     * Operational:
     * All Accounting and Issuance related functions are available for usage during this stage
     *
     * Shut Down:
     * Only functions which allow users to redeem and withdraw funds are allowed during this stage
     */
    enum OperationState {
        Operational,
        ShutDown,
        InvalidState
    }

    /* ============ Events ============ */

    event OperationStateChanged(
        uint8 _prevState,
        uint8 _newState
    );

    /* ============ Modifiers ============ */

    modifier whenOperational() {
        require(
            state.operationState == uint8(OperationState.Operational),
            "WhenOperational"
        );
        _;
    }

    /* ============ External Functions ============ */

    /**
     * Updates the operation state of the protocol.
     * Can only be called by owner of Core.
     *
     * @param  _operationState   Uint8 representing the current protocol operation state
     */
    function setOperationState(
        uint8 _operationState
    )
        external
        onlyOwner
    {
        require(
            _operationState < uint8(OperationState.InvalidState) &&
            _operationState != state.operationState,
            "InvalidOperationState"
        );

        emit OperationStateChanged(
            state.operationState,
            _operationState
        );

        state.operationState = _operationState;
    }
}
/**
 * @title CoreOperationState
 * @author Set Protocol
 *
 * The CoreOperationState contract contains methods to alter state of variables that track
 * Core dependency addresses.
 */
function setOperationState(
        uint8 _operationState
    )
        external
        onlyOwner
    {
        require(
            _operationState < uint8(OperationState.InvalidState) &&
            _operationState != state.operationState,
            "InvalidOperationState"
        );

        emit OperationStateChanged(
            state.operationState,
            _operationState
        );

        state.operationState = _operationState;
    }
/**
 * Updates the operation state of the protocol.
 * Can only be called by owner of Core.
 *
 * @param  _operationState   Uint8 representing the current protocol operation state
 */