Files
ore/src/state/bus.rs
Hardhat Chad 42b81b1d0f comments
2024-04-30 18:23:53 +00:00

33 lines
1.0 KiB
Rust

use bytemuck::{Pod, Zeroable};
use shank::ShankAccount;
use crate::{
impl_account_from_bytes, impl_to_bytes,
utils::{AccountDiscriminator, Discriminator},
};
/// Bus accounts are responsible for distributing mining rewards.
/// There are 8 busses total to minimize write-lock contention and allow for parallel mine operations.
/// Every epoch, the bus account rewards counters are topped up to 0.25 ORE each (2 ORE split amongst 8 busses).
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, ShankAccount, Zeroable)]
pub struct Bus {
/// The ID of the bus account.
pub id: u64,
/// The quantity of rewards this bus has left to issue in the current epoch epoch.
pub rewards: u64,
/// The rewards that would have been paid out by this bus in the current epoch if the bus had no limit.
pub theoretical_rewards: u64,
}
impl Discriminator for Bus {
fn discriminator() -> AccountDiscriminator {
AccountDiscriminator::Bus
}
}
impl_to_bytes!(Bus);
impl_account_from_bytes!(Bus);