Skip to content

Commit e50e39a

Browse files
committed
chore(ocp/fiat): pass in full quarks amount for token sell estimation; divide on backend
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 533ba8f commit e50e39a

File tree

1 file changed

+3
-2
lines changed
  • services/opencode/src/main/kotlin/com/getcode/opencode/model/financial

1 file changed

+3
-2
lines changed

services/opencode/src/main/kotlin/com/getcode/opencode/model/financial/Fiat.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.getcode.opencode.model.financial
33
import android.icu.util.ULocale
44
import android.os.Parcelable
55
import com.flipcash.libs.currency.math.Estimator
6+
import com.flipcash.libs.currency.math.divideWithHighPrecision
67
import com.getcode.solana.keys.Mint
78
import kotlinx.parcelize.Parcelize
89
import kotlinx.serialization.Serializable
@@ -166,11 +167,11 @@ data class Fiat(
166167
return Fiat(
167168
estimation = {
168169
Estimator.sell(
169-
amountInQuarks = (quarks / MULTIPLIER).toLong(),
170+
amountInQuarks = quarks,
170171
currentValueInQuarks = token.launchpadMetadata?.coreMintLockedQuarks ?: 0,
171172
mintDecimals = 6, // The desired value here is USDC which is 6
172173
feeBps = 0,
173-
).getOrThrow().netAmountToReceive
174+
).getOrThrow().netAmountToReceive.divideWithHighPrecision(BigDecimal(MULTIPLIER))
174175
},
175176
tokenMintDecimals = token.decimals
176177
)

0 commit comments

Comments
 (0)