2019-09-30 10:32:43 +02:00
|
|
|
using System.Globalization;
|
|
|
|
|
2019-10-02 22:41:53 -05:00
|
|
|
namespace BTCPayServer.Services.Altcoins.Monero.Utils
|
2019-09-30 10:32:43 +02:00
|
|
|
{
|
|
|
|
public class MoneroMoney
|
|
|
|
{
|
2019-11-07 18:41:10 +01:00
|
|
|
public static decimal Convert(long piconero)
|
2019-09-30 10:32:43 +02:00
|
|
|
{
|
2019-11-07 18:41:10 +01:00
|
|
|
var amt = piconero.ToString(CultureInfo.InvariantCulture).PadLeft(12, '0');
|
2019-09-30 10:32:43 +02:00
|
|
|
amt = amt.Length == 12 ? $"0.{amt}" : amt.Insert(amt.Length - 12, ".");
|
|
|
|
|
|
|
|
return decimal.Parse(amt, CultureInfo.InvariantCulture);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static long Convert(decimal monero)
|
|
|
|
{
|
2019-11-07 18:41:10 +01:00
|
|
|
return System.Convert.ToInt64(monero * 1000000000000);
|
2019-09-30 10:32:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|