pyth_solana_receiver_sdk/cpi/
accounts.rs

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#![allow(clippy::vec_init_then_push)]

// This file was populated with the expanded macros of programs/pyth-solana-receiver/src/lib.rs

pub struct PostUpdateAtomic<'info> {
    pub payer: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    ///Instead we do the same steps in deserialize_guardian_set_checked.
    pub guardian_set: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub config: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub treasury: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    ///The constraint is such that either the price_update_account is uninitialized or the write_authority is the write_authority.
    ///Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized
    pub price_update_account: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub system_program: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub write_authority: anchor_lang::solana_program::account_info::AccountInfo<'info>,
}
#[automatically_derived]
impl<'info> anchor_lang::ToAccountMetas for PostUpdateAtomic<'info> {
    fn to_account_metas(
        &self,
        is_signer: Option<bool>,
    ) -> Vec<anchor_lang::solana_program::instruction::AccountMeta> {
        let mut account_metas = vec![];
        account_metas.push(anchor_lang::solana_program::instruction::AccountMeta::new(
            anchor_lang::Key::key(&self.payer),
            true,
        ));
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.guardian_set),
                false,
            ),
        );
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.config),
                false,
            ),
        );
        account_metas.push(anchor_lang::solana_program::instruction::AccountMeta::new(
            anchor_lang::Key::key(&self.treasury),
            false,
        ));
        account_metas.push(anchor_lang::solana_program::instruction::AccountMeta::new(
            anchor_lang::Key::key(&self.price_update_account),
            true,
        ));
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.system_program),
                false,
            ),
        );
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.write_authority),
                true,
            ),
        );
        account_metas
    }
}
#[automatically_derived]
impl<'info> anchor_lang::ToAccountInfos<'info> for PostUpdateAtomic<'info> {
    fn to_account_infos(
        &self,
    ) -> Vec<anchor_lang::solana_program::account_info::AccountInfo<'info>> {
        let mut account_infos = vec![];
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(&self.payer));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.guardian_set,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(&self.config));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.treasury,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.price_update_account,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.system_program,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.write_authority,
        ));
        account_infos
    }
}

pub struct PostUpdate<'info> {
    pub payer: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub encoded_vaa: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub config: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub treasury: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    ///The constraint is such that either the price_update_account is uninitialized or the write_authority is the write_authority.
    ///Pubkey::default() is the SystemProgram on Solana and it can't sign so it's impossible that price_update_account.write_authority == Pubkey::default() once the account is initialized
    pub price_update_account: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub system_program: anchor_lang::solana_program::account_info::AccountInfo<'info>,
    pub write_authority: anchor_lang::solana_program::account_info::AccountInfo<'info>,
}
#[automatically_derived]
impl<'info> anchor_lang::ToAccountMetas for PostUpdate<'info> {
    fn to_account_metas(
        &self,
        is_signer: Option<bool>,
    ) -> Vec<anchor_lang::solana_program::instruction::AccountMeta> {
        let mut account_metas = vec![];
        account_metas.push(anchor_lang::solana_program::instruction::AccountMeta::new(
            anchor_lang::Key::key(&self.payer),
            true,
        ));
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.encoded_vaa),
                false,
            ),
        );
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.config),
                false,
            ),
        );
        account_metas.push(anchor_lang::solana_program::instruction::AccountMeta::new(
            anchor_lang::Key::key(&self.treasury),
            false,
        ));
        account_metas.push(anchor_lang::solana_program::instruction::AccountMeta::new(
            anchor_lang::Key::key(&self.price_update_account),
            true,
        ));
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.system_program),
                false,
            ),
        );
        account_metas.push(
            anchor_lang::solana_program::instruction::AccountMeta::new_readonly(
                anchor_lang::Key::key(&self.write_authority),
                true,
            ),
        );
        account_metas
    }
}
#[automatically_derived]
impl<'info> anchor_lang::ToAccountInfos<'info> for PostUpdate<'info> {
    fn to_account_infos(
        &self,
    ) -> Vec<anchor_lang::solana_program::account_info::AccountInfo<'info>> {
        let mut account_infos = vec![];
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(&self.payer));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.encoded_vaa,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(&self.config));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.treasury,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.price_update_account,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.system_program,
        ));
        account_infos.extend(anchor_lang::ToAccountInfos::to_account_infos(
            &self.write_authority,
        ));
        account_infos
    }
}