```\n  function lockCapital(address _lendingPoolAddress)\n    external\n    payable\n    override\n    onlyDefaultStateManager\n    whenNotPaused\n    returns (uint256 _lockedAmount, uint256 _snapshotId)\n  {\n// rest of code.\n    uint256 _length = activeProtectionIndexes.length();\n    for (uint256 i; i < _length; ) {\n// rest of code\n      uint256 _remainingPrincipal = poolInfo\n        .referenceLendingPools\n        .calculateRemainingPrincipal(            //<----------- calculate Remaining Principal\n          _lendingPoolAddress,\n          protectionInfo.buyer,\n          protectionInfo.purchaseParams.nftLpTokenId\n        );\n```\n