From 681df6f96d90a72f01cad2428c85970ff508b02a Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Oct 2024 01:56:47 -0700 Subject: [PATCH 1/2] base rewards --- program/src/mine.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/program/src/mine.rs b/program/src/mine.rs index 486fe32..6e2825f 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -123,6 +123,7 @@ pub fn process_mine(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult { // // Boosts are incentives that can multiply a miner's rewards by staking tokens in the ORE Boosts program. // Up to 3 boosts can be applied on any given mine operation. + let base_reward = reward; let mut applied_boosts = [Pubkey::new_from_array([0; 32]); 3]; for i in 0..3 { if optional_accounts.len().gt(&(i * 2)) { @@ -166,7 +167,7 @@ pub fn process_mine(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult { } // Log base reward after boost rewards. // Parser looks for base reward first, and then for the variable number of boost rewards. - sol_log(&format!("Base: {}", reward)); + sol_log(&format!("Base: {}", base_reward)); // Apply liveness penalty. // From 674427007138147382f88b56c2683c81f5d5b4d0 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 14 Oct 2024 02:14:22 -0700 Subject: [PATCH 2/2] sum boost rewards --- program/src/mine.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/src/mine.rs b/program/src/mine.rs index 6e2825f..8bdc6a5 100644 --- a/program/src/mine.rs +++ b/program/src/mine.rs @@ -147,7 +147,7 @@ pub fn process_mine(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult { // Apply multiplier if boost is not expired and last stake at was more than one minute ago. if boost.expires_at.gt(&t) && stake.last_stake_at.saturating_add(ONE_MINUTE).le(&t) { let multiplier = boost.multiplier.checked_sub(1).unwrap(); - let boost_reward = (reward as u128) + let boost_reward = (base_reward as u128) .checked_mul(multiplier as u128) .unwrap() .checked_mul(stake.balance as u128)