From 6fab06b405cd0597d3b1b08de118e8e2ff19d53b Mon Sep 17 00:00:00 2001 From: Tyler Date: Thu, 14 Nov 2024 18:52:32 -0500 Subject: [PATCH] fix-lev --- build.gradle.kts | 2 +- .../processor/input/TradeInputProcessor.kt | 9 +++++++++ v4_abacus.podspec | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f3e3dc7c6..d6e6cc68d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ allprojects { } group = "exchange.dydx.abacus" -version = "1.13.29" +version = "1.13.30" repositories { google() diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/processor/input/TradeInputProcessor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/processor/input/TradeInputProcessor.kt index 81ff834f0..a8ca3589f 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/processor/input/TradeInputProcessor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/processor/input/TradeInputProcessor.kt @@ -256,6 +256,15 @@ internal class TradeInputProcessor( TradeInputField.marginMode -> { inputType.updateValueAction?.invoke(trade, inputData, parser) + + // when moving from cross to isolated, update targetLeverage so it isn't sitting at null + if (trade.marginMode === MarginMode.Isolated) { + val market = marketSummaryState.markets[trade.marketId] + val maxMarketLeverage = market?.perpetualMarket?.configs?.maxMarketLeverage + ?: Numeric.double.ONE + trade.targetLeverage = maxMarketLeverage + } + val changedSubaccountNumbers = MarginCalculator.getChangedSubaccountNumbers( parser = parser, diff --git a/v4_abacus.podspec b/v4_abacus.podspec index b65631c23..7f29b624a 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.29' + spec.version = '1.13.30' spec.homepage = 'https://github.com/dydxprotocol/v4-abacus' spec.source = { :http=> ''} spec.authors = ''