veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
coin.hpp
1// Copyright (c) 2019-2022 Xenios SEZC
2// https://www.veriblock.org
3// Distributed under the MIT software license, see the accompanying
4// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_COIN_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_COIN_HPP_
8
9#include <cstddef>
10#include <cstdint>
11#include <string>
12#include <veriblock/pop/fmt.hpp>
13#include <veriblock/pop/serde.hpp>
14
15namespace altintegration {
16class ValidationState;
17class WriteStream;
18struct ReadStream;
19
21struct Coin {
22 int64_t units{};
23
24 Coin() = default;
25
26 std::string toPrettyString() const;
27
28 explicit Coin(int64_t atomicUnits) : units(atomicUnits) {}
29
34 void toVbkEncoding(WriteStream& stream) const;
35
36 size_t estimateSize() const;
37
43 bool operator==(const Coin& other) const noexcept;
44};
45
48 Coin& out,
49 ValidationState& state);
50
51} // namespace altintegration
52#endif // ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_COIN_HPP_
Class that is used for storing validation state.
Binary writer that is useful for binary serialization.
Defines logging helpers.
Definition: block.hpp:14
bool DeserializeFromVbkEncoding(ReadStream &stream, AltBlockAddon &out, ValidationState &state)
This is an overloaded member function, provided for convenience. It differs from the above function o...
represents VBK atomic units
Definition: coin.hpp:21
void toVbkEncoding(WriteStream &stream) const
Convert Coin to data stream using BtcTx Coin byte format.
bool operator==(const Coin &other) const noexcept
Compare two Coins for equality.
Binary reading stream, that is useful during binary deserialization.
Definition: read_stream.hpp:22