mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-26 23:49:57 +01:00
20 lines
582 B
C#
20 lines
582 B
C#
using System.Globalization;
|
|
|
|
namespace BTCPayServer.Services.Altcoins.Monero.Utils
|
|
{
|
|
public class MoneroMoney
|
|
{
|
|
public static decimal Convert(long piconero)
|
|
{
|
|
var amt = piconero.ToString(CultureInfo.InvariantCulture).PadLeft(12, '0');
|
|
amt = amt.Length == 12 ? $"0.{amt}" : amt.Insert(amt.Length - 12, ".");
|
|
|
|
return decimal.Parse(amt, CultureInfo.InvariantCulture);
|
|
}
|
|
|
|
public static long Convert(decimal monero)
|
|
{
|
|
return System.Convert.ToInt64(monero * 1000000000000);
|
|
}
|
|
}
|
|
}
|