1
0

Renter allowance changes

This commit is contained in:
Scott E. Graves
2017-03-28 18:35:39 -05:00
parent ffaf818e5f
commit 8d0b76e378
6 changed files with 107 additions and 11 deletions

View File

@@ -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;