This commit is contained in:
Hardhat Chad
2024-03-07 18:48:01 +00:00
parent cba2c748e2
commit 3af8f31089
20 changed files with 165 additions and 27 deletions

View File

@@ -43,7 +43,7 @@ async fn test_initialize() {
assert_eq!(treasury.bump as u8, treasury_pda.1);
assert_eq!(treasury.admin, payer.pubkey());
assert_eq!(treasury.difficulty, INITIAL_DIFFICULTY.into());
assert_eq!(treasury.epoch_start_at as u8, 0);
assert_eq!(treasury.last_reset_at as u8, 0);
assert_eq!(treasury.reward_rate, INITIAL_REWARD_RATE);
assert_eq!(treasury.total_claimed_rewards as u8, 0);

View File

@@ -184,7 +184,7 @@ async fn setup_program_test_env() -> (BanksClient, Keypair, solana_program::hash
bump: treasury_pda.1 as u64,
admin: admin_address,
difficulty: KeccakHash::new_from_array([u8::MAX; 32]).into(),
epoch_start_at: 100,
last_reset_at: 100,
reward_rate: INITIAL_REWARD_RATE,
total_claimed_rewards: 0,
}

View File

@@ -63,7 +63,7 @@ async fn test_reset() {
Pubkey::from_str("AeNqnoLwFanMd3ig9WoMxQZVwQHtCtqKMMBsT1sTrvz6").unwrap()
);
assert_eq!(treasury.difficulty, INITIAL_DIFFICULTY.into());
assert_eq!(treasury.epoch_start_at as u8, 100);
assert_eq!(treasury.last_reset_at as u8, 100);
assert_eq!(treasury.reward_rate, INITIAL_REWARD_RATE.saturating_div(2));
assert_eq!(treasury.total_claimed_rewards as u8, 0);
@@ -134,7 +134,7 @@ async fn setup_program_test_env() -> (BanksClient, Keypair, Hash) {
bump: treasury_pda.1 as u64,
admin: admin_address,
difficulty: INITIAL_DIFFICULTY.into(),
epoch_start_at: 0,
last_reset_at: 0,
reward_rate: INITIAL_REWARD_RATE,
total_claimed_rewards: 0,
}

View File

@@ -34,7 +34,7 @@ async fn test_update_admin() {
assert_eq!(treasury_.bump, treasury.bump);
assert_eq!(treasury_.admin, new_admin);
assert_eq!(treasury_.difficulty, treasury.difficulty);
assert_eq!(treasury_.epoch_start_at, treasury.epoch_start_at);
assert_eq!(treasury_.last_reset_at, treasury.last_reset_at);
assert_eq!(treasury_.reward_rate, treasury.reward_rate);
assert_eq!(
treasury_.total_claimed_rewards,

View File

@@ -34,7 +34,7 @@ async fn test_update_difficulty() {
assert_eq!(treasury_.bump, treasury.bump);
assert_eq!(treasury_.admin, treasury.admin);
assert_eq!(treasury_.difficulty, new_difficulty.into());
assert_eq!(treasury_.epoch_start_at, treasury.epoch_start_at);
assert_eq!(treasury_.last_reset_at, treasury.last_reset_at);
assert_eq!(treasury_.reward_rate, treasury.reward_rate);
assert_eq!(
treasury_.total_claimed_rewards,