Skip to content

Commit

Permalink
move to anchor checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Giannis Chatziveroglou committed Jan 3, 2023
1 parent b7a66d7 commit b5c45b2
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub struct InitRewardDistributorCtx<'info> {
bump,
)]
reward_distributor: Box<Account<'info, RewardDistributor>>,
#[account(constraint = authority.key() != stake_pool.authority.key() @ ErrorCode::InvalidAuthority)]
stake_pool: Box<Account<'info, StakePool>>,
#[account(mut)]
reward_mint: Box<Account<'info, Mint>>,
Expand All @@ -58,10 +59,6 @@ pub fn handler(ctx: Context<InitRewardDistributorCtx>, ix: InitRewardDistributor
reward_distributor.max_reward_seconds_received = ix.max_reward_seconds_received;
reward_distributor.claim_rewards_payment_info = ix.claim_rewards_payment_info;

if ctx.accounts.authority.key() != ctx.accounts.stake_pool.authority.key() {
return Err(error!(ErrorCode::InvalidAuthority));
}

assert_payment_info(ctx.accounts.stake_pool.key(), Action::ClaimRewards, ix.claim_rewards_payment_info)?;
Ok(())
}

0 comments on commit b5c45b2

Please sign in to comment.