veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
poprewards_params.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_REWARDS_POPREWARDS_PARAMS_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_REWARDS_POPREWARDS_PARAMS_HPP_
8
9#include <vector>
10#include <veriblock/pop/arith_uint256.hpp>
11#include <veriblock/pop/rewards/poprewards_bigdecimal.hpp>
12
13namespace altintegration {
14
19 virtual ~PopRewardsCurveParams() = default;
20
21 // we start decreasing rewards after this score
22 virtual PopRewardsBigDecimal startOfSlope() const noexcept { return 1.0; }
23
24 // we decrease reward coefficient for this value for
25 // each additional score point above startOfDecreasingLine
26 virtual PopRewardsBigDecimal slopeNormal() const noexcept { return 0.2; }
27
28 virtual PopRewardsBigDecimal slopeKeystone() const noexcept {
29 return 0.21325;
30 }
31};
32
37 virtual ~PopRewardsParams() = default;
38
39 virtual uint32_t keystoneRound() const noexcept { return 3; }
40
41 virtual uint32_t payoutRounds() const noexcept { return 4; }
42
43 virtual uint32_t flatScoreRound() const noexcept { return 2; }
44
45 virtual bool flatScoreRoundUse() const noexcept { return true; }
46
47 virtual std::vector<PopRewardsBigDecimal> roundRatios() const noexcept {
48 return {0.97, 1.03, 1.07, 3.00};
49 }
50
51 virtual PopRewardsBigDecimal maxScoreThresholdNormal() const noexcept {
52 return 2.0;
53 }
54
55 virtual PopRewardsBigDecimal maxScoreThresholdKeystone() const noexcept {
56 return 3.0;
57 }
58
59 virtual uint32_t difficultyAveragingInterval() const noexcept { return 50; }
60
61 virtual uint32_t rewardSettlementInterval() const noexcept { return 400; }
62
63 virtual const PopRewardsCurveParams& getCurveParams() const noexcept {
64 return curveParms;
65 }
66
67 // reward score table
68 // we score each VeriBlock and lower the reward for late blocks
69 virtual std::vector<PopRewardsBigDecimal> relativeScoreLookupTable()
70 const noexcept {
71 return {1.00000000, 1.00000000, 1.00000000, 1.00000000, 1.00000000,
72 1.00000000, 1.00000000, 1.00000000, 1.00000000, 1.00000000,
73 1.00000000, 1.00000000, 0.48296816, 0.31551694, 0.23325824,
74 0.18453616, 0.15238463, 0.12961255, 0.11265630, 0.09955094,
75 0.08912509, 0.08063761, 0.07359692, 0.06766428, 0.06259873,
76 0.05822428, 0.05440941, 0.05105386, 0.04807993, 0.04542644,
77 0.04304458, 0.04089495, 0.03894540, 0.03716941, 0.03554497,
78 0.03405359, 0.03267969, 0.03141000, 0.03023319, 0.02913950,
79 0.02812047, 0.02716878, 0.02627801, 0.02544253, 0.02465739,
80 0.02391820, 0.02322107, 0.02256255, 0.02193952, 0.02134922};
81 }
82
83 protected:
84 PopRewardsCurveParams curveParms{};
85};
86
87} // namespace altintegration
88
89#endif // ALT_INTEGRATION_INCLUDE_VERIBLOCK_REWARDS_POPREWARDS_PARAMS_HPP_
Defines logging helpers.
Definition: block.hpp:14
A container for curve params.
A container for PoP rewards params.