mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
🐛 forgot to add files
This commit is contained in:
parent
ac24bca5d9
commit
666258519a
2 changed files with 43 additions and 0 deletions
14
include/log.hpp
Normal file
14
include/log.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
#include <array>
|
||||||
|
#include <algorithm>
|
||||||
|
#include "transactions.hpp"
|
||||||
|
|
||||||
|
struct Log
|
||||||
|
{
|
||||||
|
std::array<Transaction, 100> data;
|
||||||
|
void AddTrans(const Transaction &v)
|
||||||
|
{
|
||||||
|
std::rotate(data.begin(), data.begin() + 1, data.end());
|
||||||
|
data[99] = std::move(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
29
include/transactions.hpp
Normal file
29
include/transactions.hpp
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
struct Transaction
|
||||||
|
{
|
||||||
|
std::string from = "", to = "";
|
||||||
|
uint32_t amount = 0;
|
||||||
|
bool recieving = false;
|
||||||
|
|
||||||
|
void Concatinate(std::string &s)
|
||||||
|
{
|
||||||
|
if (s.size() > 10)
|
||||||
|
{
|
||||||
|
s.resize(10);
|
||||||
|
s[7] = '.';
|
||||||
|
s[8] = '.';
|
||||||
|
s[9] = '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Transaction() = default;
|
||||||
|
Transaction(std::string from_str, std::string to_str, uint32_t amount, bool recieving) : amount(amount), recieving(recieving)
|
||||||
|
{
|
||||||
|
Concatinate(from_str);
|
||||||
|
Concatinate(to_str);
|
||||||
|
from = std::move(from_str);
|
||||||
|
to = std::move(to_str);
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in a new issue