Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HardhatChad committed Jan 20, 2025
1 parent 41f9b61 commit 09c7a3e
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/src/state/boost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions api/src/state/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion api/src/state/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion api/src/state/directory.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion api/src/state/reservation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion api/src/state/stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion program/src/deposit.rs
Original file line number Diff line number Diff line change
@@ -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)?;
Expand Down
1 change: 1 addition & 0 deletions program/src/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 09c7a3e

Please sign in to comment.