From ab4a7ce0428024142767be28b24d1defc2889355 Mon Sep 17 00:00:00 2001 From: Jared Vu Date: Thu, 23 May 2024 18:37:04 -0700 Subject: [PATCH] Utilize usdcSize Input instead of orderPayload price * size (#382) --- .../state/v2/supervisor/SubaccountSupervisor.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt index 20581a270..63bef5cf2 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/v2/supervisor/SubaccountSupervisor.kt @@ -564,10 +564,8 @@ internal class SubaccountSupervisor( // Derive transfer params from trade input val targetLeverage = trade?.targetLeverage ?: error("targetLeverage is null") - val size = orderPayload.size - val price = orderPayload.price - val notionalUsdc = price * size - val amountToTransfer = (notionalUsdc / targetLeverage).toString() + val usdcSize = trade.size?.usdcSize ?: error("usdcSize is null") + val amountToTransfer = (usdcSize / targetLeverage).toString() val childSubaccountNumber = orderPayload.subaccountNumber val transferPayload = HumanReadableSubaccountTransferPayload(