diff --git a/v4/feature/workers/src/main/java/exchange/dydx/trading/feature/workers/globalworkers/DydxTransferSubaccountWorker.kt b/v4/feature/workers/src/main/java/exchange/dydx/trading/feature/workers/globalworkers/DydxTransferSubaccountWorker.kt index c1e103b1..4509e0d2 100644 --- a/v4/feature/workers/src/main/java/exchange/dydx/trading/feature/workers/globalworkers/DydxTransferSubaccountWorker.kt +++ b/v4/feature/workers/src/main/java/exchange/dydx/trading/feature/workers/globalworkers/DydxTransferSubaccountWorker.kt @@ -47,10 +47,10 @@ class DydxTransferSubaccountWorker @Inject constructor( combine( timerFlow(20.seconds), - abacusStateManager.state.accountBalance(abacusStateManager.usdcTokenDenom) - .filterNotNull(), + abacusStateManager.state.accountBalance(abacusStateManager.usdcTokenDenom), abacusStateManager.state.currentWallet.mapNotNull { it }, ) { _, balance, wallet -> + val balance = balance ?: 0.0 if (balance > balanceRetainAmount) { val depositAmount = balance.minus(balanceRetainAmount) if (depositAmount <= 0) return@combine