mirror of
https://github.com/tig-foundation/tig-monorepo.git
synced 2026-02-21 10:27:49 +08:00
Add ChallengeOwners emission type.
This commit is contained in:
parent
2e982d9482
commit
71482c92ee
@ -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);
|
||||
}
|
||||
|
||||
@ -142,6 +142,7 @@ serializable_struct_with_getters! {
|
||||
opow: f64,
|
||||
algorithms: f64,
|
||||
breakthroughs: f64,
|
||||
challenge_owners: f64,
|
||||
}
|
||||
}
|
||||
serializable_struct_with_getters! {
|
||||
|
||||
@ -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<ActiveType, u32>,
|
||||
timestamp: u64,
|
||||
emissions: HashMap<EmissionsType, PreciseNumber>,
|
||||
gamma_value: f64,
|
||||
}
|
||||
}
|
||||
serializable_struct_with_getters! {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user