1#![deny(missing_docs)]
3#![forbid(unsafe_code)]
4
5mod entrypoint;
6pub mod error;
7pub mod instruction;
8pub mod processor;
9
10pub use solana_program;
12use solana_program::pubkey::Pubkey;
13
14solana_program::declare_id!("TkupDoNseygccBCjSsrSpMccjwHfTYwcrjpnDSrFDhC");
15
16const TOKEN_ESCROW_AUTHORITY_SEED: &[u8] = b"token-escrow-authority";
17
18pub fn get_token_upgrade_authority_address(
20 original_mint: &Pubkey,
21 new_mint: &Pubkey,
22 program_id: &Pubkey,
23) -> Pubkey {
24 get_token_upgrade_authority_address_and_bump_seed(original_mint, new_mint, program_id).0
25}
26
27pub(crate) fn get_token_upgrade_authority_address_and_bump_seed(
28 original_mint: &Pubkey,
29 new_mint: &Pubkey,
30 program_id: &Pubkey,
31) -> (Pubkey, u8) {
32 Pubkey::find_program_address(
33 &collect_token_upgrade_authority_seeds(original_mint, new_mint),
34 program_id,
35 )
36}
37
38pub(crate) fn collect_token_upgrade_authority_seeds<'a>(
39 original_mint: &'a Pubkey,
40 new_mint: &'a Pubkey,
41) -> [&'a [u8]; 3] {
42 [
43 TOKEN_ESCROW_AUTHORITY_SEED,
44 original_mint.as_ref(),
45 new_mint.as_ref(),
46 ]
47}
48
49pub(crate) fn collect_token_upgrade_authority_signer_seeds<'a>(
50 original_mint: &'a Pubkey,
51 new_mint: &'a Pubkey,
52 bump_seed: &'a [u8],
53) -> [&'a [u8]; 4] {
54 [
55 TOKEN_ESCROW_AUTHORITY_SEED,
56 original_mint.as_ref(),
57 new_mint.as_ref(),
58 bump_seed,
59 ]
60}