veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
pop_payouts.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_POP_REWARDS_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_ENTITIES_POP_REWARDS_HPP_
8
9#include <cstddef>
10#include <cstdint>
11#include <map>
12#include <utility>
13#include <vector>
14
15#include "veriblock/pop/serde.hpp"
16#include "veriblock/pop/validation_state.hpp"
17
18namespace altintegration {
19class ValidationState;
20class WriteStream;
21struct ReadStream;
22
28struct PopPayouts {
29 using payout_info_t = std::vector<uint8_t>;
30 using amount_t = uint64_t;
31
32 std::map<payout_info_t, amount_t> payouts;
33
34 void add(const payout_info_t& address, amount_t amount);
35
36 size_t size() const;
37
38 bool empty() const;
39
40 // explicit cast operator of this struct to std::map
41 explicit operator decltype(payouts)() { return payouts; }
42 auto begin() -> decltype(payouts.begin()) { return payouts.begin(); }
43 auto end() -> decltype(payouts.end()) { return payouts.end(); }
44 auto begin() const -> decltype(payouts.begin()) { return payouts.begin(); }
45 auto end() const -> decltype(payouts.end()) { return payouts.end(); }
46
51 void toVbkEncoding(WriteStream& stream) const;
52
53 friend bool DeserializeFromVbkEncoding(ReadStream& stream,
54 PopPayouts& out,
55 ValidationState& state);
56};
57
58} // namespace altintegration
59
60#endif
Class that is used for storing validation state.
Binary writer that is useful for binary serialization.
Defines logging helpers.
Definition: block.hpp:14
A container for Pop payouts information.
Definition: pop_payouts.hpp:28
void toVbkEncoding(WriteStream &stream) const
Convert PopRewards to data stream.
Binary reading stream, that is useful during binary deserialization.
Definition: read_stream.hpp:22