Skip to content

Commit

Permalink
remove redundant parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kstepanovdev committed Aug 30, 2024
1 parent 6bda79b commit 94c1bf7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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>, registrar_bump: u8) -> Result<()> {
pub fn allow_claiming<'info>(ctx: Context<ClaimingAllowance>) -> Result<()> {
let registrar = ctx.accounts.registrar.load()?;

require_keys_eq!(
Expand All @@ -18,7 +18,7 @@ pub fn allow_claiming<'info>(ctx: Context<ClaimingAllowance>, registrar_bump: u8
&registrar.realm.key().to_bytes(),
b"registrar".as_ref(),
&registrar.realm_governing_token_mint.key().to_bytes(),
&[registrar_bump][..],
&[registrar.bump][..],
];

cpi_instructions::allow_claiming(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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>, registrar_bump: u8) -> Result<()> {
pub fn restrict_claiming<'info>(ctx: Context<ClaimingAllowance>) -> Result<()> {
let registrar = ctx.accounts.registrar.load()?;

require_keys_eq!(
Expand All @@ -18,7 +18,7 @@ pub fn restrict_claiming<'info>(ctx: Context<ClaimingAllowance>, registrar_bump:
&registrar.realm.key().to_bytes(),
b"registrar".as_ref(),
&registrar.realm_governing_token_mint.key().to_bytes(),
&[registrar_bump][..],
&[registrar.bump][..],
];

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

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

pub fn allow_claiming(ctx: Context<ClaimingAllowance>, registrar_bump: u8) -> Result<()> {
instructions::allow_claiming(ctx, registrar_bump)
pub fn allow_claiming(ctx: Context<ClaimingAllowance>) -> Result<()> {
instructions::allow_claiming(ctx)
}
}

Expand Down
8 changes: 2 additions & 6 deletions programs/mpl-staking/tests/program_test/addin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,7 @@ impl AddinCookie {
realm_authority: &Keypair,
rewards_program: &Pubkey,
) -> std::result::Result<(), BanksClientError> {
let data = InstructionData::data(&mpl_staking::instruction::RestrictClaiming {
registrar_bump: registrar.registrar_bump,
});
let data = InstructionData::data(&mpl_staking::instruction::RestrictClaiming {});

let accounts = anchor_lang::ToAccountMetas::to_account_metas(
&mpl_staking::accounts::ClaimingAllowance {
Expand Down Expand Up @@ -803,9 +801,7 @@ impl AddinCookie {
realm_authority: &Keypair,
rewards_program: &Pubkey,
) -> std::result::Result<(), BanksClientError> {
let data = InstructionData::data(&mpl_staking::instruction::AllowClaiming {
registrar_bump: registrar.registrar_bump,
});
let data = InstructionData::data(&mpl_staking::instruction::AllowClaiming {});

let accounts = anchor_lang::ToAccountMetas::to_account_metas(
&mpl_staking::accounts::ClaimingAllowance {
Expand Down

0 comments on commit 94c1bf7

Please sign in to comment.