diff --git a/BTCPayServer/BTCPayNetworkProvider.Dogecoin.cs b/BTCPayServer/BTCPayNetworkProvider.Dogecoin.cs index 9fbff33a9..e12ceaff7 100644 --- a/BTCPayServer/BTCPayNetworkProvider.Dogecoin.cs +++ b/BTCPayServer/BTCPayNetworkProvider.Dogecoin.cs @@ -20,7 +20,11 @@ namespace BTCPayServer NBitcoinNetwork = nbxplorerNetwork.NBitcoinNetwork, NBXplorerNetwork = nbxplorerNetwork, UriScheme = "dogecoin", - DefaultRateRules = new[] { "DOGE_X = bittrex(DOGE_BTC) * BTC_X" }, + DefaultRateRules = new[] + { + "DOGE_X = DOGE_BTC * BTC_X", + "DOGE_BTC = bittrex(DOGE_BTC)" + }, CryptoImagePath = "imlegacy/dogecoin.png", DefaultSettings = BTCPayDefaultSettings.GetDefaultSettings(NetworkType), CoinType = NetworkType == NetworkType.Mainnet ? new KeyPath("3'") : new KeyPath("1'") diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 2b36f82d5..ce03eb9b7 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -2,7 +2,7 @@ Exe netcoreapp2.0 - 1.0.2.3 + 1.0.2.4 NU1701,CA1816,CA1308,CA1810,CA2208 diff --git a/BTCPayServer/Controllers/ServerController.cs b/BTCPayServer/Controllers/ServerController.cs index 54ec88151..2c10440d0 100644 --- a/BTCPayServer/Controllers/ServerController.cs +++ b/BTCPayServer/Controllers/ServerController.cs @@ -243,10 +243,7 @@ namespace BTCPayServer.Controllers { try { - if(string.IsNullOrWhiteSpace(model.Settings.From) - || string.IsNullOrWhiteSpace(model.TestEmail) - || string.IsNullOrWhiteSpace(model.Settings.Login) - || string.IsNullOrWhiteSpace(model.Settings.Server)) + if(!model.Settings.IsComplete()) { model.StatusMessage = "Error: Required fields missing"; return View(model); diff --git a/BTCPayServer/Rating/RateRules.cs b/BTCPayServer/Rating/RateRules.cs index b7c7f20bc..617a24447 100644 --- a/BTCPayServer/Rating/RateRules.cs +++ b/BTCPayServer/Rating/RateRules.cs @@ -149,9 +149,10 @@ namespace BTCPayServer.Rating (Pair: p, Priority: 0, Inverse: false), (Pair: new CurrencyPair(p.Left, "X"), Priority: 1, Inverse: false), (Pair: new CurrencyPair("X", p.Right), Priority: 1, Inverse: false), - (Pair: new CurrencyPair(invP.Left, "X"), Priority: 2, Inverse: true), - (Pair: new CurrencyPair("X", invP.Right), Priority: 2, Inverse: true), - (Pair: new CurrencyPair("X", "X"), Priority: 3, Inverse: false) + (Pair: invP, Priority: 2, Inverse: true), + (Pair: new CurrencyPair(invP.Left, "X"), Priority: 3, Inverse: true), + (Pair: new CurrencyPair("X", invP.Right), Priority: 3, Inverse: true), + (Pair: new CurrencyPair("X", "X"), Priority: 4, Inverse: false) }) { if (ruleList.ExpressionsByPair.TryGetValue(pair.Pair, out var expression)) diff --git a/BTCPayServer/Services/Mails/EmailSender.cs b/BTCPayServer/Services/Mails/EmailSender.cs index c97c2cbbd..2e51db317 100644 --- a/BTCPayServer/Services/Mails/EmailSender.cs +++ b/BTCPayServer/Services/Mails/EmailSender.cs @@ -24,8 +24,8 @@ namespace BTCPayServer.Services.Mails } public async Task SendEmailAsync(string email, string subject, string message) { - var settings = await _Repository.GetSettingAsync(); - if (settings == null) + var settings = await _Repository.GetSettingAsync() ?? new EmailSettings(); + if (!settings.IsComplete()) { Logs.Configuration.LogWarning("Should have sent email, but email settings are not configured"); return; @@ -36,8 +36,8 @@ namespace BTCPayServer.Services.Mails public async Task SendMailCore(string email, string subject, string message) { - var settings = await _Repository.GetSettingAsync(); - if (settings == null) + var settings = await _Repository.GetSettingAsync() ?? new EmailSettings(); + if (!settings.IsComplete()) throw new InvalidOperationException("Email settings not configured"); var smtp = settings.CreateSmtpClient(); MailMessage mail = new MailMessage(settings.From, email, subject, message); diff --git a/BTCPayServer/Services/Mails/EmailSettings.cs b/BTCPayServer/Services/Mails/EmailSettings.cs index 22840cc36..93b062eec 100644 --- a/BTCPayServer/Services/Mails/EmailSettings.cs +++ b/BTCPayServer/Services/Mails/EmailSettings.cs @@ -40,6 +40,18 @@ namespace BTCPayServer.Services.Mails get; set; } + public bool IsComplete() + { + SmtpClient smtp = null; + try + { + smtp = CreateSmtpClient(); + return true; + } + catch { } + return false; + } + public SmtpClient CreateSmtpClient() { SmtpClient client = new SmtpClient(Server, Port.Value); diff --git a/BTCPayServer/Views/Stores/Rates.cshtml b/BTCPayServer/Views/Stores/Rates.cshtml index 4aca36b81..9a2f7efbc 100644 --- a/BTCPayServer/Views/Stores/Rates.cshtml +++ b/BTCPayServer/Views/Stores/Rates.cshtml @@ -93,7 +93,19 @@ X_X = gdax(X_X); -

With DOGE_USD will be expanded to bittrex(DOGE_BTC) * gdax(BTC_USD). And DOGE_CAD will be expanded to bittrex(DOGE_BTC) * quadrigacx(BTC_CAD)

+

With DOGE_USD will be expanded to bittrex(DOGE_BTC) * gdax(BTC_USD). And DOGE_CAD will be expanded to bittrex(DOGE_BTC) * quadrigacx(BTC_CAD).
+ However, we advise you to write it that way to increase coverage so that DOGE_BTC is also supported:

+
+                        
+                            DOGE_X = DOGE_BTC * BTC_X
+                            DOGE_BTC = bittrex(DOGE_BTC)
+                            X_CAD = quadrigacx(X_CAD);
+                            X_X = gdax(X_X);
+                        
+                    
+

It is worth noting that the inverses of those pairs are automatically supported as well.
+ It means that the rule USD_DOGE = 1 / DOGE_USD implicitely exists.

+