Skip to content

Commit

Permalink
Adds capped_now_ts in end_at calculation in newly_accrued_reward
Browse files Browse the repository at this point in the history
  • Loading branch information
dshaw002 committed Mar 4, 2022
1 parent 7c45e2b commit 48474f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions programs/gem_farm/src/state/farmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl FarmerFixedRateReward {
if self.promised_schedule.denominator > 1 {
let lower_bound = self.reward_lower_bound()?;
let upper_bound = self.reward_upper_bound(now_ts)?;
upper_bound.try_sub(upper_bound.try_sub(lower_bound)?.try_rem(self.promised_schedule.denominator)?)
now_ts.try_sub(upper_bound.try_sub(lower_bound)?.try_rem(self.promised_schedule.denominator)?)
} else {
Ok(now_ts)
}
Expand All @@ -282,7 +282,7 @@ impl FarmerFixedRateReward {
pub fn newly_accrued_reward(&self, now_ts: u64, rarity_points: u64) -> Result<u64> {
let start_from = self.time_from_staking_to_update()?;
let end_at = self
.reward_upper_bound(now_ts)?
.reward_upper_bound(self.capped_now_ts(now_ts)?)?
.try_sub(self.begin_staking_ts)?;

self.promised_schedule
Expand Down

0 comments on commit 48474f5

Please sign in to comment.