Renter allowance changes
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
#ifndef _SIACOMMON_H
|
||||
#define _SIACOMMON_H
|
||||
#include <cstdint>
|
||||
|
||||
#define SIDRIVE_VERSION_STRING "0.0.1"
|
||||
#define COMPAT_SIAD_VERSION "1.1.2"
|
||||
|
||||
const std::uint8_t SIA_BLOCKS_PER_MIN = 10;
|
||||
const std::uint32_t MINUTES_PER_MONTH = (730 * 60);
|
||||
const std::uint32_t SIA_BLOCKS_PER_MONTH = MINUTES_PER_MONTH / SIA_BLOCKS_PER_MIN;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Disable DLL-interface warnings
|
||||
#pragma warning(disable: 4251)
|
||||
#pragma warning(disable: 4275)
|
||||
|
||||
// Unicode for Win32
|
||||
#define UNICODE
|
||||
@@ -110,6 +116,7 @@ inline bool ApiSuccess(const T& t) {
|
||||
|
||||
typedef ttmath::UInt<256> Hastings;
|
||||
typedef ttmath::Big<1, 30> SiaCurrency;
|
||||
|
||||
/*
|
||||
BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
|
||||
BigNumber.config({ DECIMAL_PLACES: 30 })
|
||||
@@ -121,7 +128,7 @@ const hastingsToSiacoins = (hastings) => new BigNumber(hastings).dividedBy(hasti
|
||||
inline static SiaCurrency HastingsStringToSiaCurrency(const SString& value)
|
||||
{
|
||||
ttmath::Parser<SiaCurrency> parser;
|
||||
parser.Parse((value + " / (10^24)").str());
|
||||
parser.Parse((value + " / (10 ^ 24)").str());
|
||||
return parser.stack[0].value;
|
||||
}
|
||||
|
||||
@@ -134,6 +141,17 @@ inline static SString SiaCurrencyToString(const SiaCurrency& value)
|
||||
return value.ToWString(conv);
|
||||
}
|
||||
|
||||
inline static SString SiaCurrencyToHastingsString(const SiaCurrency& value)
|
||||
{
|
||||
ttmath::Parser<SiaCurrency> parser;
|
||||
parser.Parse(value.ToString() + " * (10 ^ 24)");
|
||||
|
||||
ttmath::Conv conv;
|
||||
conv.base = 10;
|
||||
conv.round = 0;
|
||||
return parser.stack[0].value.ToWString(conv);
|
||||
}
|
||||
|
||||
inline static SString SiaCurrencyToGB(const SiaCurrency& value)
|
||||
{
|
||||
ttmath::Conv conv;
|
||||
|
Reference in New Issue
Block a user