MEDIUM severity: The vulnerability arises in the `VaultAccount.repayAccountPrimeDebtAtSettlement()` function, where e. The vulnerability arises in the `VaultAccount.repayAccountPrimeDebtAtSettlement()` function, where excess cash received from interest accrual is not properly handled. Specifically, when the primary or secondary borrow currency is `ETH`, the excess cash is transferred natively to the vault account wi...

Vulnerable code:
```\nFile: VaultAccount.sol\n\nfunction repayAccountPrimeDebtAtSettlement(\n    PrimeRate memory pr,\n    VaultStateStorage storage primeVaultState,\n    uint16 currencyId,\n    address vault,\n    address account,\n    int256 accountPrimeCash,\n    int256 accountPrimeStorageValue\n) internal returns (int256 finalPrimeDebtStorageValue, bool didTransfer) {\n    didTransfer = false;\n    finalPrimeDebtStorageValue = accountPrimeStorageValue;\n\n    if (accountPrimeCash > 0) {\n        int256 netPrimeDebtRepaid = pr.convertUnderlyingToDebtStorage(\n            pr.convertToUnderlying(accountPrimeCash).neg()\n        );\n\n        int256 netPrimeDebtChange;\n        if (netPrimeDebtRepaid < accountPrimeStorageValue) {\n            netPrimeDebtChange = accountPrimeStorageValue;\n            finalPrimeDebtStorageValue = 0;\n\n            int256 primeCashRefund = pr.convertFromUnderlying(\n                pr.convertDebtStorageToUnderlying(netPrimeDebtChange.sub(accountPrimeStorageValue))\n            );\n            TokenHandler.withdrawPrimeCash(\n                account, currencyId, primeCashRefund, pr, false\n            );\n            didTransfer = true;\n        } else {\n            netPrimeDebtChange = netPrimeDebtRepaid;\n            finalPrimeDebtStorageValue = accountPrimeStorageValue.sub(netPrimeDebtRepaid);\n        }\n\n        pr.updateTotalPrimeDebt(vault, currencyId, netPrimeDebtChange);\n\n        int256 totalPrimeDebt = int256(uint256(primeVaultState.totalDebt));\n        int256 newTotalDebt = totalPrimeDebt.add(netPrimeDebtChange);\n        primeVaultState.totalDebt = newTotalDebt.toUint().toUint80();\n    }\n}\n```\n```\nFile: TokenHandler.sol\n\nfunction withdrawPrimeCash(\n    address account,\n    uint16 currencyId,\n    int256 primeCashToWithdraw,\n    PrimeRate memory primeRate,\n    bool withdrawWrappedNativeToken\n) internal returns (int256 netTransferExternal) {\n    if (primeCashToWithdraw == 0) {\n        return 0;\n    }\n    require(primeCashToWithdraw < 0);\n\n    Token memory underlying = getUnderlyingToken(currencyId);\n    netTransferExternal = convertToExternal(\n        underlying,\n        primeRate.convertToUnderlying(primeCashToWithdraw)\n    );\n\n    // Overflow not possible due to int256\n    uint256 withdrawAmount = uint256(netTransferExternal).neg();\n\n    _redeemMoneyMarketIfRequired(currencyId, underlying, withdrawAmount);\n\n    if (underlying.tokenType == TokenType.Ether) {\n        GenericToken.transferNativeTokenOut(account, withdrawAmount, withdrawWrappedNativeToken);\n    } else {\n        GenericToken.safeTransferOut(underlying.tokenAddress, account, withdrawAmount);\n    }\n\n    _postTransferPrimeCashUpdate(account, currencyId, netTransferExternal, underlying, primeRate);\n}\n```