Residual ETH will not be sent back to users during the minting of wfCash
Residual ETH will not be sent back to users, resulting in a loss of assets.\\nAt Line 67, residual ETH within the `depositUnderlyingToken` function will be sent as Native ETH back to the `msg.sender`, which is this wfCash Wrapper contract.\\n```\\nFile: wfCashLogic.sol\\n    function _mintInternal(\\n..SNIP..\\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..SNIP..\\n        // Residual tokens will be sent back to msg.sender, not the receiver. The msg.sender\\n        // was used to transfer tokens in and these are any residual tokens left that were not\\n        // lent out. Sending these tokens back to the receiver risks them getting locked on a\\n        // contract that does not have the capability to transfer them off\\n        _sendTokensToReceiver(token, msg.sender, isETH, balanceBefore);\\n```\\n\\nWithin the `depositUnderlyingToken` function Line 108 below, the `returnExcessWrapped` parameter is set to `false`, which means it will not wrap the residual ETH, and that Native ETH will be sent back to the caller (wrapper contract)\\n```\\nFile: AccountAction.sol\\n    function depositUnderlyingToken(\\n        address account,\\n        uint16 currencyId,\\n        uint256 amountExternalPrecision\\n    ) external payable nonReentrant returns (uint256) {\\n..SNIP..\\nFile: AccountAction.sol\\n        int256 primeCashReceived = balanceState.depositUnderlyingToken(\\n            msg.sender,\\n            SafeInt256.toInt(amountExternalPrecision),\\n            false // there should never be excess ETH here by definition\\n        );\\n```\\n\\nbalanceBefore = amount of WETH before the deposit, balanceAfter = amount of WETH after the deposit.\\nWhen the `_sendTokensToReceiver` is executed, these two values are going to be the same since it is Native ETH that is sent to the wrapper instead of WETH. As a result, the Native ETH that the wrapper received is not forwarded to the users.\\n```\\nFile: wfCashLogic.sol\\n    function _sendTokensToReceiver( \\n        IERC20 token,\\n        address receiver,\\n        bool isETH,\\n        uint256 balanceBefore\\n    ) private returns (uint256 tokensTransferred) {\\n        uint256 balanceAfter = isETH ? WETH.balanceOf(address(this)) : token.balanceOf(address(this)); \\n        tokensTransferred = balanceAfter - balanceBefore; \\n\\n        if (isETH) {\\n            // No need to use safeTransfer for WETH since it is known to be compatible\\n            IERC20(address(WETH)).transfer(receiver, tokensTransferred); \\n        } else if (tokensTransferred > 0) { \\n            token.safeTransfer(receiver, tokensTransferred); \\n        }\\n    }\\n```\\n
If the underlying is ETH, measure the Native ETH balance before and after the `depositUnderlyingToken` is executed. Forward any residual Native ETH to the users, if any.
Loss of assets as the residual ETH is not sent to the users.
```\\nFile: wfCashLogic.sol\\n    function _mintInternal(\\n..SNIP..\\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..SNIP..\\n        // Residual tokens will be sent back to msg.sender, not the receiver. The msg.sender\\n        // was used to transfer tokens in and these are any residual tokens left that were not\\n        // lent out. Sending these tokens back to the receiver risks them getting locked on a\\n        // contract that does not have the capability to transfer them off\\n        _sendTokensToReceiver(token, msg.sender, isETH, balanceBefore);\\n```\\n