Skip to content

Commit

Permalink
Revert "fix: vaults submission types match better (#676)"
Browse files Browse the repository at this point in the history
This reverts commit 45570fe.
  • Loading branch information
tyleroooo authored Sep 25, 2024
1 parent 45570fe commit 8295fff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ allprojects {
}

group = "exchange.dydx.abacus"
version = "1.11.20"
version = "1.11.19"

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package exchange.dydx.abacus.functional.vault

import com.ionspin.kotlin.bignum.decimal.toBigDecimal
import exchange.dydx.abacus.output.input.ErrorFormat
import exchange.dydx.abacus.output.input.ErrorParam
import exchange.dydx.abacus.output.input.ErrorResources
Expand Down Expand Up @@ -166,15 +165,15 @@ data class VaultDepositWithdrawSubmissionData(
@Serializable
data class VaultDepositData(
val subaccountFrom: String,
val quoteQuantums: String
val amount: Double
)

@JsExport
@Serializable
data class VaultWithdrawData(
val subaccountTo: String,
val shares: String,
val minQuoteQuantums: String,
val shares: Double,
val minAmount: Double
)

@JsExport
Expand Down Expand Up @@ -202,9 +201,7 @@ object VaultDepositWithdrawFormValidator {

private const val SLIPPAGE_PERCENT_WARN = 0.01
private const val SLIPPAGE_PERCENT_ACK = 0.04
private const val EXTRA_SLIPPAGE_TOLERANCE = 0.01

private const val QUANTUMS_MULTIPLIER = 1_000_000
private const val SLIPPAGE_TOLERANCE = 0.01

fun getVaultDepositWithdrawSlippageResponse(apiResponse: String): VaultDepositWithdrawSlippageResponse? {
return parser.asTypedObject<VaultDepositWithdrawSlippageResponse>(apiResponse)
Expand Down Expand Up @@ -334,7 +331,7 @@ object VaultDepositWithdrawFormValidator {
VaultFormAction.DEPOSIT -> VaultDepositWithdrawSubmissionData(
deposit = VaultDepositData(
subaccountFrom = "0",
quoteQuantums = amount.toBigDecimal().times(QUANTUMS_MULTIPLIER).toBigInteger().toString(),
amount = amount,
),
withdraw = null,
)
Expand All @@ -343,10 +340,8 @@ object VaultDepositWithdrawFormValidator {
withdraw = if (sharesToAttemptWithdraw != null && sharesToAttemptWithdraw > 0 && slippageResponse != null) {
VaultWithdrawData(
subaccountTo = "0",
shares = sharesToAttemptWithdraw.toBigDecimal().toBigInteger().toString(),
minQuoteQuantums = (slippageResponse.expectedAmount * (1 - EXTRA_SLIPPAGE_TOLERANCE)).toBigDecimal().times(
QUANTUMS_MULTIPLIER,
).toBigInteger().toString(),
shares = sharesToAttemptWithdraw,
minAmount = slippageResponse.expectedAmount * (1 - SLIPPAGE_TOLERANCE),
)
} else {
null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package exchange.dydx.abacus.functional.vault

import com.ionspin.kotlin.bignum.decimal.toBigDecimal
import exchange.dydx.abacus.output.input.ValidationError
import kollections.iListOf
import kollections.toIList
Expand Down Expand Up @@ -49,7 +48,7 @@ class VaultFormTests {
submissionData = VaultDepositWithdrawSubmissionData(
deposit = VaultDepositData(
subaccountFrom = "0",
quoteQuantums = "100000000",
amount = 100.0,
),
withdraw = null,
),
Expand Down Expand Up @@ -100,8 +99,8 @@ class VaultFormTests {
deposit = null,
withdraw = VaultWithdrawData(
subaccountTo = "0",
shares = "100",
minQuoteQuantums = (98 * .99).toBigDecimal().times(1000000).toBigInteger().toString(),
shares = 100.0,
minAmount = 98 * .99,
),
),
summaryData = VaultFormSummaryData(
Expand Down
2 changes: 1 addition & 1 deletion v4_abacus.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'v4_abacus'
spec.version = '1.11.20'
spec.version = '1.11.19'
spec.homepage = 'https://github.com/dydxprotocol/v4-abacus'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down

0 comments on commit 8295fff

Please sign in to comment.