From f4209f3c593569ffc67d17b1d1df07d1b60686f2 Mon Sep 17 00:00:00 2001 From: Tyler Date: Wed, 25 Sep 2024 18:36:05 -0400 Subject: [PATCH 1/2] valid --- build.gradle.kts | 2 +- .../functional/vault/VaultDepositWithdrawForm.kt | 10 +++------- v4_abacus.podspec | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 727667bc6..9daaadd97 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ allprojects { } group = "exchange.dydx.abacus" -version = "1.11.21" +version = "1.11.22" repositories { google() diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt index c4bcdb407..95eff34b3 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt @@ -232,14 +232,10 @@ object VaultDepositWithdrawFormValidator { } val withdrawnAmountIncludingSlippage = slippageResponse?.expectedAmount - val postOpVaultBalance = if (vaultAccount?.balanceUsdc != null) { - when (formData.action) { - VaultFormAction.DEPOSIT -> vaultAccount.balanceUsdc + amount - VaultFormAction.WITHDRAW -> vaultAccount.balanceUsdc - amount + val postOpVaultBalance = when (formData.action) { + VaultFormAction.DEPOSIT -> (vaultAccount?.balanceUsdc ?: 0.0) + amount + VaultFormAction.WITHDRAW -> (vaultAccount?.balanceUsdc ?: 0.0) - amount } - } else { - null - } val (postOpFreeCollateral, postOpMarginUsage) = if (accountData?.freeCollateral != null && accountData.marginUsage != null) { val equity = accountData.freeCollateral / (1 - accountData.marginUsage) diff --git a/v4_abacus.podspec b/v4_abacus.podspec index 141225b20..35d5b375b 100644 --- a/v4_abacus.podspec +++ b/v4_abacus.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = 'v4_abacus' - spec.version = '1.11.21' + spec.version = '1.11.22' spec.homepage = 'https://github.com/dydxprotocol/v4-abacus' spec.source = { :http=> ''} spec.authors = '' From 60b2d1fe96ff6d590efdbeb16b24b9d01e97737f Mon Sep 17 00:00:00 2001 From: Tyler Date: Wed, 25 Sep 2024 18:40:21 -0400 Subject: [PATCH 2/2] fix --- .../functional/vault/VaultDepositWithdrawForm.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt index 95eff34b3..1e48b71c9 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt @@ -233,9 +233,9 @@ object VaultDepositWithdrawFormValidator { val withdrawnAmountIncludingSlippage = slippageResponse?.expectedAmount val postOpVaultBalance = when (formData.action) { - VaultFormAction.DEPOSIT -> (vaultAccount?.balanceUsdc ?: 0.0) + amount - VaultFormAction.WITHDRAW -> (vaultAccount?.balanceUsdc ?: 0.0) - amount - } + VaultFormAction.DEPOSIT -> (vaultAccount?.balanceUsdc ?: 0.0) + amount + VaultFormAction.WITHDRAW -> (vaultAccount?.balanceUsdc ?: 0.0) - amount + } val (postOpFreeCollateral, postOpMarginUsage) = if (accountData?.freeCollateral != null && accountData.marginUsage != null) { val equity = accountData.freeCollateral / (1 - accountData.marginUsage)