ore/state/
bus.rs

1use bytemuck::{Pod, Zeroable};
2use shank::ShankAccount;
3
4use crate::{
5    impl_account_from_bytes, impl_to_bytes,
6    utils::{AccountDiscriminator, Discriminator},
7};
8
9/// Bus accounts are responsible for distributing mining rewards.
10/// There are 8 busses total to minimize write-lock contention and allow for parallel mine operations.
11/// Every epoch, the bus account rewards counters are topped up to 0.25 ORE each (2 ORE split amongst 8 busses).
12#[repr(C)]
13#[derive(Clone, Copy, Debug, PartialEq, Pod, ShankAccount, Zeroable)]
14pub struct Bus {
15    /// The ID of the bus account.
16    pub id: u64,
17
18    /// The quantity of rewards this bus can issue in the current epoch epoch.
19    pub rewards: u64,
20}
21
22impl Discriminator for Bus {
23    fn discriminator() -> AccountDiscriminator {
24        AccountDiscriminator::Bus
25    }
26}
27
28impl_to_bytes!(Bus);
29impl_account_from_bytes!(Bus);