Vulnerability: `TOFTMarketReceiverModule::marketBorrowReceiver` flow is broken
Severity: medium

Description:
The `TOFTMarketReceiverModule::marketBorrowReceiver` flow is broken and will revert when the Magnetar contract tries to transfer the ERC1155 tokens to the Market contract.\\n`TOFTMarketReceiverModule::marketBorrowReceiver` flow is broken.\\nLet's examine it more closely:\\nAfter checking the whitelisting status for the `marketHelper`, `magnetar` and the `market` contracts an approval is made to the Magnetar contract.\\n`MagnetarCollateralModule::depositAddCollateralAndBorrowFromMarket` get called with the passed parameters.\\nIf the `data.deposit` is true, the Magnetar contract will call `_extractTokens` with the following params: `from = msg_.user`, `token = collateralAddress` and `amount = msg_.collateralAmount`.\\n```\\n    function _extractTokens(address _from, address _token, uint256 _amount) internal returns (uint256) {\\n        uint256 balanceBefore = IERC20(_token).balanceOf(address(this));\\n        // IERC20(_token).safeTransferFrom(_from, address(this), _amount);\\n        pearlmit.transferFromERC20(_from, address(this), address(_token), _amount);\\n        uint256 balanceAfter = IERC20(_token).balanceOf(address(this));\\n        if (balanceAfter <= balanceBefore) revert Magnetar_ExtractTokenFail();\\n        return balanceAfter - balanceBefore;\\n    }\\n```\\n\\nThe collateral gets transferred into the Magnetar contract in case the `msg._user` has given sufficient allowance to the Magnetar contract through the Pearlmit contract.\\nAfter this `_setApprovalForYieldBox(data.market, yieldBox_);` is called that sets the allowance of the Magnetar contract to the Market contract.\\nThen `addCollateral` is called on the Market contract. I've inlined the internal function to make it easier to follow:\\n```\\n    function _addCollateral(address from, address to, bool skim, uint256 amount, uint256 share) internal {\\n        if (share == 0) {\\n            share = yieldBox.toShare(collateralId, amount, false);\\n        }\\n        uint256 oldTotalCollateralShare = totalCollateralShare;\\n        userCollateralShare[to] += share;\\n        totalCollateralShare = oldTotalCollateralShare + share;\\n\\n        // yieldBox.transfer(from, address(this), _assetId, share);\\n        bool isErr = pearlmit.transferFromERC1155(from, address(this), address(yieldBox), collateralId, share);\\n        if (isErr) {\\n            revert TransferFailed();\\n        }\\n    }\\n```\\n\\nAfter the `userCollateralShare` mapping is updated `pearlmit.transferFromERC1155(from, address(this), address(yieldBox), collateralId, share);` gets called.\\nThis is critical as now the Magnetar is supposed to transfer the ERC1155 tokens(Yieldbox) to the Market contract.\\nIn order to do this the Magnetar contract should have given the allowance to the Market contract through the Pearlmit contract.\\nThis is not the case, the Magnetar has only executed `_setApprovalForYieldBox(data.market, yieldBox_);`, nothing else.\\nIt will revert inside the Pearlmit contract `transferFromERC1155` function when the allowance is being checked.\\nOther occurrences\\n`TOFT::mintLendXChainSGLXChainLockAndParticipateReceiver` has a similar issue as:\\nExtract the bbCollateral from the user, sets approval for the BigBang contract through YieldBox.\\nBut then inside the `BBCollateral::addCollateral` the `_addTokens` again expects an allowance through the Pearlmit contract.\\n`TOFT::lockAndParticipateReceiver` calls the `Magnetar:lockAndParticipate` where:\\n```\\n## MagnetarMintCommonModule.sol\\n\\nfunction _lockOnTOB(\\n        IOptionsLockData memory lockData,\\n        IYieldBox yieldBox_,\\n        uint256 fraction,\\n        bool participate,\\n        address user,\\n        address singularityAddress\\n    ) internal returns (uint256 tOLPTokenId) {\\n    // rest of code.\\n        _setApprovalForYieldBox(lockData.target, yieldBox_);\\n        tOLPTokenId = ITapiocaOptionLiquidityProvision(lockData.target).lock(\\n             participate ? address(this) : user, singularityAddress, lockData.lockDuration, lockData.amount\\n        );\\n}\\n\\n## TapiocaOptionLiquidityProvision.sol\\n\\nfunction lock(address _to, IERC20 _singularity, uint128 _lockDuration, uint128 _ybShares)\\n    external\\n    nonReentrant\\n    returns (uint256 tokenId)\\n{\\n    // Transfer the Singularity position to this contract\\n    // yieldBox.transfer(msg.sender, address(this), sglAssetID, _ybShares);\\n    {\\n        bool isErr =\\n            pearlmit.transferFromERC1155(msg.sender, address(this), address(yieldBox), sglAssetID, _ybShares);\\n        if (isErr) {\\n            revert TransferFailed();\\n        }\\n    }\\n```\\n\\nThe same issue where approval through the Pearlmit contract is expected.

Impact:
The `TOFTMarketReceiverModule::marketBorrowReceiver` flow is broken and will revert when the Magnetar contract tries to transfer the ERC1155 tokens to the Market contract. There are also other instances of similar issues.

Recommended mitigation:
Review all the allowance mechanisms and ensure that they are correct.