Skip to content

Commit

Permalink
adjust code for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
kstepanovdev committed Aug 7, 2024
1 parent 406078f commit 015b657
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions clients/js/src/generated/types/lockupPeriod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers';

export enum LockupPeriod {
None,
Test,
Flex,
ThreeMonths,
SixMonths,
Expand Down
1 change: 1 addition & 0 deletions clients/rust/src/generated/types/lockup_period.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use num_derive::FromPrimitive;
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum LockupPeriod {
None,
Test,
Flex,
ThreeMonths,
SixMonths,
Expand Down
3 changes: 3 additions & 0 deletions idls/mplx_rewards.json
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@
{
"name": "None"
},
{
"name": "Test"
},
{
"name": "Flex"
},
Expand Down
6 changes: 3 additions & 3 deletions programs/rewards/src/state/reward_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ impl<'a> WrappedRewardPool<'a> {

self.pool.total_share =
self.consume_old_modifiers(beginning_of_the_day, self.pool.total_share)?;
if self.cumulative_index.contains(&beginning_of_the_day) {
return Ok(());
}
// if self.cumulative_index.contains(&beginning_of_the_day) {
// return Ok(());
// }

WrappedRewardPool::update_index(
self.cumulative_index,
Expand Down
4 changes: 4 additions & 0 deletions programs/rewards/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ impl AccountLoader {
pub enum LockupPeriod {
/// Unreachable option
None,
Test,
/// Unlimited lockup period.
Flex,
/// Three months
Expand All @@ -231,6 +232,7 @@ impl LockupPeriod {
LockupPeriod::SixMonths => 4,
LockupPeriod::OneYear => 6,
LockupPeriod::Flex => 1,
LockupPeriod::Test => 1,
}
}

Expand All @@ -245,6 +247,7 @@ impl LockupPeriod {
LockupPeriod::SixMonths => Ok(beginning_of_the_day + SECONDS_PER_DAY * 180),
LockupPeriod::OneYear => Ok(beginning_of_the_day + SECONDS_PER_DAY * 365),
LockupPeriod::Flex => Ok(beginning_of_the_day + SECONDS_PER_DAY * 5),
LockupPeriod::Test => Ok(beginning_of_the_day + 120),
}
}

Expand All @@ -256,6 +259,7 @@ impl LockupPeriod {
LockupPeriod::SixMonths => Ok(180),
LockupPeriod::OneYear => Ok(365),
LockupPeriod::Flex => Ok(5),
LockupPeriod::Test => Ok(0),
}
}
}
Expand Down

0 comments on commit 015b657

Please sign in to comment.