mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-21 23:16:46 +00:00
remove epoch requirement
This commit is contained in:
@@ -13,6 +13,7 @@ pub enum OreInstruction {
|
||||
|
||||
// Admin
|
||||
Initialize = 100,
|
||||
Migrate = 101,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@@ -47,6 +48,10 @@ pub struct Update {}
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct Initialize {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct Migrate {}
|
||||
|
||||
instruction!(OreInstruction, Claim);
|
||||
instruction!(OreInstruction, Close);
|
||||
instruction!(OreInstruction, Mine);
|
||||
@@ -54,3 +59,4 @@ instruction!(OreInstruction, Open);
|
||||
instruction!(OreInstruction, Reset);
|
||||
instruction!(OreInstruction, Update);
|
||||
instruction!(OreInstruction, Initialize);
|
||||
instruction!(OreInstruction, Migrate);
|
||||
|
||||
25
api/src/state/bus.rs
Normal file
25
api/src/state/bus.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use steel::*;
|
||||
|
||||
use super::OreAccount;
|
||||
|
||||
/// Bus accounts are responsible for distributing mining rewards. There are 8 busses total
|
||||
/// to minimize write-lock contention and allow Solana to process mine instructions in parallel.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct Bus {
|
||||
/// The ID of the bus account.
|
||||
pub id: u64,
|
||||
|
||||
/// The remaining rewards this bus has left to payout in the current epoch.
|
||||
pub rewards: u64,
|
||||
|
||||
/// The rewards this bus would have paid out in the current epoch if there no limit.
|
||||
/// This is used to calculate the updated reward rate.
|
||||
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,
|
||||
}
|
||||
|
||||
account!(OreAccount, Bus);
|
||||
@@ -1,6 +1,6 @@
|
||||
use steel::*;
|
||||
|
||||
use super::OreAccount;
|
||||
use super::{OldOreAccount, OreAccount};
|
||||
|
||||
/// Config is a singleton account which manages program global variables.
|
||||
#[repr(C)]
|
||||
@@ -22,4 +22,22 @@ pub struct Config {
|
||||
pub block_reward: u64,
|
||||
}
|
||||
|
||||
/// Config is a singleton account which manages program global variables.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct OldConfig {
|
||||
/// The base reward rate paid out for a hash of minimum difficulty.
|
||||
pub base_reward_rate: u64,
|
||||
|
||||
/// The timestamp of the last reset.
|
||||
pub last_reset_at: i64,
|
||||
|
||||
/// The minimum accepted difficulty.
|
||||
pub min_difficulty: u64,
|
||||
|
||||
/// The target emissions rate in ORE/min.
|
||||
pub target_emmissions_rate: u64,
|
||||
}
|
||||
|
||||
account!(OreAccount, Config);
|
||||
account!(OldOreAccount, OldConfig);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
mod bus;
|
||||
mod config;
|
||||
mod proof;
|
||||
mod treasury;
|
||||
|
||||
pub use bus::*;
|
||||
pub use config::*;
|
||||
pub use proof::*;
|
||||
pub use treasury::*;
|
||||
@@ -13,6 +15,7 @@ use crate::consts::*;
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
||||
pub enum OreAccount {
|
||||
Bus = 100,
|
||||
Config = 101,
|
||||
Proof = 102,
|
||||
Treasury = 103,
|
||||
@@ -32,3 +35,9 @@ pub fn proof_pda(authority: Pubkey) -> (Pubkey, u8) {
|
||||
pub fn treasury_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[TREASURY], &crate::id())
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
||||
pub enum OldOreAccount {
|
||||
OldConfig = 101,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user