mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
log math
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user