There was an error while loading. Please reload this page.
1 parent aaa2739 commit 2a7b741Copy full SHA for 2a7b741
core/rust/utils/src/assertions.rs
@@ -7,6 +7,8 @@ use solana_program::{
7
rent::Rent,
8
};
9
10
+use crate::cmp_pubkeys;
11
+
12
pub fn assert_signer(account_info: &AccountInfo) -> ProgramResult {
13
if !account_info.is_signer {
14
Err(ProgramError::MissingRequiredSignature)
@@ -39,6 +41,18 @@ pub fn assert_owned_by(
39
41
}
40
42
43
44
+pub fn assert_owner_in(
45
+ account: &AccountInfo,
46
+ owners: &[Pubkey],
47
+ error: impl Into<ProgramError>,
48
+) -> ProgramResult {
49
+ if owners.iter().any(|owner| cmp_pubkeys(owner, account.owner)) {
50
+ Ok(())
51
+ } else {
52
+ Err(error.into())
53
+ }
54
+}
55
56
pub fn assert_derivation(
57
program_id: &Pubkey,
58
account: &AccountInfo,
0 commit comments