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

Commit

Permalink
kUSD (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
matsakiv authored Feb 24, 2021
1 parent d230549 commit cd55dfa
Show file tree
Hide file tree
Showing 21 changed files with 136 additions and 82 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.0.70" ?>
<?define Version = "1.0.71" ?>
<?define UpgradeCode = "DB7FCF8D-E0C6-4C99-A6B1-3FB6D703F97E" ?>
<?define ExeName = "Atomex.Client.Wpf.exe" ?>

Expand Down
7 changes: 6 additions & 1 deletion Atomex.Client.Wpf/Atomex.Client.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@
<Compile Include="ViewModels\CreateWalletViewModels\WalletTypeViewModel.cs" />
<Compile Include="ViewModels\CurrencyViewModels\FA2CurrencyViewModel.cs" />
<Compile Include="ViewModels\CurrencyViewModels\NYXCurrencyViewModel.cs" />
<Compile Include="ViewModels\CurrencyViewModels\KusdCurrencyViewModel.cs" />
<Compile Include="ViewModels\CurrencyViewModels\WbtcCurrencyViewModel.cs" />
<Compile Include="ViewModels\CurrencyViewModels\TbtcCurrencyViewModel.cs" />
<Compile Include="ViewModels\CurrencyViewModels\TzbtcCurrencyViewModel.cs" />
Expand Down Expand Up @@ -940,7 +941,11 @@
<Resource Include="Resources\Images\wbtc.png" />
<Resource Include="Resources\Images\wbtc_mask.png" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="Resources\Images\kusd.png" />
<Resource Include="Resources\Images\kusd_90x90.png" />
<Resource Include="Resources\Images\kusd_mask.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Binary file added Atomex.Client.Wpf/Resources/Images/kusd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Atomex.Client.Wpf/Resources/Images/kusd_90x90.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Atomex.Client.Wpf/Resources/Images/kusd_mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Atomex.Client.Wpf/Resources/Images/tzbtc_90x90_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions Atomex.Client.Wpf/Styles/WalletViewStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@
SwapPaymentTemplate="{StaticResource TezosTransactionDetailsTemplate}"
SwapRedeemTemplate="{StaticResource TezosTransactionDetailsTemplate}"
SwapRefundTemplate="{StaticResource TezosTransactionDetailsTemplate}"/>
<controls:TransactionDataTemplateSelector
Currency="KUSD"
UnknownTemplate="{StaticResource TezosTransactionDetailsTemplate}"
SentTemplate="{StaticResource TezosTransactionDetailsTemplate}"
ReceivedTemplate="{StaticResource TezosTransactionDetailsTemplate}"
TokenApproveTemplate="{StaticResource TezosTransactionDetailsTemplate}"
SwapPaymentTemplate="{StaticResource TezosTransactionDetailsTemplate}"
SwapRedeemTemplate="{StaticResource TezosTransactionDetailsTemplate}"
SwapRefundTemplate="{StaticResource TezosTransactionDetailsTemplate}"/>
<controls:TransactionDataTemplateSelector
Currency="NYX"
UnknownTemplate="{StaticResource TezosTransactionDetailsTemplate}"
Expand Down
4 changes: 2 additions & 2 deletions Atomex.Client.Wpf/ViewModels/ConversionViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public CurrencyViewModel FromCurrencyViewModel
{
var quoteCurrency = Currencies.GetByName(symbol.Quote);

PriceFormat = $"F{quoteCurrency.Digits}";
PriceFormat = quoteCurrency.Format;
}
}
}
Expand All @@ -193,7 +193,7 @@ public CurrencyViewModel ToCurrencyViewModel
{
var quoteCurrency = Currencies.GetByName(symbol.Quote);

PriceFormat = $"F{quoteCurrency.Digits}";
PriceFormat = quoteCurrency.Format;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Atomex.Client.Wpf.Properties;
using Atomex.Client.Wpf.ViewModels.Abstract;
using Atomex.Core;
Expand All @@ -12,15 +13,15 @@ public class BitcoinCurrencyViewModel : CurrencyViewModel
public BitcoinCurrencyViewModel(Currency currency)
: base(currency)
{
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("bitcoin_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("bitcoin_mask.png"))));
AccentColor = Color.FromRgb(r: 255, g: 148, b: 0);
AmountColor = Color.FromRgb(r: 255, g: 148, b: 0);
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("bitcoin_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("bitcoin_mask.png"))));
AccentColor = Color.FromRgb(r: 255, g: 148, b: 0);
AmountColor = Color.FromRgb(r: 255, g: 148, b: 0);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("bitcoin.png");
LargeIconPath = PathToImage("bitcoin_90x90.png");
FeeName = Resources.SvMiningFee;
IconPath = PathToImage("bitcoin.png");
LargeIconPath = PathToImage("bitcoin_90x90.png");
FeeName = Resources.SvMiningFee;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ public static CurrencyViewModel CreateViewModel(
Currency currency,
bool subscribeToUpdates)
{
var result = currency switch
var result = currency.Name switch
{
Bitcoin _ => (CurrencyViewModel)new BitcoinCurrencyViewModel(currency),
Litecoin _ => (CurrencyViewModel)new LitecoinCurrencyViewModel(currency),
Tether _ => (CurrencyViewModel)new TetherCurrencyViewModel(currency),
TBTC _ => (CurrencyViewModel)new TbtcCurrencyViewModel(currency),
WBTC _ => (CurrencyViewModel)new WbtcCurrencyViewModel(currency),
Ethereum _ => (CurrencyViewModel)new EthereumCurrencyViewModel(currency),
NYX _ => (CurrencyViewModel)new NYXCurrencyViewModel(currency),
FA2 _ => (CurrencyViewModel)new FA2CurrencyViewModel(currency),
TZBTC _ => (CurrencyViewModel)new TzbtcCurrencyViewModel(currency),
Tezos _ => (CurrencyViewModel)new TezosCurrencyViewModel(currency),
"BTC" => (CurrencyViewModel)new BitcoinCurrencyViewModel(currency),
"LTC" => new LitecoinCurrencyViewModel(currency),
"USDT" => new TetherCurrencyViewModel(currency),
"TBTC" => new TbtcCurrencyViewModel(currency),
"WBTC" => new WbtcCurrencyViewModel(currency),
"ETH" => new EthereumCurrencyViewModel(currency),
"NYX" => new NYXCurrencyViewModel(currency),
"FA2" => new FA2CurrencyViewModel(currency),
"TZBTC" => new TzbtcCurrencyViewModel(currency),
"KUSD" => new KusdCurrencyViewModel(currency),
"XTZ" => new TezosCurrencyViewModel(currency),
"FA12" => new TzbtcCurrencyViewModel(currency),
_ => throw new NotSupportedException(
$"Can't create currency view model for {currency.Name}. This currency is not supported.")
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Atomex.Client.Wpf.Properties;
using Atomex.Client.Wpf.ViewModels.Abstract;
using Atomex.Core;
Expand All @@ -12,15 +13,15 @@ public class EthereumCurrencyViewModel : CurrencyViewModel
public EthereumCurrencyViewModel(Currency currency)
: base(currency)
{
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_mask.png"))));
AccentColor = Color.FromRgb(r: 73, g: 114, b: 143);
AmountColor = Color.FromRgb(r: 183, g: 208, b: 225);
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_mask.png"))));
AccentColor = Color.FromRgb(r: 73, g: 114, b: 143);
AmountColor = Color.FromRgb(r: 183, g: 208, b: 225);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("ethereum.png");
LargeIconPath = PathToImage("ethereum_90x90.png");
FeeName = Resources.SvGasLimit;
IconPath = PathToImage("ethereum.png");
LargeIconPath = PathToImage("ethereum_90x90.png");
FeeName = Resources.SvGasLimit;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Atomex.Client.Wpf.Properties;
using Atomex.Client.Wpf.ViewModels.Abstract;
using Atomex.Core;

namespace Atomex.Client.Wpf.ViewModels.CurrencyViewModels
{
public class KusdCurrencyViewModel : CurrencyViewModel
{
public KusdCurrencyViewModel(Currency currency)
: base(currency)
{
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("kusd_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("kusd_mask.png"))));
AccentColor = Color.FromRgb(r: 7, g: 82, b: 192);
AmountColor = Color.FromRgb(r: 188, g: 212, b: 247);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("kusd.png");
LargeIconPath = PathToImage("kusd_90x90.png");
FeeName = Resources.SvMiningFee;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Atomex.Client.Wpf.Properties;
using Atomex.Client.Wpf.ViewModels.Abstract;
using Atomex.Core;
Expand All @@ -12,15 +13,15 @@ public class LitecoinCurrencyViewModel : CurrencyViewModel
public LitecoinCurrencyViewModel(Currency currency)
: base(currency)
{
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_mask.png"))));
AccentColor = Color.FromRgb(r: 191, g: 191, b: 191);
AmountColor = Color.FromRgb(r: 231, g: 231, b: 231);
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_mask.png"))));
AccentColor = Color.FromRgb(r: 191, g: 191, b: 191);
AmountColor = Color.FromRgb(r: 231, g: 231, b: 231);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("litecoin.png");
LargeIconPath = PathToImage("litecoin_90x90.png");
FeeName = Resources.SvMiningFee;
IconPath = PathToImage("litecoin.png");
LargeIconPath = PathToImage("litecoin_90x90.png");
FeeName = Resources.SvMiningFee;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ public class TetherCurrencyViewModel : CurrencyViewModel
public TetherCurrencyViewModel(Currency currency)
: base(currency)
{
ChainCurrency = new Ethereum();
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_mask.png"))));
AccentColor = Color.FromRgb(r: 0, g: 162, b: 122);
AmountColor = Color.FromRgb(r: 183, g: 208, b: 225);
ChainCurrency = new Ethereum();
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_mask.png"))));
AccentColor = Color.FromRgb(r: 0, g: 162, b: 122);
AmountColor = Color.FromRgb(r: 183, g: 208, b: 225);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("tether.png");
LargeIconPath = PathToImage("tether_90x90.png");
FeeName = Resources.SvGasLimit;
IconPath = PathToImage("tether.png");
LargeIconPath = PathToImage("tether_90x90.png");
FeeName = Resources.SvGasLimit;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Windows.Media;
using System.Windows.Media.Imaging;

using Atomex.Client.Wpf.Properties;
using Atomex.Client.Wpf.ViewModels.Abstract;
using Atomex.Core;
Expand All @@ -12,15 +13,15 @@ public class TezosCurrencyViewModel : CurrencyViewModel
public TezosCurrencyViewModel(Currency currency)
: base(currency)
{
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_mask.png"))));
AccentColor = Color.FromRgb(r: 44, g: 125, b: 247);
AmountColor = Color.FromRgb(r: 188, g: 212, b: 247);
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_90x90.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_mask.png"))));
AccentColor = Color.FromRgb(r: 44, g: 125, b: 247);
AmountColor = Color.FromRgb(r: 188, g: 212, b: 247);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("tezos.png");
LargeIconPath = PathToImage("tezos_90x90.png");
FeeName = Resources.SvMiningFee;
IconPath = PathToImage("tezos.png");
LargeIconPath = PathToImage("tezos_90x90.png");
FeeName = Resources.SvMiningFee;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class TzbtcCurrencyViewModel : CurrencyViewModel
public TzbtcCurrencyViewModel(Currency currency)
: base(currency)
{
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_90x90_dark.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_mask.png"))));
AccentColor = Color.FromRgb(r: 7, g: 82, b: 192);
AmountColor = Color.FromRgb(r: 188, g: 212, b: 247);
Header = Currency.Description;
IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_90x90_dark.png"))));
IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_mask.png"))));
AccentColor = Color.FromRgb(r: 7, g: 82, b: 192);
AmountColor = Color.FromRgb(r: 188, g: 212, b: 247);
UnselectedIconBrush = Brushes.White;
IconPath = PathToImage("tzbtc_dark.png");
LargeIconPath = PathToImage("tzbtc_90x90_dark.png");
FeeName = Resources.SvMiningFee;
IconPath = PathToImage("tzbtc_dark.png");
LargeIconPath = PathToImage("tzbtc_90x90_dark.png");
FeeName = Resources.SvMiningFee;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public override Currency Currency

activeTokenAddresses.ForEach(a => a.Balance = activeAddresses.Find(b => b.Address == a.Address)?.Balance ?? 0m);

activeAddresses = activeAddresses.Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null).ToList();
activeAddresses = activeAddresses
.Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null)
.ToList();

var freeAddress = App.Account
.GetFreeExternalAddressAsync(_currency.Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public override Currency Currency

activeTokenAddresses.ForEach(a => a.Balance = activeAddresses.Find(b => b.Address == a.Address)?.Balance ?? 0m);

activeAddresses = activeAddresses.Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null).ToList();
activeAddresses = activeAddresses
.Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null)
.ToList();

var freeAddress = App.Account
.GetFreeExternalAddressAsync(_currency.Name)
Expand Down
Loading

0 comments on commit cd55dfa

Please sign in to comment.