diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/output/input/TransferInput.kt b/src/commonMain/kotlin/exchange.dydx.abacus/output/input/TransferInput.kt index 000d44652..5c49f6dd4 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/output/input/TransferInput.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/output/input/TransferInput.kt @@ -561,6 +561,7 @@ data class TransferInput( ) val errors = parser.asString(route?.get("errors")) + val errorMessage: String? = if (errors != null) { val errorArray = parser.decodeJsonArray(errors) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipProcessor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipProcessor.kt index 4180dc51e..167391b35 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipProcessor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipProcessor.kt @@ -12,7 +12,6 @@ import exchange.dydx.abacus.state.manager.CctpConfig.cctpChainIds import exchange.dydx.abacus.utils.mutable import exchange.dydx.abacus.utils.safeSet - @Suppress("NotImplementedDeclaration", "ForbiddenComment") internal class SkipProcessor( parser: ParserProtocol, diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessor.kt b/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessor.kt index 6c8e15967..9230be899 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessor.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessor.kt @@ -2,6 +2,7 @@ package exchange.dydx.abacus.processor.router.skip import exchange.dydx.abacus.processor.base.BaseProcessor import exchange.dydx.abacus.protocols.ParserProtocol +import exchange.dydx.abacus.utils.SLIPPAGE_PERCENT import exchange.dydx.abacus.utils.safeSet import kotlin.math.pow @@ -66,7 +67,7 @@ internal class SkipRouteProcessor(internal val parser: ParserProtocol) { // This is just hard coded in our params so we're keeping it to be at parity for now // Fast follow squid -> skip migration project to removing max slippage // because we already show the actual price impact. - modified.safeSet("slippage", "1") + modified.safeSet("slippage", SLIPPAGE_PERCENT) modified.safeSet("requestPayload", payloadProcessor.received(null, payload)) val errorCode = parser.value(payload, "code") diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor+Transfer.kt b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor+Transfer.kt index 63122080e..1facb6493 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor+Transfer.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/state/manager/V4StateManagerAdaptor+Transfer.kt @@ -16,6 +16,7 @@ import exchange.dydx.abacus.state.model.squidStatus import exchange.dydx.abacus.utils.IMap import exchange.dydx.abacus.utils.Logger import exchange.dydx.abacus.utils.Numeric +import exchange.dydx.abacus.utils.SLIPPAGE_PERCENT import exchange.dydx.abacus.utils.filterNotNull import exchange.dydx.abacus.utils.iMapOf import exchange.dydx.abacus.utils.mutable @@ -251,7 +252,7 @@ private fun V4StateManagerAdaptor.retrieveSkipDepositRoute(state: PerpetualState fromChain to sourceAddress.toString(), toChain to nobleAddress, ), - "slippage_tolerance_percent" to "1", + "slippage_tolerance_percent" to SLIPPAGE_PERCENT, ) val oldState = stateMachine.state val header = iMapOf( diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/utils/Constants.kt b/src/commonMain/kotlin/exchange.dydx.abacus/utils/Constants.kt index 14a8dd576..49bef192f 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/utils/Constants.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/utils/Constants.kt @@ -8,3 +8,6 @@ internal const val MAX_SUBACCOUNT_NUMBER = 128_000 internal const val SHORT_TERM_ORDER_DURATION = 10 internal const val QUANTUM_MULTIPLIER = 1_000_000 + +// Route Param Constants +internal const val SLIPPAGE_PERCENT = "1" diff --git a/src/commonTest/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessorTests.kt b/src/commonTest/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessorTests.kt index 572af180b..40e7ea051 100644 --- a/src/commonTest/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessorTests.kt +++ b/src/commonTest/kotlin/exchange.dydx.abacus/processor/router/skip/SkipRouteProcessorTests.kt @@ -37,7 +37,7 @@ class SkipRouteProcessorTests { @Test fun testReceivedError() { - val payload = skipRouteMock.payload_error + val payload = skipRouteMock.payloadError val result = skipRouteProcessor.received(existing = mapOf(), payload = templateToJson(payload), decimals = 6.0) val expected = mapOf( "slippage" to "1", diff --git a/src/commonTest/kotlin/exchange.dydx.abacus/tests/payloads/SkipRouteMock.kt b/src/commonTest/kotlin/exchange.dydx.abacus/tests/payloads/SkipRouteMock.kt index c430e67fb..9b834ec81 100644 --- a/src/commonTest/kotlin/exchange.dydx.abacus/tests/payloads/SkipRouteMock.kt +++ b/src/commonTest/kotlin/exchange.dydx.abacus/tests/payloads/SkipRouteMock.kt @@ -107,7 +107,7 @@ internal class SkipRouteMock { ] } }""" - internal val payload_error = """ + internal val payloadError = """ { "code": 3, "message": "difference in usd value of route input and output is too large. input usd value: 100000.00 output usd value: 98811.81",