Update block rewards as per LRC-7

This commit is contained in:
Jason Rhinelander 2020-09-18 19:03:58 -03:00
parent caf5e59984
commit 077ca0ff4e
5 changed files with 25 additions and 13 deletions

View File

@ -124,7 +124,7 @@ namespace cryptonote {
static_assert((TARGET_BLOCK_TIME % 1min) == 0s, "difficulty targets must be a multiple of a minute");
uint64_t base_reward =
version >= network_version_16_pulse ? BLOCK_REWARD_HF16 :
version >= network_version_17 ? BLOCK_REWARD_HF17 :
version >= network_version_15_lns ? BLOCK_REWARD_HF15 :
version >= network_version_8 ? block_reward_unpenalized_formula_v8(height) :
block_reward_unpenalized_formula_v7(already_generated_coins, height);

View File

@ -329,6 +329,7 @@ namespace cryptonote
network_version_14_blink,
network_version_15_lns,
network_version_16_pulse,
network_version_17, // future HF
network_version_count,
};

View File

@ -5014,7 +5014,9 @@ bool Blockchain::calc_batched_governance_reward(uint64_t height, uint64_t &rewar
if (hard_fork_version >= network_version_15_lns)
{
reward = num_blocks * (
hard_fork_version >= network_version_16_pulse ? FOUNDATION_REWARD_HF16 : FOUNDATION_REWARD_HF15);
hard_fork_version >= network_version_17 ? FOUNDATION_REWARD_HF17 :
hard_fork_version >= network_version_16_pulse ? FOUNDATION_REWARD_HF15 + BLOCKSWAP_LIQUIDITY_HF16 :
FOUNDATION_REWARD_HF15);
return true;
}

View File

@ -133,8 +133,9 @@ namespace cryptonote
uint64_t governance_reward_formula(uint64_t base_reward, uint8_t hf_version)
{
return hf_version >= network_version_16_pulse ? FOUNDATION_REWARD_HF16 :
hf_version >= network_version_15_lns ? FOUNDATION_REWARD_HF15 :
return hf_version >= network_version_17 ? FOUNDATION_REWARD_HF17 :
hf_version >= network_version_16_pulse ? FOUNDATION_REWARD_HF15 + BLOCKSWAP_LIQUIDITY_HF16 :
hf_version >= network_version_15_lns ? FOUNDATION_REWARD_HF15 :
base_reward / 20;
}
@ -197,7 +198,6 @@ namespace cryptonote
uint64_t service_node_reward_formula(uint64_t base_reward, uint8_t hard_fork_version)
{
return
hard_fork_version >= network_version_16_pulse ? SN_REWARD_HF16 :
hard_fork_version >= network_version_15_lns ? SN_REWARD_HF15 :
hard_fork_version >= network_version_9_service_nodes ? base_reward / 2 : // 50% of base reward up until HF15's fixed payout
0;

View File

@ -8,16 +8,24 @@ constexpr uint64_t EMISSION_SUPPLY_MULTIPLIER = 19;
constexpr uint64_t EMISSION_SUPPLY_DIVISOR = 10;
constexpr uint64_t EMISSION_DIVISOR = 2000000;
// Transition (HF15) money supply parameters
// HF15 money supply parameters:
constexpr uint64_t BLOCK_REWARD_HF15 = 25 * COIN;
constexpr uint64_t MINER_REWARD_HF15 = BLOCK_REWARD_HF15 * 24 / 100;
constexpr uint64_t MINER_REWARD_HF15 = BLOCK_REWARD_HF15 * 24 / 100; // Only until HF16
constexpr uint64_t SN_REWARD_HF15 = BLOCK_REWARD_HF15 * 66 / 100;
constexpr uint64_t FOUNDATION_REWARD_HF15 = BLOCK_REWARD_HF15 * 10 / 100;
// New (HF16+) money supply parameters (tentative - HF16 not yet scheduled)
constexpr uint64_t BLOCK_REWARD_HF16 = 21 * COIN /* TODO - see below */;
constexpr uint64_t SN_REWARD_HF16 = BLOCK_REWARD_HF16 * 90 / 100;
constexpr uint64_t FOUNDATION_REWARD_HF16 = BLOCK_REWARD_HF16 * 10 / 100;
// HF16+ money supply parameters: same as HF15 except the miner fee goes away and is redirected to
// LF to be used exclusively for Loki Blockswap liquidity seeding and incentives. See
// https://github.com/loki-project/loki-improvement-proposals/issues/24 for more details. This ends
// after 6 months.
constexpr uint64_t BLOCKSWAP_LIQUIDITY_HF16 = BLOCK_REWARD_HF15 * 24 / 100;
// HF17: at most 6 months after HF16. This is tentative and will likely be replaced before the
// actual HF with a new reward schedule including Blockswap rewards, but as per the LRC linked
// above, the liquidity funds end after 6 months. That means that until HF17 is finalized, this is
// the fallback if we hit the 6-months-after-HF16 point:
constexpr uint64_t BLOCK_REWARD_HF17 = 18'333'333'333;
constexpr uint64_t FOUNDATION_REWARD_HF17 = 1'833'333'333;
// TODO: For now we add 1 extra atomic loki to the HF16 block reward, above; ultimately with pulse
// we want to just drop the miner reward output entirely when a tx has no transactions, but we don't
@ -26,8 +34,9 @@ constexpr uint64_t FOUNDATION_REWARD_HF16 = BLOCK_REWARD_HF16 * 10 / 100;
// to keep the current test suite happy until we actually implement this for HF16.
// constexpr uint64_t MINER_REWARD_HF16 = 0;
static_assert(MINER_REWARD_HF15 + SN_REWARD_HF15 + FOUNDATION_REWARD_HF15 == BLOCK_REWARD_HF15);
static_assert( SN_REWARD_HF16 + FOUNDATION_REWARD_HF16 == BLOCK_REWARD_HF16);
static_assert(MINER_REWARD_HF15 + SN_REWARD_HF15 + FOUNDATION_REWARD_HF15 == BLOCK_REWARD_HF15);
static_assert(BLOCKSWAP_LIQUIDITY_HF16 + SN_REWARD_HF15 + FOUNDATION_REWARD_HF15 == BLOCK_REWARD_HF15);
static_assert( SN_REWARD_HF15 + FOUNDATION_REWARD_HF17 == BLOCK_REWARD_HF17);
// -------------------------------------------------------------------------------------------------
//