Farseen0/scar-pairs huggingface dataset:
MEDIUM severity: Vulnerable function: ```\n(obtainedPremium, ) = dvp.premium(params.strike, params.notionalUp, params.. ```\n(obtainedPremium, ) = dvp.premium(params.strike, params.notionalUp, params.notionalDown);\n```\n

Vulnerable code:
```\n(obtainedPremium, ) = dvp.premium(params.strike, params.notionalUp, params.notionalDown);\n```\n
HIGH severity: Vulnerable function: ```\nif (name(stake.left\_) == key) {\n    current.right\_ = stake.right\_;\n   . ```\nif (name(stake.left\_) == key) {\n    current.right\_ = stake.right\_;\n    current.after\_ = stake.after\_;\n} else {\n    current.left\_ = stake.left\_;\n    current.before\_ = stake.before\_;\n}\n```\n

Vulnerable code:
```\nif (name(stake.left\_) == key) {\n    current.right\_ = stake.right\_;\n    current.after\_ = stake.after\_;\n} else {\n    current.left\_ = stake.left\_;\n    current.before\_ = stake.before\_;\n}\n```\n
HIGH severity: Vulnerable function: ```\nFile: SingleSidedLPVaultBase.sol\n    /// @notice Restores withdrawn tokens from emergencyExit . ```\nFile: SingleSidedLPVaultBase.sol\n    /// @notice Restores withdrawn tokens from emergencyExit back into the vault proportionally.\n    /// Unlocks the vault after restoration so that normal functionality is restored.\n    /// @param minPoolClaim slippage limit to prevent front running\n    fun

Vulnerable code:
```\nFile: SingleSidedLPVaultBase.sol\n    /// @notice Restores withdrawn tokens from emergencyExit back into the vault proportionally.\n    /// Unlocks the vault after restoration so that normal functionality is restored.\n    /// @param minPoolClaim slippage limit to prevent front running\n    function restoreVault(\n        uint256 minPoolClaim, bytes calldata /* data */\n    ) external override whenLocked onlyNotionalOwner {\n        StrategyVaultState memory state = VaultStorage.getStrategyVaultState();\n\n        (IERC20[] memory tokens, /* */) = TOKENS();\n        uint256[] memory amounts = new uint256[](tokens.length);\n\n        // All balances held by the vault are assumed to be used to re-enter\n        // the pool. Since the vault has been locked no other users should have\n        // been able to enter the pool.\n        for (uint256 i; i < tokens.length; i++) {\n            if (address(tokens[i]) == address(POOL_TOKEN())) continue;\n            amounts[i] = TokenUtils.tokenBalance(address(tokens[i]));\n        }\n\n        // No trades are specified so this joins proportionally using the\n        // amounts specified.\n        uint256 poolTokens = _joinPoolAndStake(amounts, minPoolClaim);\n..SNIP..\n```\n
MEDIUM severity: Vulnerable function: ```\n        if (uint256(expiry) < block.timestamp) revert Teller_OptionExpired(. ```\n        if (uint256(expiry) < block.timestamp) revert Teller_OptionExpired(expiry);\n```\n

Vulnerable code:
```\n        if (uint256(expiry) < block.timestamp) revert Teller_OptionExpired(expiry);\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: GMXVault.sol\n\n  function deposit(GMXTypes.DepositParams memory dp) external payable non. ```\nFile: GMXVault.sol\n\n  function deposit(GMXTypes.DepositParams memory dp) external payable nonReentrant {\n    GMXDeposit.deposit(_store, dp, false);\n  }\n```\n

Vulnerable code:
```\nFile: GMXVault.sol\n\n  function deposit(GMXTypes.DepositParams memory dp) external payable nonReentrant {\n    GMXDeposit.deposit(_store, dp, false);\n  }\n```\n
HIGH severity: Vulnerable function: ```\nif (vrfRequests[_requestId].fulfilled) revert InvalidVrfState();\n```\n. ```\nif (vrfRequests[_requestId].fulfilled) revert InvalidVrfState();\n```\n

Vulnerable code:
```\nif (vrfRequests[_requestId].fulfilled) revert InvalidVrfState();\n```\n
HIGH severity: Vulnerable function: ```\nfunction cancelAuction(uint96 lotId_) external override onlyInternal {\n    _revertIfLotConclud. ```\nfunction cancelAuction(uint96 lotId_) external override onlyInternal {\n    _revertIfLotConcluded(lotId_);\n}\n```\n

Vulnerable code:
```\nfunction cancelAuction(uint96 lotId_) external override onlyInternal {\n    _revertIfLotConcluded(lotId_);\n}\n```\n
HIGH severity: Vulnerable function: ```\nfor (uint256 i; i < numberOfRounds; ++i) {\n            uint256 roundId = _. ```\nfor (uint256 i; i < numberOfRounds; ++i) {\n            uint256 roundId = _unsafeAdd(startingRoundId, i);\n            Round storage round = rounds[roundId];\n            uint256 roundValuePerEntry = round.valuePerEntry;\n            if (roundValuePerEntry == 0) {\n                (, , roundVal

Vulnerable code:
```\nfor (uint256 i; i < numberOfRounds; ++i) {\n            uint256 roundId = _unsafeAdd(startingRoundId, i);\n            Round storage round = rounds[roundId];\n            uint256 roundValuePerEntry = round.valuePerEntry;\n            if (roundValuePerEntry == 0) {\n                (, , roundValuePerEntry) = _writeDataToRound({roundId: roundId, roundValue: 0});\n            }\n\n            _incrementUserDepositCount(roundId, round);\n\n            // @review depositAmount can be "0"\n            uint256 depositAmount = amounts[i];\n\n            // @review 0 % ANY_NUMBER = 0\n            if (depositAmount % roundValuePerEntry != 0) {\n                revert InvalidValue();\n            }\n            uint256 entriesCount = _depositETH(round, roundId, roundValuePerEntry, depositAmount);\n            expectedValue += depositAmount;\n\n            entriesCounts[i] = entriesCount;\n        }\n\n        // @review will not fail as long as user deposits normally to 1 round\n        // then he can deposit to any round with "0" amounts\n        if (expectedValue != msg.value) {\n            revert InvalidValue();\n        }\n```\n
MEDIUM severity: Vulnerable function: ```\n   bool cancelled = l.Auction.isCancelled(lastEpoch);\n        bool finaliz. ```\n   bool cancelled = l.Auction.isCancelled(lastEpoch);\n        bool finalized = l.Auction.isFinalized(lastEpoch);\n\n        require(\n            (!finalized && cancelled) || (finalized && !cancelled),\n            "auction is not finalized nor cancelled"\n        );\n```\n

Vulnerable code:
```\n   bool cancelled = l.Auction.isCancelled(lastEpoch);\n        bool finalized = l.Auction.isFinalized(lastEpoch);\n\n        require(\n            (!finalized && cancelled) || (finalized && !cancelled),\n            "auction is not finalized nor cancelled"\n        );\n```\n
MEDIUM severity: Vulnerable function: ```\n    while (i < withdrawals.length && (i - start) < maxWithdrawalProcesses) . ```\n    while (i < withdrawals.length && (i - start) < maxWithdrawalProcesses) {\n        Withdrawal memory withdrawal = withdrawals[i];\n        if (reserve < withdrawal.amount) {\n            break;\n        }\n\n        (bool success, bytes memory data) = withdrawal.usr.call{value: withdrawal.am

Vulnerable code:
```\n    while (i < withdrawals.length && (i - start) < maxWithdrawalProcesses) {\n        Withdrawal memory withdrawal = withdrawals[i];\n        if (reserve < withdrawal.amount) {\n            break;\n        }\n\n        (bool success, bytes memory data) = withdrawal.usr.call{value: withdrawal.amount}("");\n        if (success) {\n            reserve -= withdrawal.amount;\n```\n
MEDIUM severity: Vulnerable function: ```\nFile: TokenUtils.sol\n    function checkApprove(IERC20 token, address spender, uint256 amount) . ```\nFile: TokenUtils.sol\n    function checkApprove(IERC20 token, address spender, uint256 amount) internal {\n        if (address(token) == address(0)) return;\n\n        IEIP20NonStandard(address(token)).approve(spender, amount);\n        _checkReturnCode();\n    }\n```\n

Vulnerable code:
```\nFile: TokenUtils.sol\n    function checkApprove(IERC20 token, address spender, uint256 amount) internal {\n        if (address(token) == address(0)) return;\n\n        IEIP20NonStandard(address(token)).approve(spender, amount);\n        _checkReturnCode();\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nunchecked {\n    for (uint256 i = 0; i < claimCount; ++i) {\n        // Loa. ```\nunchecked {\n    for (uint256 i = 0; i < claimCount; ++i) {\n        // Load claim in memory\n        MerkleClaim memory claim = claims[I];\n\n        // Requires one proof per tokenId to handle cases where users want to partially claim\n        if (!MerkleProof.verify(claim.merkleProof, settin

Vulnerable code:
```\nunchecked {\n    for (uint256 i = 0; i < claimCount; ++i) {\n        // Load claim in memory\n        MerkleClaim memory claim = claims[I];\n\n        // Requires one proof per tokenId to handle cases where users want to partially claim\n        if (!MerkleProof.verify(claim.merkleProof, settings.merkleRoot, keccak256(abi.encode(claim.mintTo, claim.tokenId)))) {\n            revert INVALID_MERKLE_PROOF(claim.mintTo, claim.merkleProof, settings.merkleRoot);\n        }\n\n        // Only allowing reserved tokens to be minted for this strategy\n        IToken(tokenContract).mintFromReserveTo(claim.mintTo, claim.tokenId);\n    }\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction registerAddress(bytes32 \_contractName, address \_contractAddress)\n    public\n    ow. ```\nfunction registerAddress(bytes32 \_contractName, address \_contractAddress)\n    public\n    ownerOnly\n    validAddress(\_contractAddress)\n{\n```\n

Vulnerable code:
```\nfunction registerAddress(bytes32 \_contractName, address \_contractAddress)\n    public\n    ownerOnly\n    validAddress(\_contractAddress)\n{\n```\n
HIGH severity: Vulnerable function: ```\n    for (uint32 index = 0; index < params.length; index++) {\n        OpenT. ```\n    for (uint32 index = 0; index < params.length; index++) {\n        OpenTradeParams memory currentParams = params[index];\n        QueuedTrade memory queuedTrade = queuedTrades[\n            currentParams.queueId\n        ];\n        bool isSignerVerifed = _validateSigner(\n            curren

Vulnerable code:
```\n    for (uint32 index = 0; index < params.length; index++) {\n        OpenTradeParams memory currentParams = params[index];\n        QueuedTrade memory queuedTrade = queuedTrades[\n            currentParams.queueId\n        ];\n        bool isSignerVerifed = _validateSigner(\n            currentParams.timestamp,\n            currentParams.asset,\n            currentParams.price,\n            currentParams.signature\n        );\n        // Silently fail if the signature doesn't match\n        if (!isSignerVerifed) {\n            emit FailResolve(\n                currentParams.queueId,\n                "Router: Signature didn't match"\n            );\n            continue;\n        }\n        if (\n            !queuedTrade.isQueued ||\n            currentParams.timestamp != queuedTrade.queuedTime\n        ) {\n            // Trade has already been opened or cancelled or the timestamp is wrong.\n            // So ignore this trade.\n            continue;\n        }\n\n        // If the opening time is much greater than the queue time then cancel the trad\n        if (block.timestamp - queuedTrade.queuedTime <= MAX_WAIT_TIME) {\n            _openQueuedTrade(currentParams.queueId, currentParams.price);\n        } else {\n            _cancelQueuedTrade(currentParams.queueId);\n            emit CancelTrade(\n                queuedTrade.user,\n                currentParams.queueId,\n                "Wait time too high"\n            );\n        }\n\n        // Track the next queueIndex to be processed for user\n        userNextQueueIndexToProcess[queuedTrade.user] =\n            queuedTrade.userQueueIndex +\n            1;\n    }\n```\n
HIGH severity: Vulnerable function: ```\n function claim() external {\n        checkingEpoch();\n        require(\n            uint8(epo. ```\n function claim() external {\n        checkingEpoch();\n        require(\n            uint8(epoch) > 1 && !admin.blockClaim(address(this)),\n            "TokenSale: Not time or not allowed"\n        );\n\n        Staked storage s = stakes[msg.sender];\n        require(s.amount != 0, "TokenSale:

Vulnerable code:
```\n function claim() external {\n        checkingEpoch();\n        require(\n            uint8(epoch) > 1 && !admin.blockClaim(address(this)),\n            "TokenSale: Not time or not allowed"\n        );\n\n        Staked storage s = stakes[msg.sender];\n        require(s.amount != 0, "TokenSale: No Deposit"); \n        require(!s.claimed, "TokenSale: Already Claimed");\n\n        uint256 left;\n        (s.share, left) = _claim(s);\n        require(left > 0, "TokenSale: Nothing to claim");  // @audit - problematic line \n        uint256 refundTaxAmount;\n        if (s.taxAmount > 0) {\n            uint256 tax = userTaxRate(s.amount, msg.sender);\n            uint256 taxFreeAllc = _maxTaxfreeAllocation(msg.sender) * PCT_BASE;\n            if (taxFreeAllc >= s.share) {\n                refundTaxAmount = s.taxAmount;\n            } else {\n                refundTaxAmount = (left * tax) / POINT_BASE; // tax refund is on the wrong amount \n            }\n            usdc.safeTransferFrom(marketingWallet, msg.sender, refundTaxAmount);\n        }\n        s.claimed = true;\n        usdc.safeTransfer(msg.sender, left);\n        emit Claim(msg.sender, left);\n    }\n```\n
HIGH severity: Vulnerable function: ```\n    if(outstandingisoUSD >= TENTH_OF_CENT){ //ignore leftover debts less th. ```\n    if(outstandingisoUSD >= TENTH_OF_CENT){ //ignore leftover debts less than $0.001\n        uint256 collateralLeft = collateralPosted[_collateralAddress][msg.sender] - _collateralToUser;\n        uint256 colInUSD = priceCollateralToUSD(currencyKey, collateralLeft); \n        uint256 borrowMar

Vulnerable code:
```\n    if(outstandingisoUSD >= TENTH_OF_CENT){ //ignore leftover debts less than $0.001\n        uint256 collateralLeft = collateralPosted[_collateralAddress][msg.sender] - _collateralToUser;\n        uint256 colInUSD = priceCollateralToUSD(currencyKey, collateralLeft); \n        uint256 borrowMargin = (outstandingisoUSD * minOpeningMargin) / LOAN_SCALE;\n        require(colInUSD > borrowMargin , "Remaining debt fails to meet minimum margin!");\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\nfor (uint i = 0; i < \_blockheaders.length; i++) {\n    (calcParent, calcBl. ```\nfor (uint i = 0; i < \_blockheaders.length; i++) {\n    (calcParent, calcBlockhash) = getParentAndBlockhash(\_blockheaders[i]);\n    if (calcBlockhash != currentBlockhash) {\n        return 0x0;\n    }\n    currentBlockhash = calcParent;\n}\n```\n

Vulnerable code:
```\nfor (uint i = 0; i < \_blockheaders.length; i++) {\n    (calcParent, calcBlockhash) = getParentAndBlockhash(\_blockheaders[i]);\n    if (calcBlockhash != currentBlockhash) {\n        return 0x0;\n    }\n    currentBlockhash = calcParent;\n}\n```\n
MEDIUM severity: Vulnerable function: ```\nbptClaim = (strategyTokenAmount * context.totalBPTHeld) / context.vaultStat. ```\nbptClaim = (strategyTokenAmount * context.totalBPTHeld) / context.vaultState.totalStrategyTokenGlobal;\n1,000,999 = (1000000 * 1002000) / 1001000\n```\n

Vulnerable code:
```\nbptClaim = (strategyTokenAmount * context.totalBPTHeld) / context.vaultState.totalStrategyTokenGlobal;\n1,000,999 = (1000000 * 1002000) / 1001000\n```\n
HIGH severity: Vulnerable function: ```\nfunction approveBorrow(address spender, uint256 amount) external returns (bool) {\n        _app. ```\nfunction approveBorrow(address spender, uint256 amount) external returns (bool) {\n        _approveBorrow(msg.sender, spender, amount);\n        return true;\n    }\n```\n

Vulnerable code:
```\nfunction approveBorrow(address spender, uint256 amount) external returns (bool) {\n        _approveBorrow(msg.sender, spender, amount);\n        return true;\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\n        (uint256 unitFee, , ) = _fees(10**decimals(), settlementFeePercenta. ```\n        (uint256 unitFee, , ) = _fees(10**decimals(), settlementFeePercentage);\n        amount = (newFee * 10**decimals()) / unitFee;\n```\n

Vulnerable code:
```\n        (uint256 unitFee, , ) = _fees(10**decimals(), settlementFeePercentage);\n        amount = (newFee * 10**decimals()) / unitFee;\n```\n
MEDIUM severity: Vulnerable function: ```\n    function buyCollateral(address from, uint256 borrowAmount, uint256 supplyAmount, bytes call. ```\n    function buyCollateral(address from, uint256 borrowAmount, uint256 supplyAmount, bytes calldata data)\n        external\n        optionNotPaused(PauseType.LeverageBuy)\n        solvent(from, false)\n        notSelf(from)\n        returns (uint256 amountOut)\n    {\n        if (address(lever

Vulnerable code:
```\n    function buyCollateral(address from, uint256 borrowAmount, uint256 supplyAmount, bytes calldata data)\n        external\n        optionNotPaused(PauseType.LeverageBuy)\n        solvent(from, false)\n        notSelf(from)\n        returns (uint256 amountOut)\n    {\n        if (address(leverageExecutor) == address(0)) {\n            revert LeverageExecutorNotValid();\n        }\n\n        // Stack too deep fix\n        _BuyCollateralCalldata memory calldata_;\n        _BuyCollateralMemoryData memory memoryData;\n        {\n            calldata_.from = from;\n            calldata_.borrowAmount = borrowAmount;\n            calldata_.supplyAmount = supplyAmount;\n            calldata_.data = data;\n        }\n\n        {\n            uint256 supplyShare = yieldBox.toShare(assetId, calldata_.supplyAmount, true);\n            if (supplyShare > 0) {\n                (memoryData.supplyShareToAmount,) =\n                    yieldBox.withdraw(assetId, calldata_.from, address(leverageExecutor), 0, supplyShare);\n            }\n        }\n\n        {\n            (, uint256 borrowShare) = _borrow(\n                calldata_.from,\n                address(this),\n                calldata_.borrowAmount,\n                _computeVariableOpeningFee(calldata_.borrowAmount)\n            );\n            (memoryData.borrowShareToAmount,) =\n                yieldBox.withdraw(assetId, address(this), address(leverageExecutor), 0, borrowShare);\n        }\n        {\n            amountOut = leverageExecutor.getCollateral(\n                collateralId,\n                address(asset),\n                address(collateral),\n                memoryData.supplyShareToAmount + memoryData.borrowShareToAmount,\n              calldata_.from,\n                calldata_.data\n            );\n        }\n        uint256 collateralShare = yieldBox.toShare(collateralId, amountOut, false);\n      address(asset).safeApprove(address(yieldBox), type(uint256).max);\n      yieldBox.depositAsset(collateralId, address(this), address(this), 0, collateralShare); // TODO Check for rounding attack?\n      address(asset).safeApprove(address(yieldBox), 0);\n\n        if (collateralShare == 0) revert CollateralShareNotValid();\n        _allowedBorrow(calldata_.from, collateralShare);\n        _addCollateral(calldata_.from, calldata_.from, false, 0, collateralShare);\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\n        return (uint32(block.timestamp) -\n            _liquidationDelay -\. ```\n        return (uint32(block.timestamp) -\n            _liquidationDelay -\n            lastRepaidTimestamp(_bidId) >\n            bidDefaultDuration[_bidId]);\n```\n

Vulnerable code:
```\n        return (uint32(block.timestamp) -\n            _liquidationDelay -\n            lastRepaidTimestamp(_bidId) >\n            bidDefaultDuration[_bidId]);\n```\n
MEDIUM severity: Vulnerable function: ```\nMUST return the maximum amount of shares that could be transferred from `ow. ```\nMUST return the maximum amount of shares that could be transferred from `owner` through `redeem` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).\n\nMUST factor in both global and user-specific limits, like i

Vulnerable code:
```\nMUST return the maximum amount of shares that could be transferred from `owner` through `redeem` and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted (it should underestimate if necessary).\n\nMUST factor in both global and user-specific limits, like if redemption is entirely disabled (even temporarily) it MUST return 0.\n```\n
HIGH severity: Vulnerable function: ```\n    function getSellRate(address \_srcAddr, address \_destAddr, uint \_srcAmount, bytes memory). ```\n    function getSellRate(address \_srcAddr, address \_destAddr, uint \_srcAmount, bytes memory) public override view returns (uint rate) {\n        (rate, ) = KyberNetworkProxyInterface(KYBER\_INTERFACE)\n            .getExpectedRate(IERC20(\_srcAddr), IERC20(\_destAddr), \_srcAmount);\n\n     

Vulnerable code:
```\n    function getSellRate(address \_srcAddr, address \_destAddr, uint \_srcAmount, bytes memory) public override view returns (uint rate) {\n        (rate, ) = KyberNetworkProxyInterface(KYBER\_INTERFACE)\n            .getExpectedRate(IERC20(\_srcAddr), IERC20(\_destAddr), \_srcAmount);\n\n        // multiply with decimal difference in src token\n        rate = rate \* (10\*\*(18 - getDecimals(\_srcAddr)));\n        // divide with decimal difference in dest token\n        rate = rate / (10\*\*(18 - getDecimals(\_destAddr)));\n    }\n```\n
MEDIUM severity: Vulnerable function: ```\n        uint256 latestTimestamp = global.latest == 0 ? 0 : oracles[global.l. ```\n        uint256 latestTimestamp = global.latest == 0 ? 0 : oracles[global.latest].provider.latest().timestamp;\n        if (uint256(oracles[global.latest].timestamp) > latestTimestamp) return false;\n```\n

Vulnerable code:
```\n        uint256 latestTimestamp = global.latest == 0 ? 0 : oracles[global.latest].provider.latest().timestamp;\n        if (uint256(oracles[global.latest].timestamp) > latestTimestamp) return false;\n```\n
MEDIUM severity: Vulnerable function: ```\nsharesOwed = convertToSharesFromRestakingTokens(asset, amountIn);\n```\n. ```\nsharesOwed = convertToSharesFromRestakingTokens(asset, amountIn);\n```\n

Vulnerable code:
```\nsharesOwed = convertToSharesFromRestakingTokens(asset, amountIn);\n```\n
MEDIUM severity: Vulnerable function: ```\nfunction setMaxSupplies(uint256[] calldata \_ids, uint256[] calldata \_newMaxSupplies) external. ```\nfunction setMaxSupplies(uint256[] calldata \_ids, uint256[] calldata \_newMaxSupplies) external onlyOwner() {\n  require(\_ids.length == \_newMaxSupplies.length, "SWSupplyManager#setMaxSupply: INVALID\_ARRAYS\_LENGTH");\n\n  // Can only \*decrease\* a max supply\n  // Can't set max supply back 

Vulnerable code:
```\nfunction setMaxSupplies(uint256[] calldata \_ids, uint256[] calldata \_newMaxSupplies) external onlyOwner() {\n  require(\_ids.length == \_newMaxSupplies.length, "SWSupplyManager#setMaxSupply: INVALID\_ARRAYS\_LENGTH");\n\n  // Can only \*decrease\* a max supply\n  // Can't set max supply back to 0\n  for (uint256 i = 0; i < \_ids.length; i++ ) {\n    if (maxSupply[\_ids[i]] > 0) {\n      require(\n        0 < \_newMaxSupplies[i] && \_newMaxSupplies[i] < maxSupply[\_ids[i]],\n        "SWSupplyManager#setMaxSupply: INVALID\_NEW\_MAX\_SUPPLY"\n      );\n    }\n    maxSupply[\_ids[i]] = \_newMaxSupplies[i];\n  }\n\n  emit MaxSuppliesChanged(\_ids, \_newMaxSupplies);\n}\n```\n
MEDIUM severity: Vulnerable function: ```\n    if (maxFCash < fCashAmount) {\n        // NOTE: lending at zero\n      . ```\n    if (maxFCash < fCashAmount) {\n        // NOTE: lending at zero\n        uint256 fCashAmountExternal = fCashAmount * precision / uint256(Constants.INTERNAL_TOKEN_PRECISION);\n        require(fCashAmountExternal <= depositAmountExternal);\n\n        // NOTE: Residual (depositAmountExternal -

Vulnerable code:
```\n    if (maxFCash < fCashAmount) {\n        // NOTE: lending at zero\n        uint256 fCashAmountExternal = fCashAmount * precision / uint256(Constants.INTERNAL_TOKEN_PRECISION);\n        require(fCashAmountExternal <= depositAmountExternal);\n\n        // NOTE: Residual (depositAmountExternal - fCashAmountExternal) will be transferred\n        // back to the account\n        NotionalV2.depositUnderlyingToken{value: msgValue}(address(this), currencyId, fCashAmountExternal);\n    } else if (isETH || hasTransferFee || getCashBalance() > 0) {\n```\n