diff --git a/api/src/state/boost.rs b/api/src/state/boost.rs index 977da0f..7d953b2 100644 --- a/api/src/state/boost.rs +++ b/api/src/state/boost.rs @@ -2,7 +2,7 @@ use steel::*; use super::BoostAccount; -/// Boost ... +/// Boost tracks the mining multiplier and stake deposits of a boost account. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] pub struct Boost { diff --git a/api/src/state/checkpoint.rs b/api/src/state/checkpoint.rs index fc79be6..5738f57 100644 --- a/api/src/state/checkpoint.rs +++ b/api/src/state/checkpoint.rs @@ -2,7 +2,7 @@ use steel::*; use super::BoostAccount; -/// Checkpoint ... +/// Checkpoint holds the checkpoint state of a particular boost. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] pub struct Checkpoint { @@ -18,7 +18,7 @@ pub struct Checkpoint { /// The number of total stakers in this checkpoint. pub total_stakers: u64, - /// The total amount of rewards to distribute. + /// The total amount of rewards to distribute in this checkpoint. pub total_rewards: u64, /// The timestamp of when the last checkpoint finished. diff --git a/api/src/state/config.rs b/api/src/state/config.rs index d2304e2..0239af4 100644 --- a/api/src/state/config.rs +++ b/api/src/state/config.rs @@ -2,7 +2,7 @@ use steel::*; use super::BoostAccount; -/// Config ... +/// Config holds global program config variables. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] pub struct Config { diff --git a/api/src/state/directory.rs b/api/src/state/directory.rs index d32cbf4..9b01bf5 100644 --- a/api/src/state/directory.rs +++ b/api/src/state/directory.rs @@ -1,7 +1,7 @@ use steel::*; use super::BoostAccount; -/// Directory ... +/// Directory holds the list of active boosts. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] pub struct Directory { diff --git a/api/src/state/reservation.rs b/api/src/state/reservation.rs index 1dfa14e..0376312 100644 --- a/api/src/state/reservation.rs +++ b/api/src/state/reservation.rs @@ -2,7 +2,7 @@ use steel::*; use super::BoostAccount; -/// Boost ... +/// Reservation tracks the current boost that a miner is allowed to use. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] pub struct Reservation { diff --git a/api/src/state/stake.rs b/api/src/state/stake.rs index 51c0f0e..1a7ea0f 100644 --- a/api/src/state/stake.rs +++ b/api/src/state/stake.rs @@ -2,7 +2,7 @@ use steel::*; use super::BoostAccount; -/// Stake ... +/// Stake holds onto the deposits and yield of a boost staker. #[repr(C)] #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] pub struct Stake { diff --git a/program/src/deposit.rs b/program/src/deposit.rs index 7b458ba..37d7a8d 100644 --- a/program/src/deposit.rs +++ b/program/src/deposit.rs @@ -1,7 +1,7 @@ use ore_boost_api::prelude::*; use steel::*; -/// Deposit adds tokens to a stake account to earn a multiplier. +/// Deposit adds tokens to a stake account. pub fn process_deposit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult { // Parse args. let args = Deposit::try_from_bytes(data)?; diff --git a/program/src/open.rs b/program/src/open.rs index 517407b..024023b 100644 --- a/program/src/open.rs +++ b/program/src/open.rs @@ -40,6 +40,7 @@ pub fn process_open(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResult stake.boost = *boost_info.key; stake.id = boost.total_stakers; stake.last_deposit_at = clock.unix_timestamp; + stake.rewards = 0; // Increment the total number of stakers. boost.total_stakers = boost.total_stakers.checked_add(1).unwrap();