2
0
mirror of synced 2025-01-10 00:25:49 +00:00
2023-09-20 10:51:47 +02:00

31 lines
758 B
C#

using Nethereum.Hex.HexTypes;
using System.Numerics;
namespace NethereumWorkflow
{
public static class ConversionExtensions
{
public static HexBigInteger ToHexBig(this decimal amount)
{
var bigint = ToBig(amount);
var str = bigint.ToString("X");
return new HexBigInteger(str);
}
public static BigInteger ToBig(this decimal amount)
{
return new BigInteger(amount);
}
public static decimal ToDecimal(this HexBigInteger hexBigInteger)
{
return ToDecimal(hexBigInteger.Value);
}
public static decimal ToDecimal(this BigInteger bigInteger)
{
return (decimal)bigInteger;
}
}
}