From 71482c92ee392c1663e889c814227a3a9170e462 Mon Sep 17 00:00:00 2001 From: FiveMovesAhead Date: Mon, 16 Jun 2025 11:30:58 +0100 Subject: [PATCH] Add ChallengeOwners emission type. --- tig-protocol/src/contracts/rewards.rs | 11 +++++++++-- tig-structs/src/config.rs | 1 + tig-structs/src/core.rs | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tig-protocol/src/contracts/rewards.rs b/tig-protocol/src/contracts/rewards.rs index 9bb8a27d..cc10e8a5 100644 --- a/tig-protocol/src/contracts/rewards.rs +++ b/tig-protocol/src/contracts/rewards.rs @@ -26,7 +26,8 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { let active_challenge_ids = &block_data.active_ids[&ActiveType::Challenge]; let zero = PreciseNumber::from(0); - let gamma = 1.0258 * (1.0 - 0.8730 * (-0.0354 * active_challenge_ids.len() as f64).exp()); + block_details.gamma_value = + 1.0258 * (1.0 - 0.8730 * (-0.0354 * active_challenge_ids.len() as f64).exp()); let block_reward = PreciseNumber::from_f64( config .rewards @@ -42,7 +43,7 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { }) .block_reward, ); - let scaled_reward = block_reward * PreciseNumber::from_f64(gamma); + let scaled_reward = block_reward * PreciseNumber::from_f64(block_details.gamma_value.clone()); // update algorithm rewards let adoption_threshold = PreciseNumber::from_f64(config.algorithms.adoption_threshold); @@ -200,6 +201,9 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { } } + let challenge_owners_reward_pool = + scaled_reward * PreciseNumber::from_f64(config.rewards.distribution.challenge_owners); + block_details.emissions.insert( EmissionsType::Bootstrap, breakthroughs_reward_pool - total_breakthroughs_reward, @@ -224,4 +228,7 @@ pub(crate) async fn update(cache: &mut AddBlockCache) { block_details .emissions .insert(EmissionsType::Delegator, total_delegators_reward); + block_details + .emissions + .insert(EmissionsType::ChallengeOwner, challenge_owners_reward_pool); } diff --git a/tig-structs/src/config.rs b/tig-structs/src/config.rs index 0bd39031..1d7a1a07 100644 --- a/tig-structs/src/config.rs +++ b/tig-structs/src/config.rs @@ -142,6 +142,7 @@ serializable_struct_with_getters! { opow: f64, algorithms: f64, breakthroughs: f64, + challenge_owners: f64, } } serializable_struct_with_getters! { diff --git a/tig-structs/src/core.rs b/tig-structs/src/core.rs index ffcc0b6f..19bc90df 100644 --- a/tig-structs/src/core.rs +++ b/tig-structs/src/core.rs @@ -252,6 +252,7 @@ pub enum EmissionsType { Delegator, Bootstrap, Vault, + ChallengeOwner, } serializable_struct_with_getters! { BlockDetails { @@ -262,6 +263,7 @@ serializable_struct_with_getters! { num_active: HashMap, timestamp: u64, emissions: HashMap, + gamma_value: f64, } } serializable_struct_with_getters! {