1use steel::*;
2
3use crate::{
4 consts::CONFIG_ADDRESS,
5 state::{Campaign, Config},
6};
7
8pub trait AirdropAccountInfoValidation {
9 fn is_config(&self) -> Result<&Self, ProgramError>;
10 fn is_campaign(&self) -> Result<&Self, ProgramError>;
11}
12
13impl AirdropAccountInfoValidation for AccountInfo<'_> {
14 fn is_config(&self) -> Result<&Self, ProgramError> {
15 self.has_address(&CONFIG_ADDRESS)?
16 .is_type::<Config>(&crate::ID)
17 }
18
19 fn is_campaign(&self) -> Result<&Self, ProgramError> {
20 self.is_type::<Campaign>(&crate::ID)
21 }
22}