```\n    marketCollateral = marketContext.margin\n        .add(collateral.sub(totalMargin).mul(marketContext.registration.weight));\n\n    UFixed6 marketAssets = assets\n        .mul(marketContext.registration.weight)\n        .min(marketCollateral.mul(LEVERAGE_BUFFER));\n```\n