Skip to content

Commit

Permalink
Update function name to be consistent with iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixhuang committed Mar 21, 2024
1 parent 9850e0b commit 9d468ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class DydxFormatter @Inject constructor() {
/*
xxxxx.yyyyy
*/
fun decimalRaw(number: Double?, digits: Int): String? {
fun decimalLocaleAgnostic(number: Double?, digits: Int): String? {
return raw(number = number, digits = digits, locale = Locale.US)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package exchange.dydx.common.formatter

import exchange.dydx.trading.common.formatter.DydxFormatter
import junit.framework.TestCase
import org.junit.Assert
import org.junit.Test
import java.time.Instant
Expand Down Expand Up @@ -214,7 +213,7 @@ class DydxFormatterTests {
}

@Test
fun testDecimalRaw() {
fun testDecimalLocaleAgnostic() {
val formatter = DydxFormatter()
data class TestCase(
val number: Double,
Expand All @@ -234,7 +233,7 @@ class DydxFormatterTests {
)

testCases.forEach { testCase ->
val formatted = formatter.decimalRaw(number = testCase.number, digits = testCase.digits)
val formatted = formatter.decimalLocaleAgnostic(number = testCase.number, digits = testCase.digits)
assert(formatted == testCase.expected) { "Test case: $testCase, formatted: $formatted" }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DydxTransferSubaccountWorker(
val subaccountNumber: Int = selectedSubaccount?.subaccountNumber ?: 0
val depositAmount = balance?.minus(balanceRetainAmount) ?: 0.0
if (depositAmount <= 0) return@combine
val amountString = formatter.decimalRaw(depositAmount, abacusStateManager.usdcTokenDecimal)
val amountString = formatter.decimalLocaleAgnostic(depositAmount, abacusStateManager.usdcTokenDecimal)
?: return@combine

depositToSubaccount(amountString, subaccountNumber, wallet)
Expand Down

0 comments on commit 9d468ec

Please sign in to comment.