diff --git a/BTCPayServer.Rating/BTCPayServer.Rating.csproj b/BTCPayServer.Rating/BTCPayServer.Rating.csproj
index 1e842a617..36879e2a2 100644
--- a/BTCPayServer.Rating/BTCPayServer.Rating.csproj
+++ b/BTCPayServer.Rating/BTCPayServer.Rating.csproj
@@ -6,12 +6,14 @@
+
-
+
+
diff --git a/BTCPayServer.Rating/Currencies.json b/BTCPayServer.Rating/Currencies.json
new file mode 100644
index 000000000..6fb8ff8b8
--- /dev/null
+++ b/BTCPayServer.Rating/Currencies.json
@@ -0,0 +1,1276 @@
+[
+ {
+ "name":"Afghani",
+ "code":"AFN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Bitcoin",
+ "code":"BTC",
+ "divisibility":8,
+ "symbol":"₿",
+ "crypto":true
+ },
+ {
+ "name":"Euro",
+ "code":"EUR",
+ "divisibility":2,
+ "symbol":"€",
+ "crypto":false
+ },
+ {
+ "name":"Lek",
+ "code":"ALL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Algerian Dinar",
+ "code":"DZD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"US Dollar",
+ "code":"USD",
+ "divisibility":2,
+ "symbol":"$",
+ "crypto":false
+ },
+ {
+ "name":"Kwanza",
+ "code":"AOA",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"East Caribbean Dollar",
+ "code":"XCD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Argentine Peso",
+ "code":"ARS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Armenian Dram",
+ "code":"AMD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Aruban Florin",
+ "code":"AWG",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Australian Dollar",
+ "code":"AUD",
+ "divisibility":2,
+ "symbol":"A$",
+ "crypto":false
+ },
+ {
+ "name":"Azerbaijanian Manat",
+ "code":"AZN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Bahamian Dollar",
+ "code":"BSD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Bahraini Dinar",
+ "code":"BHD",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Taka",
+ "code":"BDT",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Barbados Dollar",
+ "code":"BBD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Belarusian Ruble",
+ "code":"BYN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Belarusian Ruble",
+ "code":"BYR",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Belize Dollar",
+ "code":"BZD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"CFA Franc BCEAO",
+ "code":"XOF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Bermudian Dollar",
+ "code":"BMD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Indian Rupee",
+ "code":"INR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Ngultrum",
+ "code":"BTN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Boliviano",
+ "code":"BOB",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Mvdol",
+ "code":"BOV",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Convertible Mark",
+ "code":"BAM",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Pula",
+ "code":"BWP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Norwegian Krone",
+ "code":"NOK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Brazilian Real",
+ "code":"BRL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Brunei Dollar",
+ "code":"BND",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Bulgarian Lev",
+ "code":"BGN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Burundi Franc",
+ "code":"BIF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Cabo Verde Escudo",
+ "code":"CVE",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Riel",
+ "code":"KHR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"CFA Franc BEAC",
+ "code":"XAF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Canadian Dollar",
+ "code":"CAD",
+ "divisibility":2,
+ "symbol":"CA$",
+ "crypto":false
+ },
+ {
+ "name":"Cayman Islands Dollar",
+ "code":"KYD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Chilean Peso",
+ "code":"CLP",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Unidad de Fomento",
+ "code":"CLF",
+ "divisibility":4,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Yuan Renminbi",
+ "code":"CNY",
+ "divisibility":2,
+ "symbol":"CN¥",
+ "crypto":false
+ },
+ {
+ "name":"Colombian Peso",
+ "code":"COP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Unidad de Valor Real",
+ "code":"COU",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Comoro Franc",
+ "code":"KMF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Congolese Franc",
+ "code":"CDF",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"New Zealand Dollar",
+ "code":"NZD",
+ "divisibility":2,
+ "symbol":"NZ$",
+ "crypto":false
+ },
+ {
+ "name":"Costa Rican Colon",
+ "code":"CRC",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Kuna",
+ "code":"HRK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Cuban Peso",
+ "code":"CUP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Peso Convertible",
+ "code":"CUC",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Netherlands Antillean Guilder",
+ "code":"ANG",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Czech Koruna",
+ "code":"CZK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Danish Krone",
+ "code":"DKK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Djibouti Franc",
+ "code":"DJF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Dominican Peso",
+ "code":"DOP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Egyptian Pound",
+ "code":"EGP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"El Salvador Colon",
+ "code":"SVC",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Nakfa",
+ "code":"ERN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Ethiopian Birr",
+ "code":"ETB",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"Falkland Islands Pound",
+ "code":"FKP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Fiji Dollar",
+ "code":"FJD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"CFP Franc",
+ "code":"XPF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Dalasi",
+ "code":"GMD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Lari",
+ "code":"GEL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Ghana Cedi",
+ "code":"GHS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Gibraltar Pound",
+ "code":"GIP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Quetzal",
+ "code":"GTQ",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Pound Sterling",
+ "code":"GBP",
+ "divisibility":2,
+ "symbol":"£",
+ "crypto":false
+ },
+ {
+ "name":"Guinea Franc",
+ "code":"GNF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Guyana Dollar",
+ "code":"GYD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Gourde",
+ "code":"HTG",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Lempira",
+ "code":"HNL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Hong Kong Dollar",
+ "code":"HKD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Forint",
+ "code":"HUF",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Iceland Krona",
+ "code":"ISK",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Rupiah",
+ "code":"IDR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Iranian Rial",
+ "code":"IRR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Iraqi Dinar",
+ "code":"IQD",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"New Israeli Sheqel",
+ "code":"ILS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Jamaican Dollar",
+ "code":"JMD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Yen",
+ "code":"JPY",
+ "divisibility":0,
+ "symbol":"¥",
+ "crypto":false
+ },
+ {
+ "name":"Jordanian Dinar",
+ "code":"JOD",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Tenge",
+ "code":"KZT",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Kenyan Shilling",
+ "code":"KES",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"North Korean Won",
+ "code":"KPW",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Won",
+ "code":"KRW",
+ "divisibility":0,
+ "symbol":"₩",
+ "crypto":false
+ },
+ {
+ "name":"Kuwaiti Dinar",
+ "code":"KWD",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Som",
+ "code":"KGS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Kip",
+ "code":"LAK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Lebanese Pound",
+ "code":"LBP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Loti",
+ "code":"LSL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Rand",
+ "code":"ZAR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Liberian Dollar",
+ "code":"LRD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Libyan Dinar",
+ "code":"LYD",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Swiss Franc",
+ "code":"CHF",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Pataca",
+ "code":"MOP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Denar",
+ "code":"MKD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Malagasy Ariary",
+ "code":"MGA",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Malawi Kwacha",
+ "code":"MWK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Malaysian Ringgit",
+ "code":"MYR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Rufiyaa",
+ "code":"MVR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Ouguiya",
+ "code":"MRO",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Mauritius Rupee",
+ "code":"MUR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Mexican Peso",
+ "code":"MXN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Mexican Unidad de Inversion (UDI)",
+ "code":"MXV",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Moldovan Leu",
+ "code":"MDL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Tugrik",
+ "code":"MNT",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Moroccan Dirham",
+ "code":"MAD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Mozambique Metical",
+ "code":"MZN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Kyat",
+ "code":"MMK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Namibia Dollar",
+ "code":"NAD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Nepalese Rupee",
+ "code":"NPR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Cordoba Oro",
+ "code":"NIO",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Naira",
+ "code":"NGN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Rial Omani",
+ "code":"OMR",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Pakistan Rupee",
+ "code":"PKR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Balboa",
+ "code":"PAB",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Kina",
+ "code":"PGK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Guarani",
+ "code":"PYG",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Sol",
+ "code":"PEN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Philippine Peso",
+ "code":"PHP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Zloty",
+ "code":"PLN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Qatari Rial",
+ "code":"QAR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Romanian Leu",
+ "code":"RON",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Russian Ruble",
+ "code":"RUB",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Rwanda Franc",
+ "code":"RWF",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Saint Helena Pound",
+ "code":"SHP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Tala",
+ "code":"WST",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Dobra",
+ "code":"STD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Saudi Riyal",
+ "code":"SAR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Serbian Dinar",
+ "code":"RSD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Seychelles Rupee",
+ "code":"SCR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Leone",
+ "code":"SLL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Singapore Dollar",
+ "code":"SGD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Solomon Islands Dollar",
+ "code":"SBD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Somali Shilling",
+ "code":"SOS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"South Sudanese Pound",
+ "code":"SSP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Sri Lanka Rupee",
+ "code":"LKR",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Sudanese Pound",
+ "code":"SDG",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Surinam Dollar",
+ "code":"SRD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Lilangeni",
+ "code":"SZL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Swedish Krona",
+ "code":"SEK",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"WIR Euro",
+ "code":"CHE",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"WIR Franc",
+ "code":"CHW",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Syrian Pound",
+ "code":"SYP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"New Taiwan Dollar",
+ "code":"TWD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Somoni",
+ "code":"TJS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Tanzanian Shilling",
+ "code":"TZS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Baht",
+ "code":"THB",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Pa’anga",
+ "code":"TOP",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Trinidad and Tobago Dollar",
+ "code":"TTD",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Tunisian Dinar",
+ "code":"TND",
+ "divisibility":3,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Turkish Lira",
+ "code":"TRY",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Turkmenistan New Manat",
+ "code":"TMT",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Uganda Shilling",
+ "code":"UGX",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Hryvnia",
+ "code":"UAH",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"UAE Dirham",
+ "code":"AED",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"US Dollar (Next day)",
+ "code":"USN",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Peso Uruguayo",
+ "code":"UYU",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Uruguay Peso en Unidades Indexadas (URUIURUI)",
+ "code":"UYI",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Uzbekistan Sum",
+ "code":"UZS",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Vatu",
+ "code":"VUV",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Bolívar",
+ "code":"VEF",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Dong",
+ "code":"VND",
+ "divisibility":0,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Yemeni Rial",
+ "code":"YER",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Zambian Kwacha",
+ "code":"ZMW",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"Zimbabwe Dollar",
+ "code":"ZWL",
+ "divisibility":2,
+ "symbol":null,
+ "crypto":false
+ },
+ {
+ "name":"LBTC",
+ "code":"LBTC",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"USDt",
+ "code":"USDT",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"LCAD",
+ "code":"LCAD",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"LTC",
+ "code":"LTC",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"BTX",
+ "code":"BTX",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"DOGE",
+ "code":"DOGE",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"BTG",
+ "code":"BTG",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"MONA",
+ "code":"MONA",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"DASH",
+ "code":"DASH",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"FTC",
+ "code":"FTC",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"GRS",
+ "code":"GRS",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"VIA",
+ "code":"VIA",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"XMR",
+ "code":"XMR",
+ "divisibility":12,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"POLIS",
+ "code":"POLIS",
+ "divisibility":8,
+ "symbol":null,
+ "crypto":true
+ },
+ {
+ "name":"Satoshis",
+ "code":"SATS",
+ "divisibility":0,
+ "symbol":"Sats",
+ "crypto":true
+ }
+]
diff --git a/BTCPayServer/Services/Rates/CurrencyNameTable.cs b/BTCPayServer.Rating/CurrencyNameTable.cs
similarity index 68%
rename from BTCPayServer/Services/Rates/CurrencyNameTable.cs
rename to BTCPayServer.Rating/CurrencyNameTable.cs
index d35f0ca8e..cd15846e0 100644
--- a/BTCPayServer/Services/Rates/CurrencyNameTable.cs
+++ b/BTCPayServer.Rating/CurrencyNameTable.cs
@@ -6,35 +6,22 @@ using System.Reflection;
using System.Linq;
using System.Text;
using System.Globalization;
+using BTCPayServer.Rating;
+using Newtonsoft.Json;
namespace BTCPayServer.Services.Rates
{
public class CurrencyData
{
- public string Name
- {
- get;
- internal set;
- }
- public string Code
- {
- get;
- internal set;
- }
- public int Divisibility
- {
- get;
- internal set;
- }
- public string Symbol
- {
- get;
- internal set;
- }
+ public string Name { get; set; }
+ public string Code { get; set; }
+ public int Divisibility { get; set; }
+ public string Symbol { get; set; }
public bool Crypto { get; set; }
}
public class CurrencyNameTable
{
+ public static CurrencyNameTable Instance = new CurrencyNameTable();
public CurrencyNameTable()
{
_Currencies = LoadCurrency().ToDictionary(k => k.Code);
@@ -94,16 +81,10 @@ namespace BTCPayServer.Services.Rates
catch { }
}
- foreach (var network in new BTCPayNetworkProvider(NetworkType.Mainnet).GetAll())
+ foreach (var curr in _Currencies.Where(pair => pair.Value.Crypto))
{
- AddCurrency(_CurrencyProviders, network.CryptoCode, network.Divisibility, network.CryptoCode);
+ AddCurrency(_CurrencyProviders, curr.Key, curr.Value.Divisibility, curr.Value.Symbol?? curr.Value.Code);
}
-
- _CurrencyProviders.TryAdd("SATS",
- new NumberFormatInfo()
- {
- CurrencySymbol = "sats", CurrencyDecimalDigits = 0, CurrencyPositivePattern = 3
- });
}
return _CurrencyProviders.TryGet(currency.ToUpperInvariant());
}
@@ -153,58 +134,15 @@ namespace BTCPayServer.Services.Rates
static CurrencyData[] LoadCurrency()
{
- var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BTCPayServer.Currencies.txt");
+ var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BTCPayServer.Rating.Currencies.json");
string content = null;
using (var reader = new StreamReader(stream, Encoding.UTF8))
{
content = reader.ReadToEnd();
}
- var currencies = content.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
- Dictionary dico = new Dictionary();
- foreach (var currency in currencies)
- {
- var splitted = currency.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
- if (splitted.Length < 3)
- continue;
- CurrencyData info = new CurrencyData();
- info.Name = splitted[0];
- info.Code = splitted[1];
- int divisibility;
- if (!int.TryParse(splitted[2], out divisibility))
- continue;
- info.Divisibility = divisibility;
- if (!dico.ContainsKey(info.Code))
- dico.Add(info.Code, info);
- if (splitted.Length >= 4)
- {
- info.Symbol = splitted[3];
- }
- }
- foreach (var network in new BTCPayNetworkProvider(NetworkType.Mainnet).GetAll())
- {
- if (!dico.TryAdd(network.CryptoCode, new CurrencyData()
- {
- Code = network.CryptoCode,
- Divisibility = network.Divisibility,
- Name = network.CryptoCode,
- Crypto = true
- }))
- {
- dico[network.CryptoCode].Crypto = true;
- }
- }
-
- dico.TryAdd("SATS", new CurrencyData()
- {
- Code = "SATS",
- Crypto = true,
- Divisibility = 0,
- Name = "Satoshis",
- Symbol = "Sats",
- });
-
- return dico.Values.ToArray();
+ var currencies = JsonConvert.DeserializeObject(content);
+ return currencies;
}
public CurrencyData GetCurrencyData(string currency, bool useFallback)
diff --git a/BTCPayServer.Rating/CurrencyPair.cs b/BTCPayServer.Rating/CurrencyPair.cs
index 5307331e1..4fd656d45 100644
--- a/BTCPayServer.Rating/CurrencyPair.cs
+++ b/BTCPayServer.Rating/CurrencyPair.cs
@@ -1,10 +1,10 @@
using System;
+using BTCPayServer.Services.Rates;
namespace BTCPayServer.Rating
{
public class CurrencyPair
{
- static readonly BTCPayNetworkProvider _NetworkProvider = new BTCPayNetworkProvider(NBitcoin.NetworkType.Mainnet);
public CurrencyPair(string left, string right)
{
if (right == null)
@@ -47,13 +47,14 @@ namespace BTCPayServer.Rating
value = new CurrencyPair(currencyPair.Substring(0,3), currencyPair.Substring(3, 3));
return true;
}
+
for (int i = 3; i < 5; i++)
{
var potentialCryptoName = currencyPair.Substring(0, i);
- var network = _NetworkProvider.GetNetwork(potentialCryptoName);
- if (network != null)
+ var currency = CurrencyNameTable.Instance.GetCurrencyData(potentialCryptoName, false);
+ if (currency != null)
{
- value = new CurrencyPair(network.CryptoCode, currencyPair.Substring(i));
+ value = new CurrencyPair(currency.Code, currencyPair.Substring(i));
return true;
}
}
diff --git a/BTCPayServer.Rating/Extensions.cs b/BTCPayServer.Rating/Extensions.cs
new file mode 100644
index 000000000..c833c3d5c
--- /dev/null
+++ b/BTCPayServer.Rating/Extensions.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace BTCPayServer.Rating
+{
+ public static class Extensions
+ {
+ public static decimal RoundToSignificant(this decimal value, ref int divisibility)
+ {
+ if (value != 0m)
+ {
+ while (true)
+ {
+ var rounded = decimal.Round(value, divisibility, MidpointRounding.AwayFromZero);
+ if ((Math.Abs(rounded - value) / value) < 0.001m)
+ {
+ value = rounded;
+ break;
+ }
+ divisibility++;
+ }
+ }
+ return value;
+ }
+ }
+}
diff --git a/BTCPayServer.Common/MultiValueDictionary.cs b/BTCPayServer.Rating/MultiValueDictionary.cs
similarity index 100%
rename from BTCPayServer.Common/MultiValueDictionary.cs
rename to BTCPayServer.Rating/MultiValueDictionary.cs
diff --git a/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs b/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs
index e9b6f023f..ebb6c0076 100644
--- a/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs
+++ b/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs
@@ -1,13 +1,10 @@
using System;
-using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using BTCPayServer.Rating;
using System.Threading;
-using Microsoft.Extensions.Logging.Abstractions;
-using BTCPayServer.Logging;
using Newtonsoft.Json;
using System.Reflection;
using System.Globalization;
diff --git a/BTCPayServer.Rating/RateRules.cs b/BTCPayServer.Rating/RateRules.cs
index c91c90d77..8d3394f6b 100644
--- a/BTCPayServer.Rating/RateRules.cs
+++ b/BTCPayServer.Rating/RateRules.cs
@@ -530,7 +530,10 @@ namespace BTCPayServer.Rating
var rewriter = new ReplaceExchangeRateRewriter();
rewriter.Rates = ExchangeRates;
var result = rewriter.Visit(this.expression);
- Errors.AddRange(rewriter.Errors);
+ foreach (var item in rewriter.Errors)
+ {
+ Errors.Add(item);
+ }
_Evaluated = result.NormalizeWhitespace("", "\n").ToString();
if (HasError)
return false;
@@ -539,7 +542,10 @@ namespace BTCPayServer.Rating
calculate.Visit(result);
if (calculate.Values.Count != 1 || calculate.Errors.Count != 0)
{
- Errors.AddRange(calculate.Errors);
+ foreach (var item in calculate.Errors)
+ {
+ Errors.Add(item);
+ }
return false;
}
_BidAsk = calculate.Values.Pop();
diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs
index 13b67c25e..4e0acf2f6 100644
--- a/BTCPayServer.Tests/UnitTest1.cs
+++ b/BTCPayServer.Tests/UnitTest1.cs
@@ -632,7 +632,7 @@ namespace BTCPayServer.Tests
(1000.0001m, "₹ 1,000.00 (INR)", "INR")
})
{
- var actual = new CurrencyNameTable().DisplayFormatCurrency(test.Item1, test.Item3);
+ var actual = CurrencyNameTable.Instance.DisplayFormatCurrency(test.Item1, test.Item3);
actual = actual.Replace("¥", "¥"); // Hack so JPY test pass on linux as well
Assert.Equal(test.Item2, actual);
}
@@ -1909,6 +1909,20 @@ namespace BTCPayServer.Tests
Assert.Empty(invoice.CryptoInfo.Where(c => c.CryptoCode == "LTC"));
}
}
+
+ [Fact]
+ [Trait("Fast", "Fast")]
+ public void HasCurrencyDataForNetworks()
+ {
+ var btcPayNetworkProvider = new BTCPayNetworkProvider(NetworkType.Regtest);
+ foreach (var network in btcPayNetworkProvider.GetAll())
+ {
+ var cd = CurrencyNameTable.Instance.GetCurrencyData(network.CryptoCode, false);
+ Assert.NotNull(cd);
+ Assert.Equal(network.Divisibility, cd.Divisibility);
+ Assert.True(cd.Crypto);
+ }
+ }
[Fact]
[Trait("Fast", "Fast")]
@@ -2363,7 +2377,7 @@ donation:
ExpectedThousandSeparator: ",", ExpectedPrefixed: true, ExpectedSymbolSpace: true),
(Code: "JPY", ExpectedSymbol: "¥", ExpectedDecimalSeparator: ".", ExpectedDivisibility: 0,
ExpectedThousandSeparator: ",", ExpectedPrefixed: true, ExpectedSymbolSpace: false),
- (Code: "BTC", ExpectedSymbol: "BTC", ExpectedDecimalSeparator: ".", ExpectedDivisibility: 8,
+ (Code: "BTC", ExpectedSymbol: "₿", ExpectedDecimalSeparator: ".", ExpectedDivisibility: 8,
ExpectedThousandSeparator: ",", ExpectedPrefixed: false, ExpectedSymbolSpace: true),
})
{
diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj
index 2580501bd..432836b81 100644
--- a/BTCPayServer/BTCPayServer.csproj
+++ b/BTCPayServer/BTCPayServer.csproj
@@ -27,7 +27,6 @@
-
diff --git a/BTCPayServer/Currencies.txt b/BTCPayServer/Currencies.txt
deleted file mode 100644
index 8179b2fdc..000000000
--- a/BTCPayServer/Currencies.txt
+++ /dev/null
@@ -1,270 +0,0 @@
-Afghani AFN 2
-Bitcoin BTC 8 Ƀ
-Euro EUR 2 €
-Lek ALL 2
-Algerian Dinar DZD 2
-US Dollar USD 2 $
-Euro EUR 2
-Kwanza AOA 2
-East Caribbean Dollar XCD 2
-No universal currency
-East Caribbean Dollar XCD 2
-Argentine Peso ARS 2
-Armenian Dram AMD 2
-Aruban Florin AWG 2
-Australian Dollar AUD 2 A$
-Euro EUR 2
-Azerbaijanian Manat AZN 2
-Bahamian Dollar BSD 2
-Bahraini Dinar BHD 3
-Taka BDT 2
-Barbados Dollar BBD 2
-Belarusian Ruble BYN 2
-Belarusian Ruble BYR 0
-Euro EUR 2
-Belize Dollar BZD 2
-CFA Franc BCEAO XOF 0
-Bermudian Dollar BMD 2
-Indian Rupee INR 2
-Ngultrum BTN 2
-Boliviano BOB 2
-Mvdol BOV 2
-US Dollar USD 2
-Convertible Mark BAM 2
-Pula BWP 2
-Norwegian Krone NOK 2
-Brazilian Real BRL 2
-US Dollar USD 2
-Brunei Dollar BND 2
-Bulgarian Lev BGN 2
-CFA Franc BCEAO XOF 0
-Burundi Franc BIF 0
-Cabo Verde Escudo CVE 2
-Riel KHR 2
-CFA Franc BEAC XAF 0
-Canadian Dollar CAD 2 CA$
-Cayman Islands Dollar KYD 2
-CFA Franc BEAC XAF 0
-CFA Franc BEAC XAF 0
-Chilean Peso CLP 0
-Unidad de Fomento CLF 4
-Yuan Renminbi CNY 2 CN¥
-Australian Dollar AUD 2 A$
-Colombian Peso COP 2
-Unidad de Valor Real COU 2
-Comoro Franc KMF 0
-Congolese Franc CDF 2
-CFA Franc BEAC XAF 0
-New Zealand Dollar NZD 2 NZ$
-Costa Rican Colon CRC 2
-CFA Franc BCEAO XOF 0
-Kuna HRK 2
-Cuban Peso CUP 2
-Peso Convertible CUC 2
-Netherlands Antillean Guilder ANG 2
-Euro EUR 2
-Czech Koruna CZK 2
-Danish Krone DKK 2
-Djibouti Franc DJF 0
-East Caribbean Dollar XCD 2
-Dominican Peso DOP 2
-US Dollar USD 2
-Egyptian Pound EGP 2
-El Salvador Colon SVC 2
-US Dollar USD 2
-CFA Franc BEAC XAF 0
-Nakfa ERN 2
-Euro EUR 2
-Ethiopian Birr ETB 2
-Euro EUR 2
-Falkland Islands Pound FKP 2
-Danish Krone DKK 2
-Fiji Dollar FJD 2
-Euro EUR 2
-Euro EUR 2
-Euro EUR 2
-CFP Franc XPF 0
-Euro EUR 2
-CFA Franc BEAC XAF 0
-Dalasi GMD 2
-Lari GEL 2
-Euro EUR 2
-Ghana Cedi GHS 2
-Gibraltar Pound GIP 2
-Euro EUR 2
-Danish Krone DKK 2
-East Caribbean Dollar XCD 2
-Euro EUR 2
-US Dollar USD 2
-Quetzal GTQ 2
-Pound Sterling GBP 2 £
-Guinea Franc GNF 0
-CFA Franc BCEAO XOF 0
-Guyana Dollar GYD 2
-Gourde HTG 2
-US Dollar USD 2
-Australian Dollar AUD 2
-Euro EUR 2
-Lempira HNL 2
-Hong Kong Dollar HKD 2
-Forint HUF 2
-Iceland Krona ISK 0
-Indian Rupee INR 2
-Rupiah IDR 2
-SDR (Special Drawing Right) XDR N.A.
-Iranian Rial IRR 2
-Iraqi Dinar IQD 3
-Euro EUR 2
-Pound Sterling GBP 2
-New Israeli Sheqel ILS 2
-Euro EUR 2
-Jamaican Dollar JMD 2
-Yen JPY 0 ¥
-Pound Sterling GBP 2
-Jordanian Dinar JOD 3
-Tenge KZT 2
-Kenyan Shilling KES 2
-Australian Dollar AUD 2
-North Korean Won KPW 2
-Won KRW 0 ₩
-Kuwaiti Dinar KWD 3
-Som KGS 2
-Kip LAK 2
-Euro EUR 2
-Lebanese Pound LBP 2
-Loti LSL 2
-Rand ZAR 2
-Liberian Dollar LRD 2
-Libyan Dinar LYD 3
-Swiss Franc CHF 2
-Euro EUR 2
-Euro EUR 2
-Pataca MOP 2
-Denar MKD 2
-Malagasy Ariary MGA 2
-Malawi Kwacha MWK 2
-Malaysian Ringgit MYR 2
-Rufiyaa MVR 2
-CFA Franc BCEAO XOF 0
-Euro EUR 2
-US Dollar USD 2
-Euro EUR 2
-Ouguiya MRO 2
-Mauritius Rupee MUR 2
-Euro EUR 2
-ADB Unit of Account XUA N.A.
-Mexican Peso MXN 2
-Mexican Unidad de Inversion (UDI) MXV 2
-US Dollar USD 2
-Moldovan Leu MDL 2
-Euro EUR 2
-Tugrik MNT 2
-Euro EUR 2
-East Caribbean Dollar XCD 2
-Moroccan Dirham MAD 2
-Mozambique Metical MZN 2
-Kyat MMK 2
-Namibia Dollar NAD 2
-Rand ZAR 2
-Australian Dollar AUD 2
-Nepalese Rupee NPR 2
-Euro EUR 2
-CFP Franc XPF 0
-New Zealand Dollar NZD 2
-Cordoba Oro NIO 2
-CFA Franc BCEAO XOF 0
-Naira NGN 2
-New Zealand Dollar NZD 2
-Australian Dollar AUD 2
-US Dollar USD 2
-Norwegian Krone NOK 2
-Rial Omani OMR 3
-Pakistan Rupee PKR 2
-US Dollar USD 2
-No universal currency
-Balboa PAB 2
-US Dollar USD 2
-Kina PGK 2
-Guarani PYG 0
-Sol PEN 2
-Philippine Peso PHP 2
-New Zealand Dollar NZD 2
-Zloty PLN 2
-Euro EUR 2
-US Dollar USD 2
-Qatari Rial QAR 2
-Euro EUR 2
-Romanian Leu RON 2
-Russian Ruble RUB 2
-Rwanda Franc RWF 0
-Euro EUR 2
-Saint Helena Pound SHP 2
-East Caribbean Dollar XCD 2
-East Caribbean Dollar XCD 2
-Euro EUR 2
-Euro EUR 2
-East Caribbean Dollar XCD 2
-Tala WST 2
-Euro EUR 2
-Dobra STD 2
-Saudi Riyal SAR 2
-CFA Franc BCEAO XOF 0
-Serbian Dinar RSD 2
-Seychelles Rupee SCR 2
-Leone SLL 2
-Singapore Dollar SGD 2
-Netherlands Antillean Guilder ANG 2
-Sucre XSU N.A.
-Euro EUR 2
-Euro EUR 2
-Solomon Islands Dollar SBD 2
-Somali Shilling SOS 2
-Rand ZAR 2
-No universal currency
-South Sudanese Pound SSP 2
-Euro EUR 2
-Sri Lanka Rupee LKR 2
-Sudanese Pound SDG 2
-Surinam Dollar SRD 2
-Norwegian Krone NOK 2
-Lilangeni SZL 2
-Swedish Krona SEK 2
-Swiss Franc CHF 2
-WIR Euro CHE 2
-WIR Franc CHW 2
-Syrian Pound SYP 2
-New Taiwan Dollar TWD 2
-Somoni TJS 2
-Tanzanian Shilling TZS 2
-Baht THB 2
-US Dollar USD 2
-CFA Franc BCEAO XOF 0
-New Zealand Dollar NZD 2
-Pa’anga TOP 2
-Trinidad and Tobago Dollar TTD 2
-Tunisian Dinar TND 3
-Turkish Lira TRY 2
-Turkmenistan New Manat TMT 2
-US Dollar USD 2
-Australian Dollar AUD 2
-Uganda Shilling UGX 0
-Hryvnia UAH 2
-UAE Dirham AED 2
-Pound Sterling GBP 2
-US Dollar USD 2
-US Dollar USD 2
-US Dollar (Next day) USN 2
-Peso Uruguayo UYU 2
-Uruguay Peso en Unidades Indexadas (URUIURUI) UYI 0
-Uzbekistan Sum UZS 2
-Vatu VUV 0
-Bolívar VEF 2
-Dong VND 0
-US Dollar USD 2
-US Dollar USD 2
-CFP Franc XPF 0
-Moroccan Dirham MAD 2
-Yemeni Rial YER 2
-Zambian Kwacha ZMW 2
-Zimbabwe Dollar ZWL 2
-Indonesian Rupiah RP 2
diff --git a/BTCPayServer/CurrencyValue.cs b/BTCPayServer/CurrencyValue.cs
index e8b221e09..a9f1ce5ca 100644
--- a/BTCPayServer/CurrencyValue.cs
+++ b/BTCPayServer/CurrencyValue.cs
@@ -11,7 +11,6 @@ namespace BTCPayServer
public class CurrencyValue
{
static Regex _Regex = new Regex("^([0-9]+(\\.[0-9]+)?)\\s*([a-zA-Z]+)$");
- static CurrencyNameTable _CurrencyTable = new CurrencyNameTable();
public static bool TryParse(string str, out CurrencyValue value)
{
value = null;
@@ -21,7 +20,7 @@ namespace BTCPayServer
return false;
var currency = match.Groups[match.Groups.Count - 1].Value.ToUpperInvariant();
- var currencyData = _CurrencyTable.GetCurrencyData(currency, false);
+ var currencyData = CurrencyNameTable.Instance.GetCurrencyData(currency, false);
if (currencyData == null)
return false;
v = Math.Round(v, currencyData.Divisibility);
diff --git a/BTCPayServer/Events/InvoiceIPNEvent.cs b/BTCPayServer/Events/InvoiceIPNEvent.cs
index c2d97de7d..aa6c0007c 100644
--- a/BTCPayServer/Events/InvoiceIPNEvent.cs
+++ b/BTCPayServer/Events/InvoiceIPNEvent.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
diff --git a/BTCPayServer/Extensions.cs b/BTCPayServer/Extensions.cs
index a5ab20210..ca7ac82ed 100644
--- a/BTCPayServer/Extensions.cs
+++ b/BTCPayServer/Extensions.cs
@@ -103,23 +103,6 @@ namespace BTCPayServer
}
return value;
}
- public static decimal RoundToSignificant(this decimal value, ref int divisibility)
- {
- if (value != 0m)
- {
- while (true)
- {
- var rounded = decimal.Round(value, divisibility, MidpointRounding.AwayFromZero);
- if ((Math.Abs(rounded - value) / value) < 0.001m)
- {
- value = rounded;
- break;
- }
- divisibility++;
- }
- }
- return value;
- }
public static bool HasStatusMessage(this ITempDataDictionary tempData)
{
diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs
index 2e7733363..4290b56be 100644
--- a/BTCPayServer/Hosting/BTCPayServerServices.cs
+++ b/BTCPayServer/Hosting/BTCPayServerServices.cs
@@ -171,7 +171,7 @@ namespace BTCPayServer.Hosting
services.TryAddSingleton();
services.TryAddSingleton();
services.TryAddSingleton();
- services.TryAddSingleton();
+ services.TryAddSingleton(CurrencyNameTable.Instance);
services.TryAddSingleton(o => new NBXplorerFeeProviderFactory(o.GetRequiredService())
{
Fallback = new FeeRate(100L, 1)