1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub mod assert;
pub mod program_ids;
pub mod validate;
use anchor_lang::prelude::*;
pub fn validate_derived_address(
derived_address: &Pubkey,
program_id: &Pubkey,
seeds: &[&[u8]],
) -> bool {
match Pubkey::create_program_address(seeds, program_id) {
Ok(key) => *derived_address == key,
_ => false,
}
}
#[error(offset = 1100)]
pub enum VipersError {
KeyMismatch,
ATAMismatch,
ProgramIDMismatch,
IntegerOverflow,
#[msg("The provided account is not owned by the specified program.")]
OwnerMismatch,
}