-
Notifications
You must be signed in to change notification settings - Fork 1
/
bus.rs
29 lines (24 loc) · 880 Bytes
/
bus.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 2.5 MARS each (20 MARS 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 can issue in the current epoch epoch.
pub rewards: u64,
}
impl Discriminator for Bus {
fn discriminator() -> AccountDiscriminator {
AccountDiscriminator::Bus
}
}
impl_to_bytes!(Bus);
impl_account_from_bytes!(Bus);