Reduce emissions by 10% every year (#108)

* deprecate top balance

* stub dynamic emissions impl

* impl 90% curve

* scaffold emissions rate function

* emissions curve

* implement new supply curve

* remove comments

* update comment

* bump version

* test reset

* add tests for emissions reduction

* test

* fix test

* bump version
This commit is contained in:
Hardhat Chad
2025-03-23 13:46:15 -05:00
committed by GitHub
parent 68159ca443
commit b54c542925
7 changed files with 454 additions and 93 deletions

View File

@@ -42,16 +42,6 @@ pub const EPOCH_DURATION: i64 = ONE_MINUTE * EPOCH_MINUTES;
/// The maximum token supply (5 million).
pub const MAX_SUPPLY: u64 = ONE_ORE * 5_000_000;
/// The target quantity of ORE to be mined per epoch.
pub const TARGET_EPOCH_REWARDS: u64 = ONE_ORE * EPOCH_MINUTES as u64;
/// The maximum quantity of ORE that can be mined per epoch.
/// Inflation target ≈ 1 ORE / min
pub const MAX_EPOCH_REWARDS: u64 = TARGET_EPOCH_REWARDS * BUS_COUNT as u64;
/// The quantity of ORE each bus is allowed to issue per epoch.
pub const BUS_EPOCH_REWARDS: u64 = MAX_EPOCH_REWARDS / BUS_COUNT as u64;
/// The number of bus accounts, for parallelizing mine operations.
pub const BUS_COUNT: usize = 8;
@@ -59,11 +49,6 @@ pub const BUS_COUNT: usize = 8;
/// than a factor of this constant from one epoch to the next.
pub const SMOOTHING_FACTOR: u64 = 2;
// Assert MAX_EPOCH_REWARDS is evenly divisible by BUS_COUNT.
static_assertions::const_assert!(
(MAX_EPOCH_REWARDS / BUS_COUNT as u64) * BUS_COUNT as u64 == MAX_EPOCH_REWARDS
);
/// The seed of the bus account PDA.
pub const BUS: &[u8] = b"bus";

View File

@@ -18,6 +18,7 @@ pub struct Bus {
pub theoretical_rewards: u64,
/// The largest known stake balance seen by the bus this epoch.
#[deprecated(since = "2.8.0", note = "Top balance is no longer tracked or used")]
pub top_balance: u64,
}

View File

@@ -15,8 +15,8 @@ pub struct Config {
/// The minimum accepted difficulty.
pub min_difficulty: u64,
/// Buffer for possible future use.
pub _buffer: [u8; 8],
/// The target emissions rate in ORE/min.
pub target_emmissions_rate: u64,
}
account!(OreAccount, Config);