diff --git a/program/src/reset.rs b/program/src/reset.rs index a5a1a54..b0b6e50 100644 --- a/program/src/reset.rs +++ b/program/src/reset.rs @@ -1,7 +1,5 @@ -use std::collections::HashMap; - use ore_api::prelude::*; -use solana_program::{log::sol_log, slot_hashes::SlotHashes}; +use solana_program::slot_hashes::SlotHashes; use steel::*; /// Resets a block. @@ -53,10 +51,6 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul let max_reward = MAX_SUPPLY.saturating_sub(ore_mint.supply()); let block_reward = block_reward.min(max_reward); - sol_log(&format!("slot_hash: {:?}", block_prev.slot_hash)); - sol_log(&format!("max_reward: {}", max_reward)); - sol_log(&format!("block_reward: {}", block_reward)); - // Set the block reward. block_prev.reward = block_reward; @@ -158,7 +152,7 @@ fn get_slot_hash( } fn calculate_block_reward(slot_hash: &[u8]) -> u64 { - let block_distribution = HashMap::from([ + let block_distribution = [ (1u64, 737869762948382064), // 4% (2u64, 1641760222560150093), // 4.9% (3u64, 2564097426245627674), // 5% @@ -181,17 +175,12 @@ fn calculate_block_reward(slot_hash: &[u8]) -> u64 { (20u64, 18243829888898746547), // 5% (100u64, 18428297329635842063), // 1% (1000u64, u64::MAX), // 0.1% - ]); + ]; let r1 = u64::from_le_bytes(slot_hash[0..8].try_into().unwrap()); let r2 = u64::from_le_bytes(slot_hash[8..16].try_into().unwrap()); let r3 = u64::from_le_bytes(slot_hash[16..24].try_into().unwrap()); let r4 = u64::from_le_bytes(slot_hash[24..32].try_into().unwrap()); let r = r1 ^ r2 ^ r3 ^ r4; - sol_log(&format!("r1: {}", r1)); - sol_log(&format!("r2: {}", r2)); - sol_log(&format!("r3: {}", r3)); - sol_log(&format!("r4: {}", r4)); - sol_log(&format!("r: {}", r)); for (k, v) in block_distribution.iter() { if r <= *v { return *k * ONE_ORE;