2021-05-30 12:59:33 -07:00
|
|
|
use crate::{Accounts, Sysvar, ToAccountInfo};
|
2021-01-22 03:35:57 -08:00
|
|
|
use solana_program::account_info::AccountInfo;
|
|
|
|
use solana_program::sysvar::rent::Rent;
|
|
|
|
|
2021-02-07 22:22:50 -08:00
|
|
|
/// The Ctor accounts that can be used to create any account within the program
|
|
|
|
/// itself (instead of creating the account on the client).
|
|
|
|
///
|
|
|
|
/// This is used to create accounts at deterministic addresses, as a function of
|
|
|
|
/// nothing but a program ID--for example, to create state global program
|
|
|
|
/// structs and program IDL accounts. It's currently used **internally** within
|
|
|
|
/// the Anchor `#[program]` codegen.
|
2021-01-22 03:35:57 -08:00
|
|
|
#[derive(Accounts)]
|
|
|
|
pub struct Ctor<'info> {
|
2021-01-29 06:19:00 -08:00
|
|
|
// Payer of the transaction.
|
2021-01-31 00:59:01 -08:00
|
|
|
#[account(signer)]
|
2021-01-22 03:35:57 -08:00
|
|
|
pub from: AccountInfo<'info>,
|
2021-01-29 06:19:00 -08:00
|
|
|
// The deterministically defined "state" account being created via
|
|
|
|
// `create_account_with_seed`.
|
2021-01-22 03:35:57 -08:00
|
|
|
#[account(mut)]
|
|
|
|
pub to: AccountInfo<'info>,
|
2021-01-29 06:19:00 -08:00
|
|
|
// The program-derived-address signing off on the account creation.
|
|
|
|
// Seeds = &[] + bump seed.
|
2021-01-22 03:35:57 -08:00
|
|
|
pub base: AccountInfo<'info>,
|
2021-01-29 06:19:00 -08:00
|
|
|
// The system program.
|
2021-01-22 03:35:57 -08:00
|
|
|
pub system_program: AccountInfo<'info>,
|
2021-01-29 06:19:00 -08:00
|
|
|
// The program whose state is being constructed.
|
2021-01-22 03:35:57 -08:00
|
|
|
pub program: AccountInfo<'info>,
|
2021-01-29 06:19:00 -08:00
|
|
|
// Rent sysvar.
|
2021-01-22 03:35:57 -08:00
|
|
|
pub rent: Sysvar<'info, Rent>,
|
|
|
|
}
|