From 6b5dba464c62a949f9e47e83b3069f386376386f Mon Sep 17 00:00:00 2001 From: Hardhat Chad Date: Thu, 9 May 2024 13:19:16 +0000 Subject: [PATCH] correct bus balances --- src/consts.rs | 21 +++++++++++++-------- src/processor/reset.rs | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/consts.rs b/src/consts.rs index fa395c4..0b687ba 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -11,7 +11,8 @@ pub const INITIAL_TOLERANCE: i64 = 5; /// The minimum difficulty required of all submitted hashes. pub const MIN_DIFFICULTY: u32 = 12; -/// The decimal precision of the Ore token (100 billion indivisible units per Ore). +/// The decimal precision of the Ore token. +/// There are 100 billion indivisible units per Ore (called "grains"). pub const TOKEN_DECIMALS: u8 = 11; /// One Ore token, denominated in indivisible units. @@ -20,21 +21,21 @@ pub const ONE_ORE: u64 = 10u64.pow(TOKEN_DECIMALS as u32); /// The duration of one minute, in seconds. pub const ONE_MINUTE: i64 = 60; -/// The duration of an Ore epoch, in seconds. -pub const EPOCH_DURATION: i64 = ONE_MINUTE.saturating_mul(5); +/// The number of minutes in an Ore epoch. +pub const EPOCH_MINUTES: i64 = 5; -/// The duration of two years, in minutes. -pub const TWO_YEARS: u64 = 60 * 24 * 365 * 2; +/// The duration of an Ore epoch, in seconds. +pub const EPOCH_DURATION: i64 = ONE_MINUTE.saturating_mul(EPOCH_MINUTES); /// The maximum token supply (42 million). pub const MAX_SUPPLY: u64 = ONE_ORE.saturating_mul(42_000_000); /// The target quantity of ORE to be mined per epoch. -/// Inflation rate ≈ 1 ORE / epoch (min 0, max 2) -pub const TARGET_EPOCH_REWARDS: u64 = ONE_ORE; +/// Inflation rate ≈ 1 ORE / min (min 0, max 2) +pub const TARGET_EPOCH_REWARDS: u64 = ONE_ORE.saturating_mul(EPOCH_MINUTES as u64); /// The maximum quantity of ORE that can be mined per epoch. -pub const MAX_EPOCH_REWARDS: u64 = ONE_ORE.saturating_mul(2); +pub const MAX_EPOCH_REWARDS: u64 = TARGET_EPOCH_REWARDS.saturating_mul(2); /// The quantity of ORE each bus is allowed to issue per epoch. pub const BUS_EPOCH_REWARDS: u64 = MAX_EPOCH_REWARDS.saturating_div(BUS_COUNT as u64); @@ -51,6 +52,10 @@ static_assertions::const_assert!( (MAX_EPOCH_REWARDS / BUS_COUNT as u64) * BUS_COUNT as u64 == MAX_EPOCH_REWARDS ); +/// The duration of two years, in minutes. +/// Used to calculate the staking reward multiplier. +pub const TWO_YEARS: u64 = 60 * 24 * 365 * 2; + /// The seed of the bus account PDA. pub const BUS: &[u8] = b"bus"; diff --git a/src/processor/reset.rs b/src/processor/reset.rs index ed385fb..54ed945 100644 --- a/src/processor/reset.rs +++ b/src/processor/reset.rs @@ -16,6 +16,8 @@ use crate::{ SMOOTHING_FACTOR, TARGET_EPOCH_REWARDS, TREASURY, TREASURY_BUMP, }; +// TODO Update comments to account for 5 minute epoch + /// Reset sets up the Ore program for the next epoch. Its responsibilities include: /// 1. Reset bus account rewards counters. /// 2. Adjust the reward rate to stabilize inflation.