Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Fix: tezos tokens transfers big amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
matsakiv committed Aug 23, 2021
1 parent e26fca2 commit 3107246
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Atomex.Client.Wpf.Installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<?define Name = "Atomex Client" ?>
<?define Manufacturer = "Atomex.me" ?>
<?define Description = "Multicurrency HD wallet with built-in hybrid exchange based on atomic swap." ?>
<?define Version = "1.1.3" ?>
<?define Version = "1.1.4" ?>
<?define UpgradeCode = "DB7FCF8D-E0C6-4C99-A6B1-3FB6D703F97E" ?>
<?define ExeName = "Atomex.Client.Wpf.exe" ?>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;
using System.Diagnostics;
using System.Numerics;
using System.Windows;
using System.Windows.Input;

using Serilog;

using Atomex.Blockchain.Abstract;
using Atomex.Blockchain.Tezos;
using Atomex.Common;
using Atomex.Client.Wpf.Common;

namespace Atomex.Client.Wpf.ViewModels.TransactionViewModels
Expand All @@ -18,7 +18,6 @@ public class TezosTokenTransferViewModel : BaseViewModel, ITransactionViewModel

private readonly TezosConfig _tezosConfig;


public IBlockchainTransaction Transaction { get; }
public string Id { get; set; }
public BlockchainTransactionState State { get; set; }
Expand Down Expand Up @@ -110,14 +109,16 @@ public TezosTokenTransferViewModel(TokenTransfer tx, TezosConfig tezosConfig)

private static decimal GetAmount(TokenTransfer tx)
{
if (!decimal.TryParse(tx.Amount, out var amount))
return 0;
if (tx.Amount.TryParseWithRound(tx.Token.Decimals, out var amount))
{
var sign = tx.Type.HasFlag(BlockchainTransactionType.Input)
? 1
: -1;

var sign = tx.Type.HasFlag(BlockchainTransactionType.Input)
? 1
: -1;
return sign * amount;
}

return sign * amount / (decimal)BigInteger.Pow(10, tx.Token.Decimals);
return 0;
}

private void DesignerMode()
Expand Down

0 comments on commit 3107246

Please sign in to comment.