Closed Aniseto closed 11 months ago
Review: int2curr function in Pascal , as node and protocol uses int representation. it's important to use that, not to use Float.
0.01 Noso is: 1000000 Protocol always use integers to represent coins: 1 noso is not 1.00000000 at protocol level, 1 noso = 100000000 coins 234567 will appear as 0.00234567
{Converts a integer in a human readeaeble format for currency}
Function Int2Curr(LValue: int64): string;
Begin
Result := IntTostr(Abs(LValue));
result := AddChar('0',Result, 9);
Insert('.',Result, Length(Result)-7);
If LValue <0 THen Result := '-'+Result;
End;
convert the integer value into a string
if needed, add zeros to the left until the string have 9 chars
Insert the char "." at the position 9 from the rigth.
If the integer was < 0 add the symbol "-"
Solved, using correct format to handle string to int64 and managing "float" values.
Original Wallet NosoWallet from Pascal uses Int64 variable to manage balance, but this type in C++ ( int64_t) is a pure integer, does not support decimals like a Float. So, we need to manage how to read from Sumary File using a default int64_t in C++ and then work like a float to support sending like 0.05 NOSO.