From 4c041e763b5c0340879558325c324d3f57e7efb5 Mon Sep 17 00:00:00 2001 From: Ivan Belyakov Date: Thu, 11 Apr 2024 19:27:04 +0200 Subject: [PATCH] fix(wallet): fixed precision loss for balance amount in nimqml fixed currency amount property type to be handled by QMetatype properly --- src/app/modules/shared_models/currency_amount.nim | 6 ++---- src/app_service/service/community_tokens/service.nim | 2 +- vendor/nimqml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/modules/shared_models/currency_amount.nim b/src/app/modules/shared_models/currency_amount.nim index 8501d3f3eb..b982214275 100644 --- a/src/app/modules/shared_models/currency_amount.nim +++ b/src/app/modules/shared_models/currency_amount.nim @@ -39,13 +39,11 @@ QtObject: stripTrailingZeroes: {self.stripTrailingZeroes} )""" - proc getAmount*(self: CurrencyAmount): float64 = + proc getAmount*(self: CurrencyAmount): float {.slot.} = return self.amount - proc getAmountFloat*(self: CurrencyAmount): float {.slot.} = - return self.amount QtProperty[float] amount: - read = getAmountFloat + read = getAmount proc getSymbol*(self: CurrencyAmount): string {.slot.} = return self.symbol diff --git a/src/app_service/service/community_tokens/service.nim b/src/app_service/service/community_tokens/service.nim index ad2ef60ae4..b59c82fd5c 100644 --- a/src/app_service/service/community_tokens/service.nim +++ b/src/app_service/service/community_tokens/service.nim @@ -1362,7 +1362,7 @@ QtObject: dataToEmit.errorCode = ComputeFeeErrorCode.Balance # set total error code to balance error var args = self.createComputeFeeArgsFromEthAndBalance(ethValue, balance) totalEthVal = totalEthVal + ethValue - totalFiatVal = totalFiatVal + args.fiatCurrency.getAmountFloat() + totalFiatVal = totalFiatVal + args.fiatCurrency.getAmount() args.contractUniqueKey = common_utils.contractUniqueKey(collectibleAndAmount.communityToken.chainId, collectibleAndAmount.communityToken.address) allComputeFeeArgs.add(args) diff --git a/vendor/nimqml b/vendor/nimqml index 13a8890db4..20d4db12bb 160000 --- a/vendor/nimqml +++ b/vendor/nimqml @@ -1 +1 @@ -Subproject commit 13a8890db484d3ff40b410c2ff4b3e3bd2e0e880 +Subproject commit 20d4db12bb40dcf1c549ab3149ca0b4b791e90b7