```\nif (protected && (\n    !context.closable.isZero() || // @audit even if closable is 0, position can still increase\n    context.latestPosition.local.maintained(\n        context.latestVersion,\n        context.riskParameter,\n        context.pendingCollateral.sub(collateral)\n    ) ||\n    collateral.lt(Fixed6Lib.from(-1, _liquidationFee(context, newOrder)))\n)) revert MarketInvalidProtectionError();\n\nif (\n    !(context.currentPosition.local.magnitude().isZero() && context.latestPosition.local.magnitude().isZero()) &&   // sender has no position\n    !(newOrder.isEmpty() && collateral.gte(Fixed6Lib.ZERO)) &&                                                      // sender is depositing zero or more into account, without position change\n    (context.currentTimestamp - context.latestVersion.timestamp >= context.riskParameter.staleAfter)                // price is not stale\n) revert MarketStalePriceError();\n\nif (context.marketParameter.closed && newOrder.increasesPosition())\n    revert MarketClosedError();\n\nif (context.currentPosition.global.maker.gt(context.riskParameter.makerLimit))\n    revert MarketMakerOverLimitError();\n\nif (!newOrder.singleSided(context.currentPosition.local) || !newOrder.singleSided(context.latestPosition.local))\n    revert MarketNotSingleSidedError();\n\nif (protected) return; // The following invariants do not apply to protected position updates (liquidations)\n```\n