This commit is contained in:
alex
2024-07-10 11:13:04 -07:00
parent 1ad89987c4
commit b602b532a6
2 changed files with 11 additions and 10 deletions

View File

@@ -10,4 +10,4 @@ pub(crate) use ore_utils as utils;
use solana_program::declare_id;
// declare_id!("mineRHF5r6S7HyD9SppBfVMXMavDkJsxwGesEvxZr2A");
declare_id!("5vBA1LwxxiobFsVHZeHgWS5mdUTjRDjo7e7xSFk25LVr");
declare_id!("EarRpm6FCvs7biAjL1F6yTugqUvLoXtYUvPKb2tHNh8w");

View File

@@ -97,6 +97,7 @@ pub fn process_mine<'a, 'info>(
.base_reward_rate
.checked_mul(2u64.checked_pow(difficulty).unwrap())
.unwrap();
sol_log(&format!("reward: {}", reward));
// Apply staking multiplier.
// If user has greater than or equal to the max stake on the network, they receive 2x multiplier.
@@ -123,16 +124,16 @@ pub fn process_mine<'a, 'info>(
// Apply liveness penalty.
let t_liveness = t_target.saturating_add(TOLERANCE);
let ratio = reward
.checked_mul(t.checked_sub(t_liveness).unwrap() as u64)
.unwrap()
.checked_div(ONE_MINUTE as u64)
.unwrap();
sol_log(&format!("ratio: {}", ratio));
if t.gt(&t_liveness) {
reward = reward
.checked_sub(
reward
.checked_mul(t.checked_sub(t_liveness).unwrap() as u64)
.unwrap()
.checked_div(ONE_MINUTE as u64)
.unwrap(),
)
.unwrap();
let reward_diff = reward.checked_sub(ratio).unwrap();
sol_log(&format!("reward_diff: {}", reward_diff));
reward = reward_diff;
}
// Limit payout amount to whatever is left in the bus