diff --git a/build.gradle.kts b/build.gradle.kts index 7632a8d1a..01031b203 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ allprojects { } group = "exchange.dydx.abacus" -version = "1.13.0" +version = "1.13.1" 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 0d0e1936c..ee8310442 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/functional/vault/VaultDepositWithdrawForm.kt @@ -238,6 +238,7 @@ object VaultDepositWithdrawFormValidator { private const val SLIPPAGE_PERCENT_WARN = 0.01 private const val SLIPPAGE_PERCENT_ACK = 0.04 private const val SLIPPAGE_TOLERANCE = 0.01 + private const val EPSILON_FOR_ERRORS = 0.0001 private const val MIN_DEPOSIT_FE_THRESHOLD = 20.0 @@ -370,7 +371,7 @@ object VaultDepositWithdrawFormValidator { when (formData.action) { VaultFormAction.DEPOSIT -> { - if (postOpFreeCollateral != null && postOpFreeCollateral < 0) { + if (postOpFreeCollateral != null && postOpFreeCollateral < -EPSILON_FOR_ERRORS) { errors.add(vaultFormValidationErrors.depositTooHigh()) } if (amount > 0 && amount < MIN_DEPOSIT_FE_THRESHOLD) { @@ -378,7 +379,7 @@ object VaultDepositWithdrawFormValidator { } } VaultFormAction.WITHDRAW -> { - if (postOpVaultBalance != null && postOpVaultBalance < 0) { + if (postOpVaultBalance < -EPSILON_FOR_ERRORS) { errors.add(vaultFormValidationErrors.withdrawTooHigh()) } if (amount > 0 && amount < MIN_DEPOSIT_FE_THRESHOLD) { @@ -391,7 +392,7 @@ object VaultDepositWithdrawFormValidator { errors.add(vaultFormValidationErrors.withdrawTooLow()) } } - if (postOpVaultBalance != null && postOpVaultBalance >= 0 && amount > 0 && + if (postOpVaultBalance >= -EPSILON_FOR_ERRORS && amount > 0 && vaultAccount?.withdrawableUsdc != null && amount > vaultAccount.withdrawableUsdc ) { errors.add(vaultFormValidationErrors.withdrawingLockedBalance()) diff --git a/v4_abacus.podspec b/v4_abacus.podspec index c52c92710..7ebef41d5 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.13.0' + spec.version = '1.13.1' spec.homepage = 'https://github.com/dydxprotocol/v4-abacus' spec.source = { :http=> ''} spec.authors = ''