Skip to content

Commit

Permalink
make linter happy && small renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
kstepanovdev committed Aug 30, 2024
1 parent 49b42c1 commit 1750838
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use super::Penalty;
use crate::cpi_instructions;
use anchor_lang::prelude::*;
use mplx_staking_states::error::MplStakingError;

use super::ClaimingAllowance;

/// Restricts claiming rewards from the specified mining account.
pub fn allow_claiming<'info>(ctx: Context<ClaimingAllowance>) -> Result<()> {
pub fn allow_claiming(ctx: Context<Penalty>) -> Result<()> {
let registrar = ctx.accounts.registrar.load()?;

require_keys_eq!(
Expand Down
5 changes: 2 additions & 3 deletions programs/mpl-staking/src/instructions/penalties/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
pub use allow_claiming::*;
use anchor_lang::{
prelude::{AccountLoader, Signer, ToAccountInfo, UncheckedAccount},
Accounts,
};

pub use allow_claiming::*;
pub use restrict_claiming::*;

mod allow_claiming;
Expand All @@ -12,7 +11,7 @@ mod restrict_claiming;
use mplx_staking_states::state::Registrar;

#[derive(Accounts)]
pub struct ClaimingAllowance<'info> {
pub struct Penalty<'info> {
pub registrar: AccountLoader<'info, Registrar>,

pub realm_authority: Signer<'info>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use super::Penalty;
use crate::cpi_instructions;
use anchor_lang::prelude::*;
use mplx_staking_states::error::MplStakingError;

use super::ClaimingAllowance;

/// Restricts claiming rewards from the specified mining account.
pub fn restrict_claiming<'info>(ctx: Context<ClaimingAllowance>) -> Result<()> {
pub fn restrict_claiming(ctx: Context<Penalty>) -> Result<()> {
let registrar = ctx.accounts.registrar.load()?;

require_keys_eq!(
Expand Down
4 changes: 2 additions & 2 deletions programs/mpl-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ pub mod mpl_staking {
instructions::change_delegate(ctx, deposit_entry_index)
}

pub fn restrict_claiming(ctx: Context<ClaimingAllowance>) -> Result<()> {
pub fn restrict_claiming(ctx: Context<Penalty>) -> Result<()> {
instructions::restrict_claiming(ctx)
}

pub fn allow_claiming(ctx: Context<ClaimingAllowance>) -> Result<()> {
pub fn allow_claiming(ctx: Context<Penalty>) -> Result<()> {
instructions::allow_claiming(ctx)
}
}
Expand Down
4 changes: 2 additions & 2 deletions programs/mpl-staking/tests/program_test/addin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ impl AddinCookie {
let data = InstructionData::data(&mpl_staking::instruction::RestrictClaiming {});

let accounts = anchor_lang::ToAccountMetas::to_account_metas(
&mpl_staking::accounts::ClaimingAllowance {
&mpl_staking::accounts::Penalty {
registrar: registrar.address,
realm_authority: realm_authority.pubkey(),
reward_pool: *reward_pool,
Expand Down Expand Up @@ -804,7 +804,7 @@ impl AddinCookie {
let data = InstructionData::data(&mpl_staking::instruction::AllowClaiming {});

let accounts = anchor_lang::ToAccountMetas::to_account_metas(
&mpl_staking::accounts::ClaimingAllowance {
&mpl_staking::accounts::Penalty {
registrar: registrar.address,
realm_authority: realm_authority.pubkey(),
reward_pool: *reward_pool,
Expand Down

0 comments on commit 1750838

Please sign in to comment.