Skip to content

Commit 28f7c63

Browse files
committed
fix(token/movement): correctly create LocalFiat based on entered native amount for external funds
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 504b359 commit 28f7c63

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/flipcash/shared/tokens/src/main/kotlin/BuySellSwapTokenViewModel.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,13 @@ class BuySellSwapTokenViewModel @Inject constructor(
430430
is TokenSwapPurpose.FundWithWallet -> {
431431
val rate = exchange.entryRate
432432
// funding through external wallet
433+
val nativeAmount = Fiat(data.amountData.amount, rate.currency)
434+
val underlyingAmount = nativeAmount.convertingToUsdIfNeeded(rate)
433435
val amountFiat = LocalFiat(
434-
usdf = Fiat(data.amountData.amount, rate.currency),
435-
rate = rate
436+
usdf = underlyingAmount,
437+
nativeAmount = nativeAmount,
436438
)
439+
437440
dispatchEvent(Event.OnAmountAccepted(amountFiat))
438441
dispatchEvent(
439442
Event.CreateAndSendTransactionToWallet(

0 commit comments

Comments
 (0)