Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wallet): fixed precision loss for balance amount #14406

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/app/modules/shared_models/currency_amount.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app_service/service/community_tokens/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down