```\nFile: InvariantChecks.sol\n    /// @dev Returns the difference between actual total collateral balance in the vault vs tracked collateral\n    ///      Tracked collateral should be updated when depositing to stable LP (stableCollateralTotal) or\n    ///      opening leveraged positions (marginDepositedTotal).\n    /// TODO: Account for margin of error due to rounding.\n    function _getCollateralNet(IFlatcoinVault vault) private view returns (uint256 netCollateral) {\n        uint256 collateralBalance = vault.collateral().balanceOf(address(vault));\n        uint256 trackedCollateral = vault.stableCollateralTotal() + vault.getGlobalPositions().marginDepositedTotal;\n\n        if (collateralBalance < trackedCollateral) revert FlatcoinErrors.InvariantViolation("collateralNet");\n\n        return collateralBalance - trackedCollateral;\n    }\n```\n