Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion program/src/instructions/direct/claim/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use pinocchio_token_2022::instructions::TransferChecked;
use crate::{
events::ClaimedEvent,
state::{DirectDistribution, DirectRecipient},
traits::{AccountSerialize, ClaimTracker, Distribution, DistributionSigner, EventSerialize, VestingParams},
traits::{
AccountSerialize, ClaimTracker, Distribution, DistributionSigner, EventSerialize, InstructionData,
VestingParams,
},
utils::{emit_event, get_current_timestamp, get_mint_decimals, resolve_claim_amount},
ID,
};
Expand All @@ -13,6 +16,7 @@ use super::ClaimDirect;

pub fn process_claim_direct(_program_id: &Address, accounts: &[AccountView], instruction_data: &[u8]) -> ProgramResult {
let ix = ClaimDirect::try_from((instruction_data, accounts))?;
ix.data.validate()?;

let current_ts = get_current_timestamp()?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
errors::RewardsProgramError,
events::DistributionClosedEvent,
state::DirectDistribution,
traits::{Distribution, DistributionSigner, EventSerialize},
traits::{Distribution, DistributionSigner, EventSerialize, InstructionData},
utils::{close_pda_account, emit_event, get_current_timestamp, get_mint_decimals, get_token_account_balance},
ID,
};
Expand All @@ -18,6 +18,7 @@ pub fn process_close_direct_distribution(
instruction_data: &[u8],
) -> ProgramResult {
let ix = CloseDirectDistribution::try_from((instruction_data, accounts))?;
ix.data.validate()?;

let distribution_data = ix.accounts.distribution.try_borrow()?;
let distribution = DirectDistribution::from_account(&distribution_data, ix.accounts.distribution, &ID)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
errors::RewardsProgramError,
events::ClaimClosedEvent,
state::{DirectDistribution, DirectRecipient},
traits::EventSerialize,
traits::{EventSerialize, InstructionData},
utils::{close_pda_account, emit_event},
ID,
};
Expand All @@ -17,6 +17,7 @@ pub fn process_close_direct_recipient(
instruction_data: &[u8],
) -> ProgramResult {
let ix = CloseDirectRecipient::try_from((instruction_data, accounts))?;
ix.data.validate()?;

let distribution_data = ix.accounts.distribution.try_borrow()?;
let _distribution = DirectDistribution::from_account(&distribution_data, ix.accounts.distribution, &ID)?;
Expand Down
3 changes: 2 additions & 1 deletion program/src/instructions/merkle/claim/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
state::{MerkleClaim, MerkleClaimSeeds, MerkleDistribution},
traits::{
AccountParse, AccountSerialize, AccountSize, ClaimTracker, Distribution, DistributionSigner, EventSerialize,
PdaSeeds, VestingParams,
InstructionData, PdaSeeds, VestingParams,
},
utils::{
compute_leaf_hash, create_pda_account_idempotent, emit_event, get_current_timestamp, get_mint_decimals,
Expand All @@ -20,6 +20,7 @@ use super::ClaimMerkle;

pub fn process_claim_merkle(_program_id: &Address, accounts: &[AccountView], instruction_data: &[u8]) -> ProgramResult {
let ix = ClaimMerkle::try_from((instruction_data, accounts))?;
ix.data.validate()?;

let current_ts = get_current_timestamp()?;

Expand Down
3 changes: 2 additions & 1 deletion program/src/instructions/merkle/close_claim/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pinocchio::{account::AccountView, Address, ProgramResult};
use crate::{
events::ClaimClosedEvent,
state::MerkleClaim,
traits::EventSerialize,
traits::{EventSerialize, InstructionData},
utils::{close_pda_account, emit_event, verify_system_account},
ID,
};
Expand All @@ -16,6 +16,7 @@ pub fn process_close_merkle_claim(
instruction_data: &[u8],
) -> ProgramResult {
let ix = CloseMerkleClaim::try_from((instruction_data, accounts))?;
ix.data.validate()?;

// Distribution must be closed (owner = system program means account was deleted)
verify_system_account(ix.accounts.distribution)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
errors::RewardsProgramError,
events::DistributionClosedEvent,
state::MerkleDistribution,
traits::{Distribution, DistributionSigner, EventSerialize},
traits::{Distribution, DistributionSigner, EventSerialize, InstructionData},
utils::{close_pda_account, emit_event, get_current_timestamp, get_mint_decimals, get_token_account_balance},
ID,
};
Expand All @@ -18,6 +18,7 @@ pub fn process_close_merkle_distribution(
instruction_data: &[u8],
) -> ProgramResult {
let ix = CloseMerkleDistribution::try_from((instruction_data, accounts))?;
ix.data.validate()?;

let current_ts = get_current_timestamp()?;

Expand Down
Loading