NT_anchor_lang/ctor.rs
1use crate::{Accounts, ToAccountInfo};
2use solana_program::account_info::AccountInfo;
3
4/// The Ctor accounts that can be used to create any account within the program
5/// itself (instead of creating the account on the client).
6///
7/// This is used to create accounts at deterministic addresses, as a function of
8/// nothing but a program ID--for example, to create state global program
9/// structs and program IDL accounts. It's currently used **internally** within
10/// the Anchor `#[program]` codegen.
11#[derive(Accounts)]
12pub struct Ctor<'info> {
13 // Payer of the transaction.
14 #[account(signer)]
15 pub from: AccountInfo<'info>,
16 // The deterministically defined "state" account being created via
17 // `create_account_with_seed`.
18 #[account(mut)]
19 pub to: AccountInfo<'info>,
20 // The program-derived-address signing off on the account creation.
21 // Seeds = &[] + bump seed.
22 pub base: AccountInfo<'info>,
23 // The system program.
24 pub system_program: AccountInfo<'info>,
25 // The program whose state is being constructed.
26 pub program: AccountInfo<'info>,
27}