admin tests

This commit is contained in:
Hardhat Chad
2024-02-16 19:51:54 +00:00
parent ecbe2bb40a
commit d158742958
6 changed files with 148 additions and 75 deletions

View File

@@ -311,3 +311,33 @@ pub fn reset(signer: Pubkey) -> Instruction {
data: OreInstruction::Reset.to_vec(),
}
}
pub fn update_admin(signer: Pubkey, new_admin: Pubkey) -> Instruction {
Instruction {
program_id: crate::id(),
accounts: vec![
AccountMeta::new(signer, true),
AccountMeta::new(TREASURY_ADDRESS, false),
],
data: [
OreInstruction::UpdateAdmin.to_vec(),
UpdateAdminArgs { new_admin }.to_bytes().to_vec(),
]
.concat(),
}
}
pub fn update_difficulty(signer: Pubkey, new_difficulty: Hash) -> Instruction {
Instruction {
program_id: crate::id(),
accounts: vec![
AccountMeta::new(signer, true),
AccountMeta::new(TREASURY_ADDRESS, false),
],
data: [
OreInstruction::UpdateDifficulty.to_vec(),
UpdateDifficultyArgs { new_difficulty }.to_bytes().to_vec(),
]
.concat(),
}
}